...

View Full Version : Trouble consuming a .NET web service with nuSOAP



srshaffer
04-25-2006, 06:59 PM
I am trying to consume a web service and am faced with this fault:

soapclient: got wsdl error: phpType is struct, but value is not an array: see debug output for details


My script is below;

<?php
require_once('nusoap.php') ;
$client = new soapclient('http://www.regonline.com/webservices/RetrieveSingleRegistration.asmx?wsdl' , true ) ;
$msg = '
<RetrieveSingleRegistration xmlns="http://www.regonline.com/webservices/">
<customerUserName>pk4u</customerUserName>
<customerPassword>x9ja9j</customerPassword>
<eventID>344</eventID>
<registrationID>3795103</registrationID>
</RetrieveSingleRegistration>
';

$ns = "http://www.regonline.com/webservices/";

$soapaction = "http://www.regonline.com/webservices/RetrieveSingleRegistration";

$response = $client->call( "RetrieveSingleRegistration" , array($msg), $ns, $soapaction ) ;

echo '<h2>Request</h2>';
echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
echo '<h2>Response</h2>';
echo '<pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
echo '<h2>Debug</h2>';
echo '<pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>';

if ( isset( $fault ) ) {
print "Error: ". $fault;
}else{
print "no errors";
}
echo "<br /> <br />Response: " . $response ;
unset($client);
?>

Does anyone have a clue what I'm doing wrong?

missing-score
04-26-2006, 03:25 AM
It sounds like a parsing problem with the WSDL file itself. Have you considered trying PHP's built in SoapClient (http://www.php.net/soap/)? (although you will need PHP 5)

srshaffer
04-26-2006, 05:48 PM
I have tried it that way, at least I think so and it appears the values passed are read as NULL on the .NET service

srshaffer
05-03-2006, 12:55 PM
The web service apparently gets and successfully reads the passed values, but errors on the response attempt with this message:

soapclient: got wsdl error: phpType is struct, but value is not an array

NancyJ
05-03-2006, 01:21 PM
I had problems with nuSoap and it wanting arrays instead of xml. So I use send() instead and just send the full xml data
eg



$msg = '
?xml version="1.0" encoding="ISO-8859-1"?>
<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>
<RetrieveSingleRegistration xmlns="http://www.regonline.com/webservices/">
<customerUserName>pk4u</customerUserName>
<customerPassword>x9ja9j</customerPassword>
<eventID>344</eventID>
<registrationID>3795103</registrationID>
</RetrieveSingleRegistration>
</soap:Body>
</soap:Envelope>
';

$soapclient = new nuSoapclient('http://www.regonline.com/webservices/RetrieveSingleRegistration.asmx');

$soapclient->send($msg, "http://www.regonline.com/webservices/RetrieveSingleRegistration");
$response = $soapclient->response

raf
05-03-2006, 03:00 PM
i also fear you wount be able to fully use the nusoap, and will need to do some of the envelop composing by hand.

check out http://users.skynet.be/pascalbotte/rcx-ws-doc/nusoapadvanced.htm for an example



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum