gargantuan
gargantuan

Reputation: 8954

Calling a SOAP method with PHP for a specific service

Sorry to have to do this, but I'm getting no love from the people who run this particular webservice. I've never used SOAP before.

Here's the method I'm trying to call

And here's the code I'm thinking should work

    public function soapTest(){

            echo "start <br />";
            use_soap_error_handler(true);
            $client = new SoapClient("https://cwi.rezexchange.com:9991/?wsdl");

                // here's the problem. What goes in the parenthesis?
            $result = $client->CwiRateDetails(????);

            echo($result);
            echo "<br /> end";

        }

Now I'm guessing this tells me what the parenthesis should contain.

POST /Service.asmx HTTP/1.1
Host: cwi.rezexchange.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://hotelconcepts.com/CwiRateDetails"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <CwiRateDetails xmlns="http://hotelconcepts.com/">
      <PropertyCode>string</PropertyCode>
      <DateFrom>dateTime</DateFrom>
      <DateTo>dateTime</DateTo>
      <RatePlan>string</RatePlan>
      <RoomType>string</RoomType>
      <PromotionalRates>boolean</PromotionalRates>
    </CwiRateDetails>
  </soap:Body>
</soap:Envelope>

My guess is that something like

$result = $client->CwiRateDetails($PCode, $DateFrom, $DateTo, $RatePlan, $RoomType, false);

Should work. But I don't know what the date format is, or what room types are or how to reference a rate plan.

Now. Before I go ape shit bannana bonkers over email with them, am I wrong in thinking there's a load more information they need to give me? Or is there some sort of SOAP trickery I can use to get that information from somewhere?

Upvotes: 2

Views: 5067

Answers (4)

Stefan Gehrig
Stefan Gehrig

Reputation: 83692

Try

$result = $client->CwiRateDetails(array(
    'PropertyCode'     => ...,
    'DateFrom'         => ...,
    'DateTo'           => ...,
    'RatePlan'         => ...,
    'RoomType'         => ...,
    'PromotionalRates' => ...,
));

You'll have to serialize your date-time-values in DateFrom and DateTo and the boolean value in PromotionalRates according to the XML Schema specifications:

  • boolean: true = 'true' or 1 and false = 'false' or 0
  • dateTime: YYYY-MM-DDThh:mm:ssZ for UTC or YYYY-MM-DDThh:mm:ss(+/-)hh:mm for local-time including timezone information; timezone information is optional

Upvotes: 5

ColinYounger
ColinYounger

Reputation: 6865

You are not wrong, IMO. There must be other SOAP calls to derive the information you need. Have you looked at List Rate Types? What about the list of methods here?

Upvotes: 0

Jake
Jake

Reputation: 3973

the date format is actually dateTime (which is a SOAP format type). I'm sure there is an example on the internet that converts a time() (or whatever) to a SOAP::dateTime field.

the information you need to connect is all there.. maybe you should read up on webservices first?

Upvotes: 1

Alekc
Alekc

Reputation: 4770

Usualy it's associative array where keys are fields which you find in description, i.e. PropertyCode,DateFrom,DateTo etc for CwiRateDetails

so it would be something like

$client->CwiRateDetails(array("PropertyCode"=>"sdsd","DateFrom"=>"",......))

You can see details of every methods on this page: https://cwi.rezexchange.com:9991/ Just click on procedure's name and you will see it's parameters and it's responce.

Upvotes: 0

Related Questions