开发者

Php call Soap function and passing data

开发者 https://www.devze.com 2023-04-07 03:00 出处:网络
i\'m trying launching a simple Soap call in my application. The Soap Web Serviceis located: \'http://www.asd.com?wsdl\'

i'm trying launching a simple Soap call in my application.

The Soap Web Service is located: 'http://www.asd.com?wsdl'

开发者_开发知识库

The Soap Web Service expose method : upload() , to the Ws upload() method i can pass a string data: 'arg0'

so my code looks like as shown:

        $wsdl = "http://www.asd.com?wsdl";
        $ws = new SoapClient($wsdl);
        $vem = $ws->__soapCall('upload', array('arg0'=>'sgfsg'));

Seems that WS method receives arg0 = NULL, is this PHP code ok?

the WS wsdl

      <wsdl:definitions name="aWS" targetNamespace="http://validator.aWS.it/">
<wsdl:import location="http://asd.com/aWS?wsdl=aWSDL.wsdl" namespace="http://interfaces.aWS.it/">
    </wsdl:import><wsdl:binding name="aWSSoapBinding" type="ns1:...">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="Upload">
<soap:operation soapAction="" style="document"/>
<wsdl:input name="Upload">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="UploadResponse"><soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="ping">
<soap:operation soapAction="" style="document"/>
<wsdl:input name="ping">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="pingResponse">
<soap:body use="literal"/>
</wsdl:output>
<wsdl:fault name="NonBlockingExecption">
<soap:fault name="NonBlockingExecption" use="literal"/>
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="aWS">
<wsdl:port binding="tns:aWSSoapBinding" name="aWSPort">
<soap:address location="http://asd.com/aWS"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

the wsdl types

    <wsdl:definitions name="aWS" targetNamespace="http://interfaces.aWS.it/">
<wsdl:types>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://interfaces.aWS.it/">
<xs:element name="Upload" type="tns:Upload"/>
<xs:element name="UploadResponse" type="tns:UploadResponse"/>
<xs:element name="ping" type="tns:ping"/>
<xs:element name="pingResponse" type="tns:pingResponse"/>
<xs:complexType name="Upload">
<xs:sequence>
<xs:element minOccurs="0" name="arg0" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="UploadResponse">
<xs:sequence/>
</xs:complexType>
<xs:complexType name="ping">
<xs:sequence/>
</xs:complexType>
<xs:complexType name="pingResponse">
<xs:sequence>
<xs:element name="return" type="xs:int"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="NonBlockingExecption">
<xs:sequence/>
</xs:complexType>
<xs:element name="NonBlockingExecption" type="tns:NonBlockingExecption"/>
</xs:schema>
</wsdl:types>
<wsdl:message name="NonBlockingExecption">
<wsdl:part element="ns1:NonBlockingExecption" name="NonBlockingExecption">
</wsdl:part>
</wsdl:message>
<wsdl:message name="Upload">
<wsdl:part element="ns1:Upload" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="pingResponse">
<wsdl:part element="ns1:pingResponse" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="ping">
<wsdl:part element="ns1:ping" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="UploadResponse">
<wsdl:part element="ns1:UploadResponse" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="aWS">
<wsdl:operation name="Upload">
<wsdl:input message="ns1:Upload" name="Upload">
</wsdl:input>
<wsdl:output message="ns1:UploadResponse" name="UploadResponse">
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="ping">
<wsdl:input message="ns1:ping" name="ping">
</wsdl:input>
<wsdl:output message="ns1:pingResponse" name="pingResponse">
</wsdl:output>
<wsdl:fault message="ns1:NonBlockingExecption" name="NonBlockingExecption">
</wsdl:fault>
</wsdl:operation>
</wsdl:portType>
</wsdl:definitions>


Try to change the soap method invocation (third instruction) with:

$vem = $ws->upload("sgfsg");

Usually in WSDL mode soap function are called as methods of the Soap Client object instead of using soapCall.

I tried to open http://www.asd.com?wsdl but i can't see any wsdl code.

If the operation upload only needs a string as parameter you can pass it without building an array.

0

精彩评论

暂无评论...
验证码 换一张
取 消