我正在尝试从soap webservice获得响应,但总是出错,请检查我是否正确调用了web service。以下是我的 webservice wsdl
<wsdl:definitions name="MobileeServiceWsd" targetNamespace="urn:MobileeServiceWsd"><wsdl:import location="http://vddp.dewa.gov.ae:50700/MobileeService/Config2/bindings?wsdl&style=document" namespace="urn:MobileeServiceWsd/Config2/document"/><wsdl:service name="MobileeService"><wsdl:port name="Config2Port_Document" binding="bns0:Config2Binding"><soap:address location="http://vddp.dewa.gov.ae:50700/MobileeService/Config2?style=document"/></wsdl:port></wsdl:service></wsdl:definitions>
以下是我的代码。
private static final String METHOD_NAME = "getOutstandingBalance";
private static final String SOAP_ACTION = "MobileeService";
private static final String NAMESPACE = "MobileeServiceWsd/Config2/document";
private static final String URL = "http://vddp.dewa.gov.ae:50700/MobileeService/Config2/bindings?wsdl&style=document";
public SoapObject testMethod(String METHOD_NAME, String SOAP_ACTION, String NAMESPACE, String URL) throws IOException, XmlPullParserException
{
//List<HeaderProperty> headers = new ArrayList<HeaderProperty>();
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true; //for .net services
envelope.bodyOut = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:urn=\"urn:MobileeServiceVi\">"+
"<soapenv:Header/>"+
"<soapenv:Body>"+
"<urn:getOutstandingBalance>"+
"<urn:contractaccount>000001000104</urn:contractaccount>"+
"<urn:mobileosver>ios 4.3</urn:mobileosver>"+
"<urn:appver>3.3</urn:appver>"+
"<urn:appidentifier>343534</urn:appidentifier>"+
"</urn:getOutstandingBalance>"+
"</soapenv:Body>"+
"</soapenv:Envelope>";
envelope.setOutputSoapObject(request);
HttpTransportSE httpTransport = new HttpTransportSE(URL);
//httpTransport.call(SOAP_ACTION, envelope, headers);
httpTransport.call(SOAP_ACTION, envelope);
return (SoapObject) envelope.getResponse();
}