1
   SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);          
   Log.d("WebService", "2");
   SoapSerializationEnvelope envelope = 
          new SoapSerializationEnvelope(SoapEnvelope.VER11);
   envelope.dotNet = true;
   envelope.setOutputSoapObject(request);
   HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
   androidHttpTransport.call(SOAP_ACTION, envelope);                    
   SoapPrimitive result = (SoapPrimitive)envelope.getResponse();

This is the code where I call a .NET web service which sends a byte[] array. How can I get the byte[] array from the result variable or is there another approach to retrieve byte[] array?

Robert
  • 39,162
  • 17
  • 99
  • 152
PCS
  • 211
  • 3
  • 11

1 Answers1

1

Assuming that the presented code is using kSoap2. If you want to access the retrieved data forget about the response object returned by envelope.getResponse().

The data you are looking for can be retrieved via

SoapObject resultsRequestSOAP = (SoapObject) envelope.bodyIn;
if (resultsRequestSOAP != null) {
  Object o = resultsRequestSOAP.getProperty("name of the byte-array parameter");
  // ...
}

The returned Object o is usually of the type SoapPrimitive or may be a Vector.

If it's a SoapPrimitive using it's toString() method you can get the String representation of the byte array that has to be parsed and converted to a byte array.

If it's a Vector I don't think that you will have problems converting it to a byte array.

Robert
  • 39,162
  • 17
  • 99
  • 152