的SOAPFault - 故障code:“SOAP-ENV:异常在android系统 [英] SoapFault - faultcode: 'SOAP-ENV: Exception in android

查看:212
本文介绍了的SOAPFault - 故障code:“SOAP-ENV:异常在android系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道已经同类型qusetion是present在SO,但我没有找到解决方案。我得到这个

I know already same type qusetion is present in SO but i didn't find the solutions. i got this

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

异常时,试图从响应我的LocalServer ..

exception when try to get response from my localserver..

我的WSDL code HOULD这样的:

my wsdl code hould like:

<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();
}

}

}

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

Please help me in resolving this issue...

推荐答案

替换

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

通过

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

这篇关于的SOAPFault - 故障code:“SOAP-ENV:异常在android系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