Sending SOAP Request

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sam.fortune
Forum Newbie
Posts: 2
Joined: Wed Nov 17, 2010 10:56 am

Sending SOAP Request

Post by sam.fortune »

We are trying to develop a Flight Reservation System. It communicates with a remote server using non-wsdl mode.
The remote server requires a couple of ID's in the header.

But whenever we try to connect to this server using the PHP Soap Client, it throws an error showing :-

Fatal error: Uncaught SoapFault exception: [SOAP-ENV:Server.Exception:] Error occurred while trying to invoke requested method. in C:\xampp\htdocs\soap\two.php:41 Stack trace: #0 C:\xampp\htdocs\soap\two.php(41): SoapClient->__soapCall('getAvailability', Array) #1 {main} thrown in C:\xampp\htdocs\soap\two.php on line 41


Please let me know your thoughts on this and some inputs on executing SOAP requests.

Thanks in Adv.


Sam
sam.fortune
Forum Newbie
Posts: 2
Joined: Wed Nov 17, 2010 10:56 am

Re: Sending SOAP Request

Post by sam.fortune »

Status Update:-

Now I have connection the tested ok. In fact the connectivity or response issue I had earlier was because the 'request' xml generated thru my nusoap client (using php) was not in the exact format required by the remote server. I debugged the issue by pasting the samle xml to the remote server bypassing the soap xml generator and it worked!

So now, I need help on creating the proper structure of the nusoap generated xml.

THE FOLLOWING IS THE DESIRED STRUCTURE:-

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:xxXXXx" xmlns:ns2="http://xml.apache.org/xml-soap" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <SOAP-ENV:Header>
    <ClientId>XXXX-XXXXX</ClientId>
    <CarrierAccount>XX</CarrierAccount>
  </SOAP-ENV:Header>
  <SOAP-ENV:Body>
    <ns1:operation SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
      <input xsi:type="ns1:GetAvailRequest">
        <CAccount xsi:type="xsd:string">0S</CAccount>
        <AQueries xsi:type="ns2:Vector">
          <item xsi:type="ns1:AvailabilityQuery">
            <BTime xsi:type="xsd:string">0000</BTime>
            <DDate xsi:type="xsd:dateTime">2010-10-27T12:00:00Z</DDate>
            <Origin xsi:type="xsd:string">DEL</Origin>
            <Dest xsi:type="xsd:string">BLR</Dest>
            <NumberPass xsi:type="xsd:int">1</NumberPass>
            <Options xsi:type="ns1:FareOption">
              <CCode xsi:type="xsd:string">INR</CCode>
              <BCurrency xsi:type="xsd:string">INR</BCurrency>
            </Options>
          </item>
        </AQueries>
      </input>
    </ns1:operation>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Since there are some complex tags Iam not able to reproduce the exact structure.


So what I basically want is the manner in which the params should be passed into the nusoap client so as to generate complex multiple noded xml requests.

Please help.
Post Reply