dongtu1958 2012-07-26 15:13
浏览 58

Zend Soap Client使用有效的XML last响应返回null

I am having an issue when trying to access my own PHP Soap Service with PHP. I am using Zend_Soap for both the client and server.

Basically, the result I get from the client is null. However if I look at the last response, it contains the expected, correct XML. So the client is failing to convert the xml to a php object (in my test case, a simple int) for use.

my wsdl looks like this

<definitions name="SOAP_Model_soaphandler" targetNamespace="http://website.com/appldev/applications/public/SOAP/index/soap">
    <types>
        <xsd:schema targetNamespace="http://website.com/appldev/applications/public/SOAP/index/soap"/>
    </types>
    <portType name="SOAP_Model_soaphandlerPort">
        <operation name="test">
            <documentation>Returns list of all products in database</documentation>
            <input message="tns:testIn"/>
            <output message="tns:testOut"/>
        </operation>
        <operation name="test2">
            <documentation>Adds new product to database</documentation>
            <input message="tns:test2In"/>
            <output message="tns:test2Out"/>
        </operation>
    </portType>
    <binding name="SOAP_Model_soaphandlerBinding" type="tns:SOAP_Model_soaphandlerPort">
        <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
        <operation name="test">
            <soap:operation soapAction="http://website.com/appldev/applications/public/SOAP/index/soap#test"/>
            <input>
                <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://website.com/appldev/applications/public/SOAP/index/soap"/>
            </input>
            <output>
                <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://website.com/appldev/applications/public/SOAP/index/soap"/>
            </output>
        </operation>
        <operation name="test2">
            <soap:operation soapAction="http://website.com/appldev/applications/public/SOAP/index/soap#test2"/>
            <input>
                <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://website.com/appldev/applications/public/SOAP/index/soap"/>
            </input>
            <output>
                <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://website.com/appldev/applications/public/SOAP/index/soap"/>
            </output>
        </operation>
    </binding>
    <service name="SOAP_Model_soaphandlerService">
        <port name="SOAP_Model_soaphandlerPort" binding="tns:SOAP_Model_soaphandlerBinding">
            <soap:address location="http://website.com/appldev/applications/public/SOAP/index/soap"/>
        </port>
    </service>
    <message name="testIn"/>
    <message name="testOut">
        <part name="return" type="xsd:int"/>
    </message>
    <message name="test2In">
        <part name="id" type="xsd:int"/>
    </message>
    <message name="test2Out">
        <part name="return" type="soap-enc:Array"/>
    </message>
</definitions>

and my response looks like this

<env:envelope xmlns:enc="http://www.w3.org/2003/05/soap-encoding" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://website.com/appldev/applications/public/SOAP/index/soap" xmlns:env="http://www.w3.org/2003/05/soap-envelope">
    <env:body xmlns:rpc="http://www.w3.org/2003/05/soap-rpc">
        <ns1:testresponse env:encodingstyle="http://www.w3.org/2003/05/soap-encoding">
            <rpc:result>return</rpc:result>
            <return xsi:type="xsd:int">7</return>
        </ns1:testresponse>
    </env:body>
</env:envelope>

but

$result=$client->test(); 
var_dump($result);

outputs NULL.

Any ideas? It looks like it should be working to me, but I am not an expert in how the soap client works. Perhaps there is an issue with the namespace or something? I really dont know. It seems like it should be working fine. For reference, I followed this guide to get things up and running:

http://www.ibm.com/developerworks/webservices/library/x-zsoap/index.html

I suppose I could always just manually get the response from the xml, but I am hoping to figure out why the client is not doing so for me.

  • 写回答

2条回答 默认 最新

  • doucuoyan0426 2012-12-02 17:00
    关注

    You should try to remove soap temp file: /tmp/wsdl*, then restart the webserver. Hope this help.

    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog