我需要在android中调用基于SOAP的Web服务。我使用以下代码。但它没有调用,因为它以json格式给出响应。那我该怎么办?
有任何帮助吗?
public void callsoapservice() {
final String METHOD_NAME = "GetLoginString";
final String SOAP_ACTION = "http://tempuri.org/GetLoginString";
final String NAMESPACE = " http://tempuri.org/";
final String URL = "http://209.139.209.216/STMobileWS/MobileWebservice/STOlogin.asmx?WSDL";
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty("sCompanyCode", "659");
request.addProperty("sUserName", "Chad12345");
request.addProperty("sPassword", "chad");
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope( SoapEnvelope.VER12 );
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
try {
androidHttpTransport.call(SOAP_ACTION, envelope);
// SoapObject resultsRequestSOAP = (SoapObject) envelope.bodyIn;
System.out.println("Received :" + envelope.bodyIn.toString());
} catch (Exception e) {
e.printStackTrace();
System.out.println("EEEEEEEEE " + e.toString());
}
}