By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,002 Members | 2,137 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,002 IT Pros & Developers. It's quick & easy.

PHP5 soap request, complex type from wsdl issues

P: 6
Hi All,

TIA, but currently I am trying to make a soap call to an API and I am not able to get the soap body to conform properly.

The current soap body that I am generating is
Expand|Select|Wrap|Line Numbers
  1. <SOAP-ENV:Body>
  2. <ns1:CancelEnhancedListing xsi:type="ns1:135">
  3. <item><key>ListingID</key><value>12</value></item>
  4. </ns1:CancelEnhancedListing>
  5. </SOAP-ENV:Body>
The problem is I need it to look like the following:
Expand|Select|Wrap|Line Numbers
  1. <soap:Body>
  2.     <ns1:CancelEnhancedListing xmlns="mynamespace">
  3.       <Arguments>
  4.         <ListingID>int</ListingID>
  5.       </Arguments>
  6.     </ns1:CancelEnhancedListing>
  7.   </soap:Body>
  8.  
Can some help me create the proper parameter to pass through with PHP code. I have been looking everywhere for an example similar to this but no luck.

This is what I have so far with somethings hidden for specific reasons
[PHP]
$param = new SoapVar(array('ListingID'=> 12), null, XSD_INT, "mynamespace");

client = new SoapClient('my wsdl location', array('trace'=>1));
$result = $client->CancelEnhancedListing($param);
[/PHP]

Thanks again for all your help,
Joe
Aug 27 '08 #1
Share this Question
Share on Google+
1 Reply


P: 6
After some testing I have gotten closer with the following

[PHP]$myarg = new SoapVar(array('ListingID'=>12), SOAP_ENC_OBJECT, null, 'namespace', 'ListingID', 'namespace');
$myarg2 = new SoapVar(array('Arguments'=>$myarg), SOAP_ENC_OBJECT, null, 'namespace', 'Arguments', 'namespace' );

$result = $client->CancelEnhancedListing($myarg2);
[/PHP]

This then gives me the following:
Expand|Select|Wrap|Line Numbers
  1. <SOAP-ENV:Body>
  2.  <ns1:CancelEnhancedListing>
  3.   <ns1:Arguments>
  4.    <ListingID>12</ListingID>
  5.   </ns1:Arguments>
  6.  </ns1:CancelEnhancedListing>
  7. </SOAP-ENV:Body>
But I need it to be
Expand|Select|Wrap|Line Numbers
  1. <SOAP-ENV:Body>
  2.  <ns1:CancelEnhancedListing>
  3.   <ns1:Arguments>
  4.    <ns1:ListingID>12</ns1:ListingID>
  5.   </ns1:Arguments>
  6.  </ns1:CancelEnhancedListing>
  7. </SOAP-ENV:Body>
Any ideas why it is not assigning my variable ListingID to the same namespace?

Thanks
Joe
Aug 27 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.