title: ksoap2 Android unexpected type in response
body: <p>Im trying to make a call to a java web service using ksoap2. I am using the ksoap2-android-assembly-2.6.5-jar-with-dependencies.jar and Android API level 8. </p>
  
  <p>Activity Code:</p>
  
  <pre><code>private static final String SECURITY_NAMESPACE = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";
  private static final String USERNAME_TOKEN_NAMESPACE = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";
  private static final String PASSWORD_TYPE = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText";
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
  
      SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
  
      Element usernameElement = new Element().createElement(SECURITY_NAMESPACE, "Username");
      usernameElement.addChild(Node.TEXT, "username");
      Element passwordElement = new Element().createElement(SECURITY_NAMESPACE, "Password");
      passwordElement.setAttribute(null, "Type", PASSWORD_TYPE);
      passwordElement.addChild(Node.TEXT, "password");
  
      Element usernameTokenElement = new Element().createElement(USERNAME_TOKEN_NAMESPACE, "UsernameToken");
      usernameTokenElement.addChild(Node.ELEMENT, usernameElement);
      usernameTokenElement.addChild(Node.ELEMENT, passwordElement);
  
      Element securityElement = new Element().createElement(SECURITY_NAMESPACE, "Security");
      securityElement.setAttribute(null, "mustUnderstand", "1");
      securityElement.setPrefix(null, SECURITY_NAMESPACE);
      securityElement.addChild(Node.ELEMENT, usernameTokenElement);
  
      Element[] header = new Element[]{securityElement};
  
      SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
      envelope.headerOut = header;
      envelope.setOutputSoapObject(request);
  
      HttpTransportSE httpTransport = new HttpTransportSE(URL);
      httpTransport.debug = true;
  
      try{
          httpTransport.call(SOAP_ACTION, envelope);
          SoapObject response = (SoapObject) envelope.getResponse();
      }catch (Exception e) {
          Log.e("Soap", e.getMessage(), e);
      }
  </code></pre>
  
  <p>When i make the call i get the following exception:</p>
  
  <pre><code>06-12 13:01:51.563: E/Soap(471): unexpected type (position:TEXT ������������U��n� ...@3:97 in java.io.InputStreamReader@44f5de78) 
  
  06-12 13:01:51.563: E/Soap(471): org.xmlpull.v1.XmlPullParserException: unexpected type (position:TEXT ������������U��n� ...@3:97 in java.io.InputStreamReader@44f5de78)
  </code></pre>
  
  <p>Any ideas what could be causing this? Could it be something to do with character encoding, GZIP or incorrect soap version?</p>
  
  <p>Any help would be greatly appreciated.</p>
  
  <p>Thanks
  David</p>