1

我在将 XML 文件与我要使用的 web 服务所需的正确格式放在一起时遇到问题。我正在使用 nusoap 类来做到这一点。我得到的错误:

Array
(
[Reservation_Data] => Array
(
[Reservation_Value] => 0
[Status] => ERROR_Create_Internacional_Reservation: Object reference not set to an instance of an object. - 0
)
)


POST /Rentway_Internacional_Reservations_WS/Create_Reservation.asmx HTTP/1.0
Host: www.xxxxxxx.pt
User-Agent: NuSOAP/0.9.5 (1.123)
Content-Type: text/xml; charset=UTF-8
POST /Rentway_Internacional_Reservations_WS/Create_Reservation.asmx HTTP/1.0
Host: www.xxxxxxx.pt
User-Agent: NuSOAP/0.9.5 (1.123)
Content-Type: text/xml; charset=UTF-8
SOAPAction: http://www.xxxxxxx.pt/Rentway_Internacional_Reservations_WS/Create_Internacional_Reservation/Create_Internacional_Reservation
Content-Length: 714
<?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/" xmlns:ns3785="http://tempuri.org">
<SOAP-ENV:Body><Create_Internacional_Reservation xmlns="http://www.xxxxxxxxx.pt/Rentway_Internacional_Reservations_WS/Create_Internacional_Reservation">
<Reservation_Request>
<MessageType>N</MessageType>
<Group>01</Group>
..........................
</Reservation_Request>
</Create_Internacional_Reservation>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

我的代码是:

require_once('nu-soap/nusoap.php');
require_once('config.php');
$client = new     nusoap_client('http://www.xxxxxxxxxx.pt/Rentway_Internacional_Reservations_WS/Create_Reservation.asmx?wsdl', true);
$param = array('Username'=>'xxx','Password'=>'xxx','MessageType'=>'N','Group'=>'01');
$result = $client->call('Create_Internacional_Reservation', array('Reservation_Request' => $param));

在我被建议使用的网络服务手册上获取有关请求的信息时,我能找到的唯一区别是:

哪里:

Code (XML):
<Reservation_Request>
<MessageType>N</MessageType>
<Group>01</Group>
...........................
</Reservation_Request>

应该:

<Reservation_Request xmlns="http://www.xxxxxx.pt/Rentway_Internacional_Reservations_WS/Reservation_Request.xsd" >
<MessageType>N</MessageType>
<Group>01</Group>
...........................
</Reservation_Request>

如何在 Reservation_Request 中发送 (xmlns="http://www.xxxxxx.pt/Rentway_Internacional_Reservations_WS/Reservation_Request.xsd" )?

4

0 回答 0