Solved

SOAP request from Linux CLI

Posted on 2014-03-10
4
805 Views
Last Modified: 2016-02-26
Hi,

I am currently trying to use a SOAP service to access my Cisco Call Manager via AXL. However I want to do this from Linux CLI. If I use SoapUI I can use the soap.xsd and api.wsdl to get it working, however I want to get it working from Linux CLI.

The SOAP XML from SoapUI looks like this

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.cisco.com/AXL/API/8.5">
   <soapenv:Header/>
   <soapenv:Body>
      <ns:listRoutePlan sequence="?">
         <searchCriteria>
           
            <partition>Extensions</partition>
           
         </searchCriteria>
         <returnedTags uuid="?">
            <!--Optional:-->
            <dnOrPattern>?</dnOrPattern>
            <!--Optional:-->
            <partition uuid="?">?</partition>
            <!--Optional:-->
            <type>?</type>
            <!--Optional:-->
            <routeDetail>?</routeDetail>
         </returnedTags>
       
      </ns:listRoutePlan>
   </soapenv:Body>
</soapenv:Envelope>


and the RAW data looks like

POST https://192.168.1.245:8443/axl/ HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: "CUCM:DB ver=8.5 listRoutePlan"
Content-Length: 743
Host: 192.168.1.245:8443
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
Authorization: Basic YXhsOk5pZW

I have tried a whole heap of googling and trying different cURL options and just can't get it to work.

My goal is to query the Server and get an output back with what I have requested and save to a txt file.

How can I complete this?

Thanks in advance!
0
Comment
Question by:mark_06
  • 3
4 Comments
 
LVL 32

Accepted Solution

by:
shalomc earned 500 total points
Comment Utility
Using curl:

Save the XML into a file called my_request.xml

curl --request POST
  --header "SOAPAction: CUCM:DB ver=8.5 listRoutePlan"
  --header "Content-type: text/xml;charset=UTF-8"
  --header "User-Agent: Apache-HttpClient/4.1.1 (java 1.5)"
  --header "Authorization: Basic YXhsOk5pZW"
  --data @my_request.xml -o response.txt "https://192.168.1.245:8443/axl/"
0
 
LVL 6

Author Comment

by:mark_06
Comment Utility
Thanks for that, I get a response now but still not working...

I get this in the output file
"Unexpected EOF in prolog at [row,col {unknown-source}]: [1,0]"
What could cause this?
0
 
LVL 6

Author Comment

by:mark_06
Comment Utility
This is my request file

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://localhost/">
   <soapenv:Header/>
   <soapenv:Body>
      <ns:listRoutePlan sequence="?">
         <searchCriteria>
           
            <partition>Extensions</partition>
           
         </searchCriteria>
         <returnedTags uuid="?">
            <!--Optional:-->
            <dnOrPattern>?</dnOrPattern>
            <!--Optional:-->
            <partition uuid="?">?</partition>
            <!--Optional:-->
            <type>?</type>
            <!--Optional:-->
            <routeDetail>?</routeDetail>
         </returnedTags>
       
      </ns:listRoutePlan>
   </soapenv:Body>
</soapenv:Envelope>

I have the wsdl and xsd files sitting here "http://localhost/"
0
 
LVL 6

Author Closing Comment

by:mark_06
Comment Utility
Just had to tweak it a bit but worked thanks
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
I made this because I wanted to get e-mail with a attached csv file so I'd would be able to import user input into a MS Excel template, but I also wanted to register/save all inputs from each day in a file on the server. 1st - It creates a temp C…
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now