cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: CURL custom POST commands

From: Fitzgerald, Kevin <kevin.fitzgerald_at_hp.com>
Date: Mon, 20 Jul 2015 15:30:20 +0000

On 7/17/2015 2:40 PM, Fitzgerald, Kevin wrote:

Thank you for the example. But I think I am not going about this correctly. What I actually need to be able to do is connect to a web service (which it appears I am able to do), and send it a POST request. Below is an example of the request that I am sending. I think I really just need a curl option that will simply send the request to the web service. Any thoughts, can this be done (I’m hoping!)?

Again, thanks.

POST /licensecertificationext/service/licensecertification.asmx HTTP/1.1
Host: acc.dwd.wisconsin.gov
Connection: keep-alive
Authorization: Basic – an encrypted username and password here
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Content-Type: text/xml; charset=utf-8
Content-Length: 767

SOAPAction:"http://workweb.dwd.state.wi.us/KIDS/LicenseCertification/Service/checkCertifications"<http://workweb.dwd.state.wi.us/KIDS/LicenseCertification/Service/checkCertifications>

Please don't top post it makes the conversation harder to follow. This is what it would look like, all one line:

curl -u user:pass --data-binary @soapreq.xml -H "Content-Type: text/xml; charset=utf-8" -H "SOAPAction: \"https://workweb.dwd.state.wi.us/KIDS/LicenseCertification/Service/checkCertifications\"<https://workweb.dwd.state.wi.us/KIDS/LicenseCertification/Service/checkCertifications/>" https://acc.dwd.wisconsin.gov/licensecertificationext/service/licensecertification.asmx

Put your XML in soapreq.xml. Note I changed both urls to https, which I strongly recommend you use for something like this if it's accepted, even if it's not yet mandatory. In the XML I'd change the 'checkCertifications xmlns' url to https as well.

Sorry about the top posting. Thanks for this, but it looks like a command line request. What I need to do is send my POST within a C program in a UNIX environment. I was not clear on that. I guess what need to be able to do using the CURL commands in C, is set up an HTTP socket that allows me to send the custom request to the web service and receive a response. I have tried different things but CURL is creating its own POST command that is rejected by the web service as unauthorized (401), because it is password protected, so the web service never actually sees my custom POST request. What I am looking for is an example of a C program that does something like what I am trying to do, as I am new to CURL and am trying to figure things out on the fly.

Thanks, Kevin

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2015-07-20