PHP5 soap request, complex type from wsdl issues

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • obj63
    New Member
    • Mar 2008
    • 6

    PHP5 soap request, complex type from wsdl issues

    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
    Code:
    <SOAP-ENV:Body>
    <ns1:CancelEnhancedListing xsi:type="ns1:135">
    <item><key>ListingID</key><value>12</value></item>
    </ns1:CancelEnhancedListing>
    </SOAP-ENV:Body>
    The problem is I need it to look like the following:
    Code:
    <soap:Body>
        <ns1:CancelEnhancedListing xmlns="mynamespace">
          <Arguments>
            <ListingID>int</ListingID>
          </Arguments>
        </ns1:CancelEnhancedListing>
      </soap:Body>
    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, "mynamespac e");

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

    Thanks again for all your help,
    Joe
  • obj63
    New Member
    • Mar 2008
    • 6

    #2
    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'=>$my arg), SOAP_ENC_OBJECT , null, 'namespace', 'Arguments', 'namespace' );

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

    This then gives me the following:
    Code:
    <SOAP-ENV:Body>
     <ns1:CancelEnhancedListing>
      <ns1:Arguments>
       <ListingID>12</ListingID>
      </ns1:Arguments>
     </ns1:CancelEnhancedListing>
    </SOAP-ENV:Body>
    But I need it to be
    Code:
    <SOAP-ENV:Body>
     <ns1:CancelEnhancedListing>
      <ns1:Arguments>
       <ns1:ListingID>12</ns1:ListingID>
      </ns1:Arguments>
     </ns1:CancelEnhancedListing>
    </SOAP-ENV:Body>
    Any ideas why it is not assigning my variable ListingID to the same namespace?

    Thanks
    Joe

    Comment

    Working...