简体   繁体   中英

How to send data to a Soap service?

The Soap service expects the following operation:

<wsdl:operation name="UploadFile">
<soap:operation soapAction="http://abcdotcom/IDocUpload/UploadFile" style="document"/>
<wsdl:input name="FileInfo">
<soap:header message="tns:FileInfo_Headers" part="Name" use="literal"/>
<soap:header message="tns:FileInfo_Headers" part="Length" use="literal"/>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="DownloadRequest">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>

I am using ksoap2 library . I am not able to figure out how to send data to the service? I am trying with

request.addProperty("FileInfo", "123"); 

but its just giving me null response. I am expecting an error at least. Please help.

Sample soap request in android (method:FetchUserDetails)

SoapObject request = new SoapObject("http://tempuri.org/", "FetchUserDetails");
request.addProperty("key", value);
        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.setOutputSoapObject(request);
        envelope.dotNet = true;
        try {
            HttpTransportSE androidHttpTransport = new HttpTransportSE(ServiceURL);
            androidHttpTransport.call("http://tempuri.org/FetchUserDetails", envelope);
            SoapObject response = (SoapObject) envelope.getResponse();
            int count = response.getPropertyCount();
            if (count > 0) {
             //handel the response
             SoapObject results = (SoapObject) response.getProperty(i);
           }
       }catch (Exception e) {
            Log.e("service", e.getMessage());
      }

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