PEAR Forum :: PHP Extension and Application Repository

PEAR Forum Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
SOAP_client! please help me !

 
Post new topic   Reply to topic    PEAR Forum Forum Index -> XML
View previous topic :: View next topic  
Author Message
benward



Joined: 17 Mar 2010
Posts: 1

PostPosted: Wed Mar 17, 2010 4:48 pm    Post subject: SOAP_client! please help me ! Reply with quote

Hi All,

Thanks for reading.

My organisation is considering using PHP as a replacement for our classic ASP pages. It's currently my job to convince them that PHP is better than ASP!

I'm trying to use the PEAR SOAP_client object to connect to a webservice with the below code:

Code:

require_once ("SOAP/Client.php");

define ("SOURCE_URL","http://192.168.91.76:8081/FortisInsuranceWebApp/FortisInsuranceMotorQuoteWS");

$motorquote = new SOAP_client (SOURCE_URL, False);

$QRequest["EffectiveDate"] = "2010-03-25";
$QRequest["AgentCode"] = "38004W";
$QRequest["PolicyType"] = "S";
$QRequest["CoverType"] = "01";
$QRequest["TransactionType"] = 1;

$params = array("QRequest" => $QRequest);

$response = $motorquote->call("", $params);
if(PEAR::isError($response))
   echo "Error " . $response->getCode() . " [" . $response->getMessage() . "]";
else{
   print_r($response);
   }



the xml that this sends through to our webservice is this:

Code:

<?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/"
 SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<item>
<QRequest>
<EffectiveDate xsi:type="xsd:string">2010-03-25</EffectiveDate>
<AgentCode xsi:type="xsd:string">38004W</AgentCode>
<PolicyType xsi:type="xsd:string">S</PolicyType>
<CoverType xsi:type="xsd:string">01</CoverType>
<TransactionType xsi:type="xsd:int">1</TransactionType></QRequest></item>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>


I have not anywhere specified to use <item> as my root element and the webservice needs <QRequest> to be the root element.

How can I stop the SOAP_client object adding this unwanted element?

Thanks,
Ben
_________________
----

Ben Ward
Analyst Programmer
Fortis Insurance Limited
Back to top
View user's profile Send private message
Cine22



Joined: 15 Jul 2010
Posts: 1

PostPosted: Thu Jul 15, 2010 6:55 am    Post subject: Reply with quote

Sounds like you're getting through to the server - just need to make sure the request is well-formed. The wsdl contains a complete description of the schema. You need to build an associative array with the correct keys and the correct datatypes. It's case sensitive. Read the wsdl and make sure you have all the required elements in the request array. It's dull reading, but if you can follow along what I did in the FedEx module that should help. In particular, see the code I use to print out the request (function print_request_response), and use that to compare what you're sending with whatever example you have or with the wsdl.

<tr>.
_________________
CiNe
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    PEAR Forum Forum Index -> XML All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



PEAR Forum topic RSS feed 
Powered by phpBB © 2001, 2005 phpBB Group

Provided by Ministry of Web developement