PHP,SOAP,.NET - 未将对象引用设置为对象的实例

时间:2011-11-10 20:22:07

标签: php asp.net .net xml soap

我一直在尝试建立一个基于PHP的SOAP客户端来连接另一个.NET SOAP服务器,但没有任何运气。 :/我已经尝试过任何我能想到的东西以及谷歌叔叔可以找到的东西--NuSOAP,Zend Framework SOAP和PHP的内部SOAP。所有3都给了我错误,但PHP的内部SOAP似乎最简单和有前途。好吧,所以我又投入了2天的PHP内部SOAP客户端,最后我遇到了这个错误:

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}

我的请求XML如下所示:

<?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>

任何想法如何解决这个问题?

1 个答案:

答案 0 :(得分:2)

错误来自.NET端。尝试使用null对象时抛出错误。