Skip to content

Instantly share code, notes, and snippets.

@jaredbeck
Created November 27, 2012 20:53
Show Gist options
  • Save jaredbeck/4156939 to your computer and use it in GitHub Desktop.
Save jaredbeck/4156939 to your computer and use it in GitHub Desktop.
Using CURL to make a SOAP request against PFAPI 1.1

Given a file with a SOAP request ...

$ cat cupa_request.xml
<?xml version="1.0" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Body s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <q1:unit_fetch xmlns:q1="http://v1_1.v.pfapi.remote_api">
      <u xsi:type="xsd:string">cupahr_remote</u>
      <p xsi:type="xsd:string">REDACTED</p>
      <pf_unitID xsi:type="xsd:double">24645</pf_unitID>
    </q1:unit_fetch>
  </s:Body>
</s:Envelope>

a request can be sent with curl.

curl -H "Content-Type: text/xml; charset=utf-8" \
	-H "Accept: application/soap+xml, application/dime, multipart/related, text/*" \
	-H 'SOAPAction: ""' \
	--data @cupa_request.xml \
	http://surveysonline.cupahr.org/remote_api/pfapi/v/v1_1/pfapi.cfc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment