简体   繁体   中英

PHP, SOAP, .NET - Object reference not set to an instance of an object

I have been trying to set up a PHP based SOAP client to connect with another .NET SOAP server, but without any luck. :/ I've tried just about anything I could think of and what uncle Google could find - NuSOAP, Zend Framework SOAP and PHP's internal SOAP. All 3 gave me errors, but PHP's internal SOAP seemed most simple and promising. Well, so I invested another 2 days into PHP's internal SOAP client and at the end I landed with this error:

 SoapFault exception: [soap:Server] System.Web.Services.Protocols.SoapException: Server was unable to process request.  ---> System.NullReferenceException: Object reference not set to an instance of an object.  
at p_client.p_data.read(PgSqlDataReader e) in c:\\inetpub\\wwwroot\\p_client\\p_client.asmx.cs:line 642
at p_client.p_client.p_login(Int32 pid, String username, String password) in c:\\inetpub\\wwwroot\\p_client\\p_client.asmx.cs:line 172
--- End of inner exception stack trace --- in /home/techouse/public_html/beta/test/new2_soap_client.php:76
Stack trace:
#0 /home/techouse/public_html/beta/test/new2_soap_client.php(76): SoapClient->__soapCall('p_login', Array)
#1 {main}

My request XML looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.dhimahi.com/">
    <SOAP-ENV:Body>
        <ns1:p_login>
            <ns1:pid>1234</ns1:pid>
            <ns1:username>username1234</ns1:username>
            <ns1:password>password1234</ns1:password>
        </ns1:p_login>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Any ideas how to fix this?

The error is from the .NET side. The error is thrown when trying to use an object that is null.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM