2012-01-20 12 views
0

私はこの種のエラーを持っている:アンドロイド:アクセスKSOAP

01-20 10:45:20.910: W/System.err(24727): SoapFault - faultcode: 's:InvalidUser' faultstring: 'InvalidUser' faultactor: 'null' detail: [email protected] 

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

iはSOAP ACTION=NAMESPACE+METHOD NAME; があなたのNAMESPACE = "http://titoms.com/services/1.0";

METHOD_NAME = "SelectAll";だからあなたのSOAPアクションが、私はこれが役立つだろう願っていSOAP_ACTION = "http://titoms.com/services/1.0/SelectAll";

でなければなりません そのため、uはウルSOAPアクションを変更すべきだと思うのWebサービスにアクセスする必要があります外出