我有这样的错误:
01-20 10:45:20.910: W/System.err(24727): SoapFault - faultcode: 's:InvalidUser' faultstring: 'InvalidUser' faultactor: 'null' detail: org.kxml2.kdom.Node@4053e568
01-20 10:45:20.910: W/System.err(24727): at org.ksoap2.serialization.SoapSerializationEnvelope.parseBody(SoapSerializationEnvelope.java:116)
01-20 10:45:20.910: W/System.err(24727): at org.ksoap2.SoapEnvelope.parse(SoapEnvelope.java:137)
01-20 10:45:20.910: W/System.err(24727): at org.ksoap2.transport.Transport.parseResponse(Transport.java:63)
01-20 10:45:20.910: W/System.err(24727): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:100)
我想从Web服务获取数据,但我似乎无法访问它。这是代码:
import android.app.Activity;
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapPrimitive;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
import android.os.Bundle;
import android.util.Log;
public class SoapActivity extends Activity {
private static final String NAMESPACE = "http://titoms.com/services/1.0";
private static final String METHOD_NAME = "SelectAll";
private static final String SOAP_ACTION = "http://titoms.com/services/1.0/IBranchComponent/SelectAll";
private static final String URL = "http://cbqa.basecamptech.ph/titoms/BranchComponent.svc?wsdl";
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
try{
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.debug = true;
androidHttpTransport.call(SOAP_ACTION,envelope);
SoapPrimitive so = (SoapPrimitive)envelope.getResponse();
Log.i("Soap", "Response: "+so.toString());
} catch (Exception E) {
E.printStackTrace();
}
}
}
任何人都可以帮助我吗?我非常需要访问网络服务
答案 0 :(得分:0)
我认为你应该改变你的SOAP ACTION
因为SOAP ACTION=NAMESPACE+METHOD NAME;
你的NAMESPACE = "http://titoms.com/services/1.0";
和METHOD_NAME = "SelectAll";
所以你的SOAP ACTION必须是SOAP_ACTION = "http://titoms.com/services/1.0/SelectAll";
我希望这会帮助你