« Return to Thread: trying to form a soap query like an example

trying to form a soap query like an example

by Mike Bloom-3 :: Rate this Message:

Reply to Author | View in Thread

Hi,

I've been wrestling with a vendor soap api, I'm trying to make the php
generated request look like the example.


any suggestions ?


  Vendor Request:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope  xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://10.10.12.131/jboss-net/services/sylantro/eu" xmlns:types="http://10.10.12.131/jboss-net/services/sylantro/eu/encodedTypes" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
 <soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
  <tns:getContactDetails>
  <in0 href="#id1"/>
  <in1 href="#id2"/>
  </tns:getContactDetails>
  <q1:AuthenticationInfo id="id1" xsi:type="q1:AuthenticationInfo" xmlns:q1="http://webapi.sylantro.com/webapi">
  <locale xsi:type="xsd:string">en</locale>
  <token xsi:type="xsd:string">f2552f9eea6180685d07ecbc399d56f5afc06c30c8173049595f8d84846be6a37ff7caa9f5826e0a8c0e809f4f9a225fac1144b821bfbb737247a0a88fecaff821f89f9366fe3d34b9e9b3acf478b6fea77acc3e60a16f6af0a16ecc0040f744</token>
  <userType xsi:type="xsd:int">1</userType>
  </q1:AuthenticationInfo>
  <soapenc:Array id="id2" soapenc:arrayType="xsd:string[1]">
  <Item>73485de4-1dd2-11b2-b889-b03162323164</Item>
  </soapenc:Array>
 </soap:Body>
</soapenv:Envelope>


------------------------------------------------------------------------


  php generated request:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://10.10.12.131/jboss-net/services/sylantro/eu" xmlns:ns2="http://webapi.sylantro.com/webapi" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
 <SOAP-ENV:Body>
  <ns1:getContactDetails>
   <in0 xsi:type="ns2:AuthenticationInfo">
    <locale xsi:type="xsd:string">en</locale>
    <token xsi:type="xsd:string">f2552f9eea6180685d07ecbc399d56f5afc06c30c8173049595f8d84846be6a37ff7caa9f5826e0a8c0e809f4f9a225fac1144b821bfbb737247a0a88fecaff821f89f9366fe3d34b9e9b3acf478b6fea77acc3e60a16f6af0a16ecc0040f744</token>
    <userType xsi:type="xsd:int">1</userType>
   </in0>
   <in1 SOAP-ENC:arrayType="xsd:string[1]" xsi:type="ns1:ArrayOf_xsd_string">
    <item xsi:type="xsd:string">73485de4-1dd2-11b2-b-b03162323164</item>
   </in1>
  </ns1:getContactDetails>
 </SOAP-ENV:Body>
</SOAP-ENV:Envelope>



Php code:

$wsdl2    = 'http://10.10.12.131/jboss-net/services/sylantro/eu?wsdl';
$options2 = array('trace' => 1, 'exceptions' => 1, 'features' =>
SOAP_SINGLE_ELEMENT_ARRAYS, 'style' => SOAP_DOCUMENT, 'use' =>
SOAP_LITERAL);
$euc      = new SoapClient($wsdl2, $options2);

$contact_id = '73485de4-1dd2-11b2-b-b03162323164';

$clRequest = array($contact_id);

try {
        $contacts = $euc->getContactDetails($auth, $clRequest);

} catch (SoapFault $ex) {
        //print "<h1>Error:</h1><pre>". print_r ($ex, 1) ."</pre><br/>\n";
        #return;
}

$lreq = $euc->__getLastRequest();



print "<h1>php generated request:</h1><pre>". htmlspecialchars($lreq)
."</pre><br/>\n";




--
PHP Soap Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

 « Return to Thread: trying to form a soap query like an example

LightInTheBox - Buy quality products at wholesale price!