KSoap2 SoapObject Object Reference no está configurado para una instancia

Creo que este es un problema simple al que otros pueden proporcionar el enlace faltante. tengo unFlujo de trabajo Servicio wcf con el que mis clientes .NET pueden comunicarse correctamente. He activado el rastreo debajo de la aplicación y puedo ver cómo se ejecutan correctamente las llamadas de servicio, por lo que me siento cómodo porque el servicio no es el problema. Mis llamadas de Android nunca llegan al primer punto de rastreo.

En Android usando ksoap2 (2.6.5) cuando llamo a esta línea, obtengo un error de referencia de Objeto no establecido:

SoapObject response = (SoapObject)envelope.getResponse();

Para mí, esto parece simple, el sobre debe ser nulo y cuando intentamos acceder a él para ejecutar getResponse tenemos un error y, sin embargo, en el depurador lo muestra como un objeto válido. Además, no puedo encontrar la documentación para explicar y cada tutorial que he visto lo tiene de esta manera, así que ...

Una cosa que es diferente es que en .NET crearía un objeto que pase el objeto y permitiré que .NET lo serialice por mí. Aquí agrego varios parámetros y todos son cadenas, pero la enumeración que mostraré ya que es un posible culpable. Aquí está mi implementación completa de Java:

String NAMESPACE = "http://tempuri.org/";
String METHOD_NAME = "LiftDataExchange";
String SOAP_ACTION = "http://tempuri.org/ILiftDataExchange/ProcessDataRequest";
String URL = "http://www.icyarmtesting.com/LiftDataExchange.xamlx";
String SOAP_REMOTE_NAMESPACE = "http://schemas.datacontract.org/2004/07/IronMikeDataExchangeWorkflowService.Enum";

String X = "";
ExchangeEnumerations ExrcsEnum = ExchangeEnumerations.GetNextWorkout;

//Initialize soap request
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);

//add parameters
PropertyInfo piAct = new PropertyInfo();
piAct.setName("Action");
piAct.setValue(ExrcsEnum);
piAct.setType(ExchangeEnumerations.class);
request.addProperty(piAct);

//Declare the version of the SOAP request
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.addMapping(SOAP_REMOTE_NAMESPACE, "ExchangeEnumerations", ExchangeEnumerations.class, ExchangeEnumerationsEnumClass.getInstance());
envelope.dotNet = true;
envelope.setOutputSoapObject(request);

//Needed to make the internet call
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.debug = true;
try 
    {          
  //this is the actual part that will call the webservice
  androidHttpTransport.call(SOAP_ACTION, envelope); 
  SoapObject response = (SoapObject)envelope.getResponse();
  X = response.getProperty(0).toString();
}
catch (Exception e)...... 

Aquí está mi solicitud de volcado:

<v:Envelope xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:d="http://www.w3.org/2001/XMLSchema" xmlns:c="http://schemas.xmlsoap.org/soap/encoding/" xmlns:v="http://schemas.xmlsoap.org/soap/envelope/">
    <v:Header />
    <v:Body>
        <LiftDataExchange xmlns="http://tempuri.org/" id="o0" c:root="1">
            <UserName i:type="d:string">STERILIZED_OUT</UserName>
            <Password i:type="d:string">STERILIZED_OUT</Password>
            <ExerciseProgramID i:type="d:string">STERILIZED_OUT</ExerciseProgramID>
            <IncomingWorkoutData i:type="d:string">STERILIZED_OUT</IncomingWorkoutData>
            <Action i:type="n0:ExchangeEnumerations" xmlns:n0="http://schemas.datacontract.org/2004/07/IronMikeDataExchangeWorkflowService.Enum">GetNextWorkout</Action>
        </LiftDataExchange>
    </v:Body>
</v:Envelope>

