NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Error : PHP and NuSOAP to access a .net webservice(.asmx)


Joined: 01 Sep 2009
Posts: 1
Reply with quote
Hi All,

I am getting error when trying to write a client script with nusoap to access a .asmx?WSDl file. Please help me if anyone know the solution.
Here I am giving my code as well as error that I getting.

Fault

Array
(
[faultcode] => soap:Server
[faultstring] => Server was unable to process request. ---> Conversion from type 'DBNull' to type 'Integer' is not valid.
[detail] =>
)

Request

POST /CatalystWebService/CatalystCRMWebservice.asmx HTTP/1.0
Host: devlon2.worldsecuresystems.com
User-Agent: NuSOAP/0.7.3 (1.114)
Content-Type: text/xml; charset=ISO-8859-1
SOAPAction: "http://tempuri_org/CatalystDeveloperService/CatalystCRMWebservice/OrderList_Retrieve"
Content-Length: 459

<?xml version="1.0" encoding="ISO-8859-1"?><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:ns8557="http://tempuri_org"><SOAP-ENV:Body><OrderList_Retrieve xmlns="http://tempuri_org/CatalystDeveloperService/CatalystCRMWebservice"/></SOAP-ENV:Body></SOAP-ENV:Envelope>

Response

HTTP/1.1 500 Internal Server Error
Cache-Control: private
Content-Length: 449
Content-Type: text/xml; charset=utf-8
Server: Microsoft-IIS/7.0
X-AspNet-Version: 2.0.50727
X-Powered-By: ASP.NET
Date: Tue, 01 Sep 2009 05:18:49 GMT

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>Server was unable to process request. ---&gt; Conversion from type 'DBNull' to type 'Integer' is not valid.</faultstring><detail /></soap:Fault></soap:Body></soap:Envelope>

Here is the code
require_once('lib/nusoap.php');
ini_set("soap.wsdl_cache_enabled", "0");
$proxyhost = isset($_POST['proxyhost']) ? $_POST['proxyhost'] : '';
$proxyport = isset($_POST['proxyport']) ? $_POST['proxyport'] : '';
$proxyusername = isset($_POST['proxyusername']) ? $_POST['proxyusername'] : '';
$proxypassword = isset($_POST['proxypassword']) ? $_POST['proxypassword'] : '';


$client = new nusoap_client("https://devlon2.worldsecuresystems.com/CatalystWebService/CatalystCRMWebservice.asmx?WSDL", 'wsdl',
$proxyhost, $proxyport, $proxyusername, $proxypassword);
$err = $client->getError();
if ($err) {
echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
}
$client->setUseCurl($useCURL);
$client->loadWSDL();
$params->username = 'satya@satya.com';
$params->Request->password = '4Kn54v6S';
$params->Request->siteId = '50124';

$client->setCredentials('satya@satya.com', '4Kn54v6S', '50124');
$result = $client->call('OrderList_Retrieve', array());
// Check for a fault
if ($client->fault) {
echo '<h2>Fault</h2><pre>';
print_r($result);
echo '</pre>';
} else {
// Check for errors
$err = $client->getError();
if ($err) {
// Display the error
echo '<h2>Error</h2><pre>' . $err . '</pre>';
} else {
// Display the result
echo '<h2>Result</h2><pre>';
print_r($result);
echo '</pre>';
}
}
echo '<h2>Request</h2><pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
echo '<h2>Response</h2><pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>';


Thanks & Regards,
Satya
View user's profileFind all posts by satya123Send private message


Joined: 16 Jul 2009
Posts: 15
Reply with quote
This seems to be a serverside error. DbNull is returned by a database and you have defined the returntype as int.

[WebMethod]
public int GetSomething() {

object ret = command.ExecuteScalar();
if(ret == null || ret == DbNull)
return 0;
return (int) ret;

}
View user's profileFind all posts by vvbSend private message
Error : PHP and NuSOAP to access a .net webservice(.asmx)
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