【问题标题】:SoapFault - faultcode: 'SOAP-ENV: Exception in androidSoapFault - 故障代码:'SOAP-ENV:android 中的异常
【发布时间】:2013-10-03 18:02:56
【问题描述】:

我知道 SO 中已经存在相同类型的问题,但我没有找到解决方案。我得到了这个

SoapFault - faultcode: 'SOAP-ENV:Server' faultstring: 'Procedure 'login' not present' faultactor: 'null' detail: null

尝试从我的本地服务器获取响应时出现异常..

我的 wsdl 代码应该是这样的:

<definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"   
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xs="http://www.w3.org/2001/XMLSchema" 
xmlns:xs0="http://www.processmaker.com"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"   
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" 
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" 
xmlns="http://schemas.xmlsoap.org/wsdl/" 
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" 
targetNamespace="http://www.processmaker.com">
<types>
<xs:schema elementFormDefault="qualified"     
targetNamespace="http://www.processmaker.com">
<xs:element name="login">
<xs:complexType>
<xs:sequence>
<xs:element name="userid" type="xs:string"/>
<xs:element name="password" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</definitions>

我的课程文件是:

public class MainActivity extends Activity {
String str = null;

SoapObject request;
TextView tv;

@SuppressLint("NewApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);

    tv = (TextView) findViewById(R.id.textView1);
    myasynctask MAT = new myasynctask();
    MAT.execute();
}


    class myasynctask extends AsyncTask<String, Void, String> {

String str;
private static final String SOAP_ACTION = "http://www.processmaker.com/login";
private static final String METHOD_NAME = "login";
private static final String NAMESPACE = "http://www.processmaker.com/";
private static final String URL = "http://10.0.2.2:80/sysworkflow/en/classic/services/soap2";

@Override
protected String doInBackground(String... params) {
    SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
    request.addProperty("userid", "admin");
    request.addProperty("password", "admin");

    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
            SoapEnvelope.VER11);
    envelope.dotNet = true;
    envelope.setOutputSoapObject(request);

    HttpTransportSE ht = new HttpTransportSE(URL);

    try {
        ht.call(SOAP_ACTION, envelope);
        final SoapPrimitive response = (SoapPrimitive) envelope
                .getResponse();
        str = response.toString();

    } catch (Exception e) {
        e.printStackTrace();

    }
    //Log.d("WebRespone", str);
    return str;
}


@Override
public void onPostExecute(String result) {
// TODO Auto-generated method stub
Toast.makeText(MainActivity.this, result, Toast.LENGTH_LONG).show();
tv.setText(result);
super.onPostExecute(result);
}

@Override
protected void onPreExecute() {
// TODO Auto-generated method stub
super.onPreExecute();
}

}

}

请帮我解决这个问题...

【问题讨论】:

  • 你能分享 wsdl url 即 URL。当我试图查看所有方法时,什么都看不到?
  • @AmitGupta 它是 localhost url...如果您愿意,我准备分享我的完整 WSDL 代码...我只放我想要的...仅登录..跨度>

标签: android web-services soap localhost ksoap2


【解决方案1】:

替换

private static final String NAMESPACE = "http://www.processmaker.com/";

private static final String NAMESPACE = "http://www.processmaker.com";

【讨论】:

  • 试试这个,HttpTransportSE ht = new HttpTransportSE(URL,10000);
【解决方案2】:

方法名称也可能存在不匹配错误。就像你有一个名为 notifyme 的方法名,你可能把它写成 notify_me

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-04-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多