views:

606

answers:

2

I need a php client base on nusoap lib. to get a asmx service response with haeder auth enabled:

This is the Request (using soapUI):

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:res="namespaceurl"> <soap:Header> <res:AuthHeader> <!--Optional:--> <res:UserName>myuser</res:UserName> <!--Optional:--> <res:Password>mypass</res:Password> </res:AuthHeader> </soap:Header> <soap:Body> <res:LoanStatus> <res:iAccountNbr>?</res:iAccountNbr> <res:iResortNbr>?</res:iResortNbr> <!--Optional:--> <res:strXRef></res:strXRef> </res:LoanStatus> </soap:Body> </soap:Envelope>

Here es the Response (soapUI):<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:res="namespaceurl"> <soap:Header> <res:AuthHeader> <!--Optional:--> <res:UserName>myuser</res:UserName> <!--Optional:--> <res:Password>mypass</res:Password> </res:AuthHeader> </soap:Header> <soap:Body> <res:LoanStatus> <res:iAccountNbr>?</res:iAccountNbr> <res:iResortNbr>?</res:iResortNbr> <!--Optional:--> <res:strXRef></res:strXRef> </res:LoanStatus> </soap:Body> </soap:Envelope>

A: 

If you really need to use NuSoap (I recommend using the PHP-native Soap extension!), have a look at the client samples in the Introduction to NuSoap:

<?php
// Pull in the NuSOAP code
require_once('nusoap.php');
// Create the client instance
$client = new soapclient('http://localhost/phphack/helloworld.php');
// Call the SOAP method
$result = $client->call('hello', array('name' => 'Scott'));
// Display the result
print_r($result);
?>

From there it should be straightforward.

Cassy
i have the same code with header and evething i need to get resonse HTTP/1.1 200 OKbut i dont see the xml response as an XML. i just get blank. and a pre-formated soap message
kraiosis
A: 

http://users.skynet.be/pascalbotte/rcx-ws-doc/nusoapadvanced.htm

hardik
excelent but get the same as i commented before to Cassy
kraiosis