【问题标题】:SoapFault - faultcode: 's:Client' faultstring: 'Error code 2006' faultactor: 'null' detail: org.kxml2.kdom.NodeSoapFault - 故障代码:'s:Client' 故障字符串:'错误代码 2006' 故障因素:'null' 详细信息:org.kxml2.kdom.Node
【发布时间】:2014-07-10 07:22:50
【问题描述】:

我在尝试从 WSDL Web 服务获取响应时一次又一次地收到此错误。

我是这样使用它的:

    //Create request
    SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
    //Property which holds input parameters
    PropertyInfo celsiusPI = new PropertyInfo();
    celsiusPI.setName("Driver.Token");
    celsiusPI.setType(PropertyInfo.STRING_CLASS);
    celsiusPI.setValue("c1f40074-4bf8-4159-ba15-e799e9efad9e");

    PropertyInfo latitude = new PropertyInfo();
    latitude.setName("Latitude");
    latitude.setType(Double.class);
    latitude.setValue(28.5192);

    PropertyInfo longitude = new PropertyInfo();
    longitude.setName("Longitude");
    longitude.setType(Double.class);
    longitude.setValue(77.2130);

    //Add the property to request object
    request.addProperty(celsiusPI);
    request.addProperty(latitude);
    request.addProperty(longitude);


    //Create envelope
    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
            SoapEnvelope.VER11);
    envelope.dotNet = true;


    //Set output SOAP object
    envelope.setOutputSoapObject(request);
    //Create HTTP call object
    HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
    try {
        //Involve web service
        androidHttpTransport.call(SOAP_ACTION, envelope);
        //Get the response
        //SoapPrimitive response = (SoapPrimitive) envelope.getResponse();
        Object response = envelope.getResponse();
        //Assign it to fahren static variable
        fahren = response.toString();
        Log.d("Response Message", fahren);
    } catch (Exception e) {
        e.getMessage();
        Log.d("Response Message--------------------", e.getMessage());
    }
}

得到这个异常:SoapFault - faultcode: 's:Client' faultstring: 'Error code 2006' faultactor: 'null' detail: org.kxml2.kdom.Node

这非常令人沮丧。如果有人可以帮助我!

【问题讨论】:

    标签: android wsdl ksoap


    【解决方案1】:

    请检查您需要传递方法名称的“wsdl:input wsaw:Action”的soap操作

    import java.net.SocketException;
    
    import org.ksoap2.SoapEnvelope;
    import org.ksoap2.serialization.PropertyInfo;
    import org.ksoap2.serialization.SoapObject;
    import org.ksoap2.serialization.SoapPrimitive;
    import org.ksoap2.serialization.SoapSerializationEnvelope;
    import org.ksoap2.transport.HttpTransportSE;
    
    import android.R.string;
    import android.content.Context;
    import android.util.Log;
    
    public class Services {
        private static String SOAP_ACTION;
        private static String METHOD_NAME;
        private static String NAMESPACE = "http://tempuri.org/";
    
    private static String URL = "xyz";
    
    private static Context mContext;
    
    // Register User
    public static String Register(Context context, String StudentCode,
            ) {
    
        SOAP_ACTION = "http://tempuri.org/ABC/Register"; **//Here you need to pass wsdl:input wsaw:Action**
        METHOD_NAME = "Register";
    
        mContext = context;
        String result = null;
    
        // Ack
        Log.e("method", "Register");
    
        try {
            SoapPrimitive responses = null;
            SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
    
            // Property PassCode
            PropertyInfo piStudentCode = new PropertyInfo();
            piStudentCode.setName("sPassCode");
            piStudentCode.setValue(StudentCode);
            piStudentCode.setType(string.class);
            request.addProperty(piStudentCode);
    
    
    
            SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
                    SoapEnvelope.VER11);
            envelope.dotNet = true;
            envelope.setOutputSoapObject(request);
            HttpTransportSE andHttp = new HttpTransportSE(URL);
    
            try {
                andHttp.call(SOAP_ACTION, envelope);
                responses = (SoapPrimitive) envelope.getResponse();
    
            } catch (SocketException ex) {
                Log.e("Register SE ex", ex.toString());
                ex.printStackTrace();
            } catch (Exception e) {
                Log.e("Register ex", e.toString());
                e.printStackTrace();
            }
    
            result = responses.toString();
        } catch (Exception e) {
            e.printStackTrace(System.err);
            Log.e("Register main ex", e.toString());
        }
    
        return result;
    }
    

    【讨论】:

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