PEAR_Soap - How to invoke and send parameters to Document/Literal (.Net based) Soap Operations
| From: | Quinton Parker | Date: | Tue, 23 Aug 2005 07:49:05 +0000 |
| Subject: | PEAR_Soap - How to invoke and send parameters to Document/Literal (.Net based) Soap Operations | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-20534@lists.php.net to get a copy of this message | ||
Hi (to anyone that's listenin)
Am new to this mailing list... pls scream if i'm doin somethin wrong here! ;-)
I'm guessing that i blurt out my prob and some nice person helps me out if they can???
*My Prob:*
I'm using PEAR's SOAP package to invoke soap actions on a .Net Web Service
The WSDL for this service:
http://newautomark.eodev.co.za/vehiclesearch/default.asmx?WSDL
I'm able to successfully request Soap messages for all operations defined (ie. getManufacturers, getRegions, getToyotaModels) except for the "Execute" operation.
I believe this is coz the Execute op is the only operation that requires parameters to be sent to it.
Since .Net defaults to Document/Literal for datatypes and PEAR defaults to rpc encoding there is a mismatch.
Here is an excerpt from my PHP that instantiates the Soap_client proxy:
<?php
require 'SOAP/Client.php';
$oWSDL =& new SOAP_WSDL('http://newautomark.eodev.co.za/vehiclesearch/default.asmx?WSDL');
$oSoapProxy =& $oWSDL->getProxy();
$oResponse = $oSoapProxy->Execute('WC','600','CAMRY','40000','120000','1998','2005');
?>
And here is an Excerpt from the Proxy code generated which shows that the "Document/Literal" option has in fact been specified for the Soap request.
function &Execute($region, $manufacturer, $toyotamodel)
{
$Execute =& new SOAP_Value('{http:/www.automark.co.za/VehicleSearch/}Execute', false, $v = array('region' => $region, 'manufacturer' => $manufacturer, 'toyotamodel' => $toyotamodel));
return $this->call('Execute',
$v = array('Execute' => $Execute),
array('namespace' => 'http:/www.automark.co.za/VehicleSearch/',
'soapaction' => 'http:/www.automark.co.za/VehicleSearch/Execute',
'style' => 'document',
'use' => 'literal'));
}
And here is the SOAP message (generated by SOAP_Client that is sent to the .Net Web Service:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
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/"
xmlns:ns4="http:/www.automark.co.za/VehicleSearch/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns4:Execute>
<region xsi:type="xsd:string">WC</region>
<manufacturer xsi:type="xsd:string">600</manufacturer>
<toyotamodel xsi:type="xsd:string">CAMRY</toyotamodel>
<pricefrom xsi:type="xsd:string">40000</pricefrom>
<priceto xsi:type="xsd:string">120000</priceto>
<yearfrom xsi:type="xsd:string">1998</yearfrom>
<yearto xsi:type="xsd:string">2005</yearto>
</ns4:Execute>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
This is rpc encoding NOT document/literal...
OR
am i missing somethin here? Must admit i am fairly new to Web Services
Thanks (to anyone that read this or tries to help!)
Quinton
*
*