I am trying to access Siebel WSDL through python module.
My End Scenario is creating Service request in Siebel through external link.
I have tried,
Requests, Suds and soapPY.
When Importing WSDL file to SOAP-UI after making changes to URL and appending user-name and password to same and making changes in body, Its working for me and giving 200 server response.
When trying to access the same with postman(rest client) and giving URL with user name and password added. And passing the required XML as part of body I am getting 500 internal server error.
Not understanding where difference is coming in the way the request is going through soapUI and postman.
What difference in I have to make, to make it work with postman.
What is the right way to consume a WSDL service in python.
SOAP Input:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:aud="http://siebel.com/Service/ServiceReqs" xmlns:aud1="http://www.siebel.com/xml/%20Service%20Request%20IO">
<soapenv:Header/>
<soapenv:Body>
<aud:SRQueryByExample_Input>
<aud1:ListOfServiceRequestIo>
<aud1:ServiceRequestOpen Operation="?">
<aud1:IntegrationId>0000123</aud1:IntegrationId>
</aud1:ServiceRequestOpen>
</aud1:ListOfAudetemiServiceRequestIo>
</aud:SRQueryByExample_Input>
</soapenv:Body>
</soapenv:Envelope>
I need to know here if Integration ID is something that I need to pass dynamically how to achieve same.
Many thank for your time
If you are getting a 500 error, that means the request is stuck at the web server, and has not yet hit the siebel server behind it. If the error is due to something missing in the xml, you will get a "SBL-" error code in the response. Until you get that, and are getting 500 errors, the request SOAP has not yet hit the siebel server.
I don't know python, but my suggestion would be to capture the RAW message going from your python script and compare that to the RAW message in SOAP-UI. Specially check the SOAPAction string, it should have a forward slash (/) and a colon (:). "Content-Type", "text/xml"
For further debugging, you will have to check the webserver logs to see how the message arrives there.
Related
I'm trying to get my heart rate and sleep data through fitbit API, i'm using this:
https://github.com/orcasgit/python-fitbit
in order to connect to the server and get the access and refresh tokens (i use gather_kays_oauth2 to get the tokens).
And when i'm conecting in HTTP I do manage to get the sleep data, but when i'm trying to get the HR like that:
client.time_series("https://api.fitbit.com/1/user/-/activities/heart/date/today/1d.json", period="1d")
I get this error:
HTTPBadRequest: this request must use the HTTPS protocol
And for some reason i can't connect in HTTPS - when i do try it, the browser pops up an ERR_SSL_PROTOCOL_ERROR even before the FITBIT Authorization Page.
i tried to follow and fix any settings that may cause the browser to fail, but they're all good and the error still pops up.
I've tried to change the callback URL, i searched for other fitbit OAUTH2 connection guides, but i only manage to connect in HTTP and not HTTPS
Does anyone knows how to solve it?
Your code should be client.time_series('activities/heart', period='1d') to get heart rate.
For the first parameter resource, it doesn't need the resource URL, but it asks you to put one of these: activities, body, foods, heart, sleep.
Here is the link of source code from python-fitbit:
http://python-fitbit.readthedocs.io/en/latest/_modules/fitbit/api.html#Fitbit.time_series
Added:
If you want to get the full heart rate data per minute (["activities-heart-intraday"] dataset), try client.intraday_time_series('activities/heart'). It will return data with the one-minute/one-second detail.
Ok I've worked out the HTTPS issue in relation to my need. It was because I sent a request to.
https://api.fitbit.com//1/user/-/activities/recent.json
I removed the additional forward slash after .com and it worked
https://api.fitbit.com/1/user/-/activities/recent.json
However, this is not the same issue you had which returned the same message for me this request must use the HTTPS protocol.
Which would suggest that any unhandled errors due to malformed requests to Fitbit return this same error. Rather than one that gives you a little more clue as to what just happened.
I searched but did not found any example showing on how to convert CoAP request or response to HTTP request.
Basically what I want to do is CoAP request POST some data from device to a server which will translate it and do HTTP request POST to other server to be save inside the database.
While the part to save the data is not a major problem right now, I did not managed to find any example script showing how to convert from CoAP to HTTP.
I already looked at coapthon , aiocoap but since aiocoap requires python 3.5,(I use python 2.7) that left me with coapthon. Unfortunately coapthon only has HTTP to CoAP proxy while CoAP to HTTP is still in development.
If anyone know other project regarding this or has any opinion on how to solve this, I am glad if you can share it. Thank you.
That is called Protocol Interoperability. You Need a CoAP - HTTP and HTTP - CoAP proxy that can translate the messages between them.
Here is californium-proxy on GitHub, I am using it already. Here is the example that shows how to use it.
I need to initiate an action on server via sending the HTTP request with GWT-RPC call in body section. I'm completely new in GWT subject so please forgive my lack of knowledge. In Java I was able to perform this action via sending HTTP POST request with proper headers and GWT-RPC in body so I tried to do the same in Python with requests library.
Unfortunately, when sending GWT-RPC call I got response:
//EX[2,1,["com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException/3936916533","This application is out of date, please click the refresh button on your browser. ( Malformed or old RPC message received - expecting version between 5 and 7 )"],0,7]
I read few topics:
Manually generating x-gwt-rpc from Python,
com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException
and as I understood there's no way to send the GWT-RPC call from other platform than Java without some additionall effort. Please correct me and advise if I'm wrong.
I have Python-Eve running with MongoDB on a Ubuntu VM. I am trying to write an api to handle POST requests from an Iridium RockBLOCK modem. I have tested the API with Chrome Postman, and am able to successfully POST data.
When I try and send messages from my RockBLOCK I get 422 error messages on the VM. I am pretty sure this is because the RockBLOCK is not able to handle XML or JSON data, and is set up to simply look for an HTTP 200 response.
So how would I setup eve to respond with solely HTTP 200 when the POST request is received?
API Format taken from RockBLOCK Web Services Guide.
The 422 is returned from Eve when a validation error occurs. I would look into your request payload and make sure it adheres to validation rules. A typical example of a response like this would be when you have a unique rule for a field, and a POST comes in with an already used value for that field.
So how would I setup eve to respond with solely HTTP 200 when the POST request is received?
Right now you can disable either JSON or XML responses by respectively setting JSON = False or XML = False, but not both. Since Eve is a Flask application you could look into changing the response on the flight but again, given the error you are getting I don't think that is the problem you are facing right now.
I am using urllib2 to do an http post request using Python 2.7.3. My request is returning an HTTPError exception (HTTP Error 502: Proxy Error).
Looking at the messages traffic with Charles, I see the following is happening:
I send the HTTP request (POST /index.asp?action=login HTTP/1.1) using urllib2
The remote server replies with status 303 and a location header of ../index.asp?action=news
urllib2 retries sending a get request: (GET /../index.asp?action=news HTTP/1.1)
The remote server replies with status 502 (Proxy error)
The 502 reply includes this in the response body: "DNS lookup failure for: 10.0.0.30:80index.asp" (Notice the malformed URL)
So I take this to mean that a proxy server on the remote server's network sees the "/../index.asp" URL in the request and misinterprets it, sending my request on with a bad URL.
When I make the same request with my browser (Chrome), the retry is sent to GET /index.asp?action=news. So Chrome takes off the leading "/.." from the URL, and the remote server replies with a valid response.
Is this a urllib2 bug? Is there something I can do so the retry ignores the "/.." in the URL? Or is there some other way to solve this problem? Thinking it might be a urllib2 bug, I swapped out urllib2 with requests but requests produced the same result. Of course, that may be because requests is built on urllib2.
Thanks for any help.
The Location being sent with that 302 is wrong in multiple ways.
First, if you read RFC2616 (HTTP/1.1 Header Field Definitions) 14.30 Location, the Location must be an absoluteURI, not a relative one. And section 10.3.3 makes it clear that this is the relevant definition.
Second, even if a relative URI were allowed, RFC 1808, Relative Uniform Resource Locators, 4. Resolving Relative URLs, step 6, only specifies special handling for .. in the pattern <segment>/../. That means that a relative URL shouldn't start with ... So, even if the base URL is http://example.com/foo/bar/ and the relative URL is ../baz/, the resolved URL is not http://example.com/foo/baz/, but http://example.com/foo/bar/../baz. (Of course most servers will treat these the same way, but that's up to each server.)
Finally, even if you did combine the relative and base URLs before resolving .., an absolute URI with a path starting with .. is invalid.
So, the bug is in the server's configuration.
Now, it just so happens that many user-agents will work around this bug. In particular, they turn /../foo into /foo to block users (or arbitrary JS running on their behalf without their knowledge) from trying to do "escape from webroot" attacks.
But that doesn't mean that urllib2 should do so, or that it's buggy for not doing so. Of course urllib2 should detect the error earlier so it can tell you "invalid path" or something, instead of running together an illegal absolute URI that's going to confuse the server into sending you back nonsense errors. But it is right to fail.
It's all well and good to say that the server configuration is wrong, but unless you're the one in charge of the server, you'll probably face an uphill battle trying to convince them that their site is broken and needs to be fixed when it works with every web browser they care about. Which means you may need to write your own workaround to deal with their site.
The way to do that with urllib2 is to supply your own HTTPRedirectHandler with an implementation of redirect_request method that recognizes this case and returns a different Request than the default code would (in particular, http://example.com/index.asp?action=news instead of http://example.com/../index.asp?action=news).