I'm curremtly working on a project "Flight search" with SOAP and PHP. I'm new to this SOAP Technology.

I've to send the XML over POST Request and get the response:

<Request>
<Origin>BOM</Origin>
<Destination>DEL</Destination>
<DepartDate>2013-05-20</DepartDate>
<ReturnDate>2013-05-21</ReturnDate>
<AdultPax>1</AdultPax>
<ChildPax>0</ChildPax>
<InfantPax>0</InfantPax>
<Currency>INR</Currency>
<Clientid>*********</Clientid>
<Clientpassword>**************************</Clientpassword>
<Clienttype>ArzooFWS1.1</Clienttype>
<Preferredclass>E</Preferredclass>
<mode>ONE</mode>
<PreferredAirline>AI</PreferredAirline>
</Request>

to the URL:

http://xx.xxx.xx.xxx/ArzooWS/services/DOMFlightAvailability?wsdl

Can any one please help ? I'm struggling with this. Thanks in advance.

EDIT: I'm trying the following but its getting error:

$dom_document = simplexml_load_file("availability.xml");

    try{
        $soap_client =
            new soapclient("http://xx.xxx.xx.xxx/ArzooWS/services/DOMFlightAvailability?wsdl");
        $availability = $soap_client->getAvailability($dom_document);
        echo $availability->getAvailabilityResponse;
    }catch(SoapFault $exception){
        echo $exception->getMessage();
    }

The error i'm getting:

Notice: Trying to get property of non-object in
C:\xampp\htdocs\Flight\availability.php on line 9

Member Avatar for diafol

ANy chance that you could enter the url of the wsdl? We could then try to replicate the issue.

Is this a valid method call?

$soap_client->getAvailability($dom_document);

Don't you have to encode and escape the XML before sending?

Member Avatar for diafol

It's SoapClient, NOT soapclient

I thought classnames were case-insensitive?

commented: Indeed. +14

Oh right. Ugh... bad habit then anyway, because everything else is.

Member Avatar for diafol

I agree. That another mess with php :( CSensitivity for some things, but not others. You'd think they'd get their act together by v5.4 :) Well I suppose they break the net with that one though.

Tried with SoapClient instead of soapclient but no change on the error..

I used __getFunctions for getting the function name and it returned array(1) { [0]=> string(35) "string getAvailability(string $in0)" }

Member Avatar for diafol

OK, so you know that you have to supply a string $in0. In what format is the string expected?

Check the actual url:

http://xx.xxx.xx.xxx/ArzooWS/services/DOMFlightAvailability?wsdl

And you should get all the relevant info as to how to make a valid request.
Search the tree for $in0 if present.
Passing the parameter, you may need to place it in an array though.

Thanks folks, I Got it...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.