NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Error : PHP and NuSOAP to consume a .net webservice


Joined: 05 Feb 2009
Posts: 1
Reply with quote
Hi All,

Greetings

I am new to XML and Web Services. I want to consume a .NET webservice using php and SOAP. It is a CV parsing system where the CV has to be sent in a base64 format and the parsed response is supposed to be sent back by the system.

I get an error message saying:

"HTTP/1.1 100 Continue HTTP/1.1 200 OK
Date: Wed, 04 Feb 2009 07:19:11 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET X-AspNet-Version: 2.0.50727
Cache-Control: private,
max-age=0 Content-Type: text/xml;
charset=utf-8
Content-Length: 400
Incorrect password. Message changed - 03/02/2009"

Could anyone please tell me what could be wrong ?... Any help would get me out of a hole..

Please find the code I have used below :

include_once("lib/nusoap.php");

$soapClient = new nusoap_client('http://mywebserver/webservice.asmx?WSDL', 'wsdl');

$Password = 'password';

$file = "test.doc";

$contents = base64_encode(file_get_contents($file));

$header = '
<ServiceAuthHeader xmlns="http://mywebserver">
<Password>' . $Password . '</Password>
</ServiceAuthHeader>';

$soapClient->setHeaders($header);

$getAuth = array('DocArray' => $contents, 'CandidateID' => '234528345', 'FileName' => 'test.doc', 'Password' => 'password');

$err = $soapClient->getError();
if ($err) {
echo '<p><b>Constructor error: ' . $err . '</b></p>';
}
else{
$result = $soapClient->call('SoapAction', array('parameters' => $getAuth), 'http://mywebserver/', 'http://mywebserver/SoapAction', false, true);
if ($client->fault) {
echo '<p><b>Fault: ';
print_r($result);
echo '</b></p>';
echo '<p><b>Request: <br>';
echo htmlspecialchars($soapClient->request, ENT_QUOTES) . '</b></p>';
echo '<p><b>Response: <br>';
echo htmlspecialchars($soapClient->response, ENT_QUOTES) . '</b></p>';
echo '<p><b>Debug: <br>';
echo htmlspecialchars($soapClient->debug_str, ENT_QUOTES) . '</b></p>';
} else {
$err = $soapClient->getError();
if ($err) {
echo '<p><b>Error: ' . $err . '</b></p>';
echo '<p><b>Request: <br>';
echo htmlspecialchars($soapClient->request, ENT_QUOTES) . '</b></p>';
echo '<p><b>Response: <br>';
echo htmlspecialchars($soapClient->response, ENT_QUOTES) . '</b></p>';
echo '<p><b>Debug: <br>';
echo htmlspecialchars($soapClient->debug_str, ENT_QUOTES) . '</b></p>';
} else {
print_r($result);
}
}
}

Thanks in Advance
Regards
Abdul Aziz
View user's profileFind all posts by azy777Send private message
Error : PHP and NuSOAP to consume a .net webservice
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic