cancel
Showing results for 
Search instead for 
Did you mean: 

Correctly formatted xml soap request

SOLVED

Correctly formatted xml soap request

I am trying to integrate a solution to create shipments, add tracking and create invoices for orders, but I cannot find any examples of correctly formatted xml SOAP requests.  

 

For example, I have this xml request that was generated from the WSDL, but it isn't right, because it fails.  Even if it were right I have no idea how I would correctly format multiple arguments.  this request only has one, but AddTracking for example, will have at least two arguments.  I would like to find some correct examples of how to format this.  

 

<?xml version='1.0' encoding='UTF-8'?>
<ns1:call xmlns:ns1="urn:Magento">
<sessionId>95a25c1a92ca930452936c16a7a8bdfd</sessionId>
<resourcePath>sales_order_shipment.create</resourcePath>
<args>600002002</args>
</ns1:call>

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Correctly formatted xml soap request

So it turns out that I AM able to use V2 soap calls.  Which solves my whole problem.  I'm not sure why no one just told me that I was wrong to think I couldn't make them.  No one really answered my original question because I don't think anyone really understood what I was asking.  since I can make soap v2 calls I get properly formatted xml for everything I need so I'm all set.  

For reference, the issue was that I didn't realize that soap v2 had a different url endpoint than soap v1.  I knew the WSDL was different, I didn't know the API endpoint was different.  Once that was corrected soap v2 started working correctly.  

View solution in original post

5 REPLIES 5

Re: Correctly formatted xml soap request

Refer to below wiki. You may need to put your server host

new SoapClient('http://<Your_Host>/api/soap/?wsdl');

 in order to get the exact format of all available SOAP API's format in Magento for "Sales Order Shipment".

 

http://devdocs.magento.com/guides/m1x/api/soap/sales/salesOrderShipment/salesOrderShipment.html
-- Ravindra

Re: Correctly formatted xml soap request

Yes I have been looking at this.  You'll notice that nothing at that location is in xml format.  So it is not what I would call the exact request.  I'm looking for the exact xml request.

Re: Correctly formatted xml soap request

Here is complete code to call Magento API V1 services. You may need to change the values 

highlighted italic values with the original one.

 

$api_url_v1 = "http://<Your_Host>/api/soap/?wsdl=1";

// If somestuff requires api authentification,
$username = '<API_USER>'; //example: demouser
$password = '<API_KEY>';   //example: demokey
 
$cli = new SoapClient($api_url_v1);
 
//retreive session id from login
$session_id = $cli->login($username, $password);
 
//call your API V1 Method like "customer.list" or "sales_order.list" etc.
$result = $cli->call($session_id, '<API_METHOD>', array(array()));
 

 

-- Ravindra

Re: Correctly formatted xml soap request

I think I'm figuring some of this out.  Give me a bit to review and I'll reply when I have it.  Thanks for your help Ravindra!

Re: Correctly formatted xml soap request

So it turns out that I AM able to use V2 soap calls.  Which solves my whole problem.  I'm not sure why no one just told me that I was wrong to think I couldn't make them.  No one really answered my original question because I don't think anyone really understood what I was asking.  since I can make soap v2 calls I get properly formatted xml for everything I need so I'm all set.  

For reference, the issue was that I didn't realize that soap v2 had a different url endpoint than soap v1.  I knew the WSDL was different, I didn't know the API endpoint was different.  Once that was corrected soap v2 started working correctly.