Page 1 of 1

Nusoap and XML format

Posted: Mon Oct 15, 2012 9:09 am
by pluis3103
I'm having a problem putting together a XML file with the right format required by the webservice I want to use. I'm using the nusoap class to do it.
The error I'm getting:

Array

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

My request is:

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_Internaci ... eservation
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_Interna ... eservation">
<Reservation_Request>
<MessageType>N</MessageType>
<Group>01</Group>

...........................

</Reservation_Request>
</Create_Internacional_Reservation>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>


My code is:

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



When getting information about the request on the webservice's manual which I was advised to use, the only difference I can find is:

Where's:

Code (XML):

<Reservation_Request>
<MessageType>N</MessageType>
<Group>01</Group>
...........................
</Reservation_Request>



Should be:

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


How can I send (xmlns="http://www.xxxxxx.pt/Rentway_Internacio ... equest.xsd" ) inside Reservation_Request ?

Re: Nusoap and XML format

Posted: Thu Oct 25, 2012 6:28 am
by yacahuma
Dont use nusoap. Can you post the address of the service or is it private?

Try this:
http://code.google.com/p/wsdl2php/