Jump to content

Nusoap- object reference not set to an instance of an object


Benmcfc

Recommended Posts

Hi all,

 

First off, apologies if this is in the wrong section of the forums.

 

I know there's a lot of results in Google for this but I've been unable to fix it.

 

try {
//vars
$userName = "someusername";  
$password = "somepw";

$request = array(
				 'UserName' => $userName,
				 'Password' => $password,
				 'Transaction' => array(
									 'ID' => '001',
									 'TransID' => '000001',
									 'Reference' => 'some_string_0101',
									 'SchemeCode' => 'abc',
									 'ClientReference' => 'some_string',
									 'Branch' => 'some_string',
									 'SchemeBrokerNo' => '42',
									 'SaveState' => 'Pending',
									 ),
				'SaveState' => 'Pending'
				 );

//soap
include 'lib/nusoap.php';
$namespace = "XMLTransferServiceProxy";
$soapACTION = "path/to/action/url"; 
    $URL = "path/to/xmltransferengine.asmx";

$client = new SoapClient($URL);
$client->useHTTPPersistentConnection();
    
    $SaveTransaction = $client -> call("SaveTransaction", $request, $namespace, $soapACTION);

} catch(SoapFault $fault){
echo "SoapFault: ".$fault;
}

print_r($client);

 

This is the soap request:

POST /services/xmltransferengine.asmx HTTP/1.1
Host: host
User-Agent: NuSOAP/0.7.3 (1.114)
Connection: close
Content-Type: text/xml; charset=UTF-8
SOAPAction: "path/to/soap/action/method"
Content-Length: 1089

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
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/">

<SOAP-ENV:Body><ns8502:SaveTransaction xmlns:ns8502="XMLTransferServiceProxy">
	<UserName xsi:type="xsd:string">someusername</UserName>
	<Password xsi:type="xsd:string">somepw</Password>
	<Transaction>
		<ID xsi:type="xsd:string">001</ID>
		<TransID xsi:type="xsd:string">000001</TransID>
		<Reference xsi:type="xsd:string">some_string_0101</Reference>
		<SchemeCode xsi:type="xsd:string">abc</SchemeCode>
		<ClientReference xsi:type="xsd:string">some_string</ClientReference>
		<Branch xsi:type="xsd:string">some_string</Branch>
		<SchemeBrokerNo xsi:type="xsd:string">42</SchemeBrokerNo>
		<SaveState xsi:type="xsd:string">Pending</SaveState>
	</Transaction>
	<SaveState xsi:type="xsd:string">Pending</SaveState>
	</ns8502:SaveTransaction>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

 

This is the soap response from the server:

 

HTTP/1.1 500 Internal Server Error.
Date: Fri, 03 Apr 2009 09:30:53 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 1.1.4322
Cache-Control: private
Content-Type: text/xml; charset=utf-8
Content-Length: 488
<?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. --> Object reference not set to an instance of an object.</faultstring>       
<detail />      
</soap:Fault>  
</soap:Body> 
</soap:Envelope>

 

As I said, I've visited a number of the results Google brought up for the error code, but have been unable to find the cause of the problem and fix it. Any help would be much appreciated.

Link to comment
Share on other sites

  • 3 weeks later...

The WSDL should be enough to generate a valid request. That's pretty much what it's for, to define a valid request.

 

Might be worth adding every field in the wsdl to your request, seeing if it works then if so, working back from there.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.