Aquí está mi volcado de respuesta:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Body>
        <s:Fault>
            <faultcode xmlns:a="http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher">a:InternalServiceFault</faultcode>
            <faultstring xml:lang="en-US">Object reference not set to an instance of an object.</faultstring>
            <detail>
                <ExceptionDetail xmlns="http://schemas.datacontract.org/2004/07/System.ServiceModel" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
                <HelpLink i:nil="true"/>
                <InnerException i:nil="true"/>
                <Message>Object reference not set to an instance of an object.</Message>                
                <StackTrace>   at System.ServiceModel.Activities.WorkflowOperationContext.HandleEndResumeBookmark(IAsyncResult result)&#xD; at System.ServiceModel.Activities.WorkflowOperationContext.OnResumeBookmark()&#xD; at System.ServiceModel.Activities.WorkflowOperationContext..ctor(Object[] inputs, OperationContext operationContext, String operationName, Boolean performanceCountersEnabled, Boolean propagateActivity, Transaction currentTransaction, WorkflowServiceInstance workflowInstance, IInvokeReceivedNotification notification, WorkflowOperationBehavior behavior, ServiceEndpoint endpoint, TimeSpan timeout, AsyncCallback callback, Object state)&#xD; at System.ServiceModel.Activities.Description.WorkflowOperationBehavior.WorkflowOperationInvoker.OnBeginServiceOperation(WorkflowServiceInstance workflowInstance, OperationContext operationContext, Object[] inputs, Transaction currentTransaction, IInvokeReceivedNotification notification, TimeSpan timeout, AsyncCallback callback, Object state)&#xD; at System.ServiceModel.Activities.Dispatcher.ControlOperationInvoker.ControlOperationAsyncResult.PerformOperation()&#xD; at System.ServiceModel.Activities.Dispatcher.ControlOperationInvoker.ControlOperationAsyncResult.HandleEndGetInstance(IAsyncResult result)&#xD; at System.ServiceModel.Activities.Dispatcher.ControlOperationInvoker.ControlOperationAsyncResult.Process()&#xD; at System.ServiceModel.Activities.Dispatcher.ControlOperationInvoker.ControlOperationAsyncResult..ctor(ControlOperationInvoker invoker, Object[] inputs, IInvokeReceivedNotification notification, TimeSpan timeout, AsyncCallback callback, Object state)&#xD; at System.ServiceModel.Activities.Dispatcher.ControlOperationInvoker.InvokeBegin(Object instance, Object[] inputs, IInvokeReceivedNotification notification, AsyncCallback callback, Object state)&#xD; at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&amp; rpc)&#xD; at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc&amp; rpc)&#xD; at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc&amp; rpc)&#xD; at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)</StackTrace><Type>System.NullReferenceException</Type></ExceptionDetail></detail></s:Fault></s:Body></s:Envelope>

ACTUALIZAR:

El cambio al método de Edwin tuvo el mismo resultado. Así que actualicé de KSoap2 2.6.5 3.0.0-RC4 y ahora estoy recibiendo una NullRefException. Con la versión anterior, presionaría el servicio y lanzaría el error de no establecer el objeto. Con esta versión no golpeo el servicio y lanzo NullRef. El código es el mismo, lo único que cambia es qué versión de KSoap utilizo. Escribí un servicio simple (recuerde que estos son Servicios de flujo de trabajo) que toma una cadena, la cambia y la patea hacia atrás.

FWIW aquí está mi código para hacer la llamada:

String SOAP_ACTION = "http://tempuri.org/";
    String OPERATION_NAME="ChangeName";
    final String WSDL_TARGET_NAMESPACE = SOAP_ACTION;
    final String SOAP_ADDRESS= "http://www.icyarmtesting.com/ServiceTest/Service1.xamlx";
    Exception exception;
    String ErrorMsg="";
    String TEST_URL="" ;

    SoapObject request = new SoapObject(WSDL_TARGET_NAMESPACE, OPERATION_NAME);

    //PropertyInfo piName = new PropertyInfo();
    //piName.setName("UserName");
    //piName.setValue("ramjet");
    //piName.setType(String.class);
    //request.addProperty(piName);
    request.addProperty("UserName", "ramjet");

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

    HttpTransportSE httpTransport =null;
    if(!TEST_URL.equals(""))
        httpTransport = new HttpTransportSE(TEST_URL);
    else
        httpTransport = new HttpTransportSE(SOAP_ADDRESS);



    Object Response =null;
     try
     {
        httpTransport.call(SOAP_ACTION + "IService/" + OPERATION_NAME, envelope);
        Response = envelope.getResponse();
      }
     catch (SocketTimeoutException ex) 
     {
         ErrorMsg="Unable to connect";
          Response=null;
         exception=ex;
      }
      catch (IOException ie) 
      {
       ErrorMsg="Unable to connect";
      Response=null;
       exception=ie;
      }
       catch (Exception e) 
       {
        ErrorMsg="Unable to connect";
        Response=null;
        exception=e;
     }

Respuestas a la pregunta(4)

Su respuesta a la pregunta