I using curl to send a SOAP request to a web service and get the response using shell scripting. please find below the command i am using:-
curl -H "Content-Type: text/xml; charset=utf-8" -H "SOAPAction:" -d #sample_request.txt -X POST http://someWebServiceURL
I am getting an error response which says no SOAPAction header.
PFB the response body part
<soapenv:Body>
<soapenv:Fault>
<faultcode>Client.NoSOAPAction</faultcode>
<faultstring>WSWS3147E: Error: no SOAPAction header!</faultstring>
</soapenv:Fault>
</soapenv:Body>
Any help is appreciated !!
You need to provide the name of the SOAP action. You have:
-H "SOAPAction:"
Supply the name of the action in there. E.g.
-H "SOAPAction: http://my_example/my_action"
Get the name of the action from the WSDL if you have one. E.g., see How do you determine a valid SoapAction?.
From the WSDL of the service, you can find the SoapAction. And you can find the operation you're trying to invoke and access the WSDL by opening a web browser to the URL of the service.
Using the curl to invoke the SoapAction, you should specify the Action by "-H", such as -H SOAPAction: http://tempuri.org/Execute.
Related
How can I compose a curl command line that contains a wsa:To Soap specification for example http://myserver.services.com/Services/ServiceUsers.svc?wsdl?
Well, in the end this is not what I wanted but I managed to achieve my goal. The solution was to use the --data argument followed by the xml request corresponding to the request and in it put the wsa:To header. By example:
curl --location --request POST 'http://myserver.services.com/Services/ServiceUsers.svc' --header 'Content-Type: application/soap+xml; charset=UTF-8' --data '<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:tem="http://tempuri.org/"><soap:Header xmlns:wsa="http://www.w3.org/2005/08/addressing"><wsa:Action>http://tempuri.org/IServiceUsers/UsersList</wsa:Action><wsa:To>http://myserver.services.com/Services/ServiceUsers.svc</wsa:To></soap:Header><soap:Body><tem:UsersList/></soap:Body></soap:Envelope>'
Thanks to #DingPeng for his help, you may be right about the availability of the .Net framework
I am trying to create webhook as per this document and this doesn't include any clue about where does the token comes from.
https://docs.flock.com/display/flockos/Create+An+Incoming+Webhook
My curl command as below
curl -X POST -H "Content-Type: application/json" https://api.flock.com/hooks/sendMessage/guid-guid -d '{"text": "This is a test message.","token":"test"}'
Error message:
{"error":"InvalidParameter","description":"A required parameter for the method call is missing or invalid","parameter":"token"}
Can someone point me what's missing here.
Flock gives you the token for the webhook when you finish adding a new one at https://dev.flock.com/webhooks
You can look it up again when you're done by going to the edit option for the webhook you've added; at the moment the token is given at the bottom of the page:
Webhook URL
Send your JSON payload to this URL
[your-token-here]
i am loading xml as String from Remote using curl as below:
$ curl -i -H "Accept: application/xml" -X GET "URL Here"
but response is not xml format, hence not easily readable.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><RunConfig <PipeLineXmlVersion>1.0</PipeLineXmlVersion><DateTime>20161128_160859</DateTime><Analysis><Lane>1</Lane><PipeLine>run_multiplexed_auto_start_v4.0.sh</PipeLine><Version>4.0</Version><Mismatch>1</Mismatch><MergeLane>0</MergeLane<Version>4.0</Version></Analysis></RunConfig>
When i try the same API using some REST client then i can see the proper xml.
As i searched, Accept header should work but unfortunately not in my case.
Please help me with this.
Thanks.
If what you mean by "not proper" is the fact that the response is not pretty printed (i.e. lack spaces and indent), there are plenty of command line tools to format xml.
For example:
curl ... | xmllint --format -
Here, you pass the response of curl to xmllint (part of xmllib2-utils), which will format your answer. The - in the end tells the tool to print the result in the console.
Have a look at this question for more ways to achieve it.
I am working on Windows10 and tried to load a geojson file into my couchdb via the "curl" command and a POST request in the cmd which looks like that:
C:\Program Files\cURL\bin>curl -d #path-to-my-data\data.geojson -H "Content-type: application/json" -X POST http://127.0.0.1:5984/_utils/database.html?-dbName-
and then I get the following error:
{"error":"method_not_allowed","reason":"Only GET,HEAD allowed"}
On http://couchdb-13.readthedocs.org/en/latest/api-basics/ it is said, that "If you use the an unsupported HTTP request type with a URL that does not support the specified type, a 405 error will be returned, listing the supported HTTP methods."
When I try that with a PUT request, I get the same error.
I validated the json with jsonlint so this should not be the problem.
I tried several tutorials like "Three Steps to CouchDB Heaven …" or "Export & Import a Database with CouchDB" but none of them seems to work.
So I am not sure, where the problem is. Do I need to make changes in my geojson file, or something else?
thanks for your help
The needed curl command just looks like that:
curl -H "Content-Type: application/json" -X POST http://localhost:5984/db -d #C:\Users\Name\Desktop\data.geojson
How do I convert this curl command to ajax http request?
curl --insecure -h 'content-type' -d '<payload></payload>' https://ourback.end.servers/context-path.aspx
This is working in curl, but every time we access it via our ajax request, we encountered SSL3 wrong version number.
Thank you guys.