肥皂体总是空白的

时间:2017-03-28 08:41:17

标签: php soap

我正在尝试使用soap集成Web服务。

这是xml文件:

http://uatapiout.islandhopper.in/Service1.svc?wsdl

这是我正在尝试的代码:

<?php

$wsdl = 'http://uatapiout.islandhopper.in/Service1.svc?wsdl';

$xml_array["RequestType"] = "AvailabilityRQ";
$xml_array["Login"] = array("UserName"=>"test","Password"=>"test","Version"=>"3.0");

$xml_array["CheckAvailabilityCriteria"] = array("CheckIn" => "07/05/2017","CheckOut"=> "07/11/2017","CountryID"=> "MAU","CityID" => "MAU","Currency" => "USD","Adult" => "2","Rooms"=>array("Room"=>array("Adult"=>"2","Child"=>"0")));

$trace = true;
$exceptions = true;

try
{

    $client = new SoapClient($wsdl, array('trace' => 1)); 

    $response = $client->HotelSearch($xml_array );

    print_r($client->__getLastRequest());
    print_r($client->__getLastResponse());

}

catch (Exception $e)
{
    echo "Error!";
    echo $e ->getMessage ();
    echo 'Last response: '. $client->__getLastResponse();
}

$ client-&gt; __ getLastRequest()总是给我空白的身体:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://tempuri.org/"><SOAP-ENV:Body><ns1:HotelSearch/></SOAP-ENV:Body></SOAP-ENV:Envelope>

所以,问题是为什么这个请求有空白。

请建议我,我做错了什么?

提前致谢。

编辑:

这是示例xml请求:

<XMLRequest>
<RequestType>AvailabilityRQ</RequestType>
<Login>
    <UserName>UserName</UserName>
    <Password>Password</Password>
    <Version>3.0</Version>
</Login>
<CheckAvailabilityCriteria>
    <CheckIn>07/05/2016</CheckIn>
    <CheckOut>07/11/2016</CheckOut>
    <CountryID>MAU</CountryID>
    <CityID>MAU</CityID>
    <Currency>USD</Currency>
    <HotelCode></HotelCode>
    <HotelName></HotelName>
    <ClientNationality></ClientNationality>
    <Rooms>
        <Room>
           <Adult>2</Adult>
           <Child>2</Child>
           <ChildAges>
                <ChildAge>7</ChildAge>
                <ChildAge>14</ChildAge>
           </ChildAges>
        </Room>
        <Room>
           <Adult>2</Adult>
           <Child>0</Child>
       </Room>
    </Rooms>
</CheckAvailabilityCriteria>
</XMLRequest>

1 个答案:

答案 0 :(得分:0)

谢谢大家的支持。

现在,我正在使用nusaop lib。

这是代码:

$model = new Dish();
$model->load(Yii::$app->request->post());
var_dump($model->ingredients);

希望,这会有所帮助:)