title: Soap request format for android
body: <p>I am trying to access web services from Android(ICS) using ksoap2. Soap request send from my android emulator is like this (which is giving error as 'soapenv:Server.generalException' InvalidCredentialsFault):</p>
  
  <pre><code>&lt;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/"&gt;
  &lt;v:Header /&gt;
  &lt;v:Body&gt;
  &lt;LoginInput xmlns="http://xxxxxxx.com/Schemas/Core/2006-03/Session" id="o0" c:root="1"&gt;
  &lt;username i:type="d:string"&gt;uname&lt;/username&gt;
  &lt;password i:type="d:string"&gt;pass&lt;/password&gt;
  &lt;group i:type="d:string"&gt;&lt;/group&gt;
  &lt;role i:type="d:string"&gt;&lt;/role&gt;
  &lt;/LoginInput&gt;
  &lt;/v:Body&gt;
  &lt;/v:Envelope&gt;
  </code></pre>
  
  <p>but form SoapUI, a successful login request is send like this:</p>
  
  <pre><code>&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ses="http://xxxxxxx.com/Schemas/Core/2006-03/Session"&gt;
     &lt;soapenv:Header/&gt;
     &lt;soapenv:Body&gt;
        &lt;ses:LoginInput username="uname" password="pass" group="" role=""/&gt;
     &lt;/soapenv:Body&gt;
  &lt;/soapenv:Envelope&gt;
  </code></pre>
  
  <p>here is my android code section:</p>
  
  <pre><code>try {                   
      final String NAMESPACE = "http://xxxxxxx.com/Schemas/Core/2006-03/Session";
      final String URL = "http://10.0.0.11:9081/toc/services/Core-2006-03-Session?wsdl";
      final String METHOD_NAME = "LoginInput";
      final String SOAP_ACTION = "login";
  
      SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
      request.addProperty("username", "infodba");
      request.addProperty("password", "infodba");
      request.addProperty("group", "");
      request.addProperty("role", "");
  
      SoapSerializationEnvelope soapenvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
      soapenvelope.setOutputSoapObject(request);
      soapenvelope.dotNet = true;
  
      HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
      androidHttpTransport.debug = true;
  
      try {
          androidHttpTransport.call(SOAP_ACTION, soapenvelope);
          Object response = (Object) soapenvelope.bodyIn;
          tvResponse.setText(response.toString());
      } catch (Exception e) {
          e.printStackTrace();
          tvResponse.setText("Exception Message:" + e.getMessage());
      }
  } catch (Exception e) {
      e.printStackTrace();
      tvResponse.setText("Error: " + e.getClass().getName() + ":" + e.getMessage());
  }
  </code></pre>
  
  <p>I gone through many related threads on stackoverflow and tried those options, but failed to get correct login response. </p>
  
  <p><strong>In one try with SoapUI i got same error response when i remove one attribute (username="uname") from request as here</strong>:</p>
  
  <pre><code>&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ses="http://xxxxxxx.com/Schemas/Core/2006-03/Session"&gt;
     &lt;soapenv:Header/&gt;
     &lt;soapenv:Body&gt;
        &lt;ses:LoginInput password="pass" group="" role=""/&gt;
     &lt;/soapenv:Body&gt;
  &lt;/soapenv:Envelope&gt;
  </code></pre>
  
  <p>I tried <strong>kvmSerializable</strong> implements also but same error (<a href="https://stackoverflow.com/questions/9355707/how-to-create-soap-request-via-ksoap2">How to create SOAP request via ksoap2</a>). Here is a part of my <strong>WSDL</strong> file:</p>
  
  <pre><code>    &lt;wsdl:definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:imp1="http://xxxxxxxx.com/Schemas/Soa/2006-03/Exceptions" xmlns:imp2="http://xxxxxxxx.com/Schemas/Core/2006-03/Session" xmlns:imp3="http://xxxxxxxx.com/webservices/2005-06/schemas/WSFaults" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://xxxxxxxx.com/Services/Core/2006-03" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsi="http://ws-i.org/schemas/conformanceClaim/" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://xxxxxxxx.com/Services/Core/2006-03"&gt;
  &lt;wsdl:types&gt;
  &lt;xs:schema&gt;
  &lt;xs:import namespace="http://xxxxxxxx.com/Schemas/Soa/2006-03/Exceptions" schemaLocation="../schemas/SoaExceptions.xsd"/&gt;
  &lt;xs:import namespace="http://xxxxxxxx.com/Schemas/Core/2006-03/Session" schemaLocation="../schemas/Core0603Session.xsd"/&gt;
  &lt;xs:import namespace="http://xxxxxxxx.com/webservices/2005-06/schemas/WSFaults" schemaLocation="../schemas/WSFaults.xsd"/&gt;
  &lt;/xs:schema&gt;
  &lt;/wsdl:types&gt;
  
  &lt;wsdl:message name="loginRequest"&gt;
  &lt;wsdl:part element="imp2:LoginInput" name="in0"/&gt;
  &lt;/wsdl:message&gt;
  -------
  &lt;wsdl:portType name="Core0603Session"&gt;
  &lt;wsdl:operation name="login"&gt;
  &lt;wsdl:input message="tns:loginRequest" name="loginRequest"/&gt;
  &lt;wsdl:output message="tns:loginResponse" name="loginResponse"/&gt;
  &lt;wsdl:fault message="tns:InternalServerFaultFault" name="InternalServerFaultError"/&gt;
  &lt;wsdl:fault message="tns:InvalidCredentialsFaultFault" name="InvalidCredentialsFaultError"/&gt;
  &lt;/wsdl:operation&gt;
  &lt;/wsdl:portType&gt;
  -------
  &lt;wsdl:binding name="Core0603SessionSoapBinding" type="tns:Core0603Session"&gt;
  &lt;soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/&gt;
  &lt;wsdl:operation name="login"&gt;
  &lt;soap:operation soapAction="login" style="document"/&gt;
  &lt;wsdl:input&gt;
  &lt;soap:body use="literal"/&gt;
  &lt;/wsdl:input&gt;
  &lt;wsdl:output&gt;
  &lt;soap:body use="literal"/&gt;
  &lt;/wsdl:output&gt;
  &lt;wsdl:fault name="InternalServerFaultError"&gt;
  &lt;soap:fault name="InternalServerFaultError" use="literal"/&gt;
  &lt;/wsdl:fault&gt;
  &lt;wsdl:fault name="InvalidCredentialsFaultError"&gt;
  &lt;soap:fault name="InvalidCredentialsFaultError" use="literal"/&gt;
  &lt;/wsdl:fault&gt;
  &lt;/wsdl:operation&gt;
  --------
  &lt;/wsdl:binding&gt;
  &lt;wsdl:service name="Core0603SessionService"&gt;
  &lt;wsdl:port binding="tns:Core0603SessionSoapBinding" name="Core-2006-03-Session"&gt;
  &lt;soap:address location="http://10.0.0.11:9081/toc/services/Core-2006-03-Session"/&gt;
  &lt;/wsdl:port&gt;
  &lt;/wsdl:service&gt;
  &lt;/wsdl:definitions&gt;
  </code></pre>
  
  <p>and part of <strong>xsd</strong> file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  &lt;xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
      targetNamespace="http://xxxxxxxx.com/Schemas/Core/2006-03/Session"
      xmlns:tns="http://xxxxxxxx.com/Schemas/Core/2006-03/Session" 
      elementFormDefault="qualified" attributeFormDefault="unqualified"&gt;
  ------
      &lt;xsd:element name="LoginInput"&gt;
      &lt;xsd:complexType&gt;
          &lt;xsd:sequence&gt;
          &lt;/xsd:sequence&gt;
          &lt;xsd:attribute name="username" type="xsd:string" use="required"&gt;
         &lt;/xsd:attribute&gt;
          &lt;xsd:attribute name="password" type="xsd:string" use="required"&gt;
         &lt;/xsd:attribute&gt;
          &lt;xsd:attribute name="group" type="xsd:string" use="required"&gt;
         &lt;/xsd:attribute&gt;
          &lt;xsd:attribute name="role" type="xsd:string" use="required"&gt;
          &lt;/xsd:attribute&gt;
      &lt;/xsd:complexType&gt;
      &lt;/xsd:element&gt;
  &lt;/xsd:schema&gt;
  </code></pre>
  
  <p>and here is my responsedump :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;&lt;soapenv:Body&gt;&lt;soapenv:Fault&gt;&lt;faultcode&gt;soapenv:Server.generalException&lt;/faultcode&gt;&lt;faultstring/&gt;&lt;detail&gt;&lt;ns1:InvalidCredentialsFault xmlns:ns1="http://xxxxxxxx.com/Schemas/Soa/2006-03/Exceptions"&gt;&lt;message code="1007" level="1007"/&gt;&lt;/ns1:InvalidCredentialsFault&gt;&lt;ns2:exceptionName xmlns:ns2="http://xml.apache.org/axis/"&gt;com.xxxxxxxx.schemas.soa._2006_03.exceptions.InvalidCredentialsException&lt;/ns2:exceptionName&gt;&lt;ns3:stackTrace xmlns:ns3="http://xml.apache.org/axis/"&gt;
      at com.xxxxxxxx.soa.ptier.ExceptionMapper.throwSoaException(Unknown Source)
      at com.xxxxxxxx.soa.ptier.SoapInjector.sendRequestToPTier(Unknown Source)
      at com.xxxxxxxx.services.core._2006_03.Core0603SessionSoapBindingImpl.login(Unknown Source)
      at com.xxxxxxxx.services.core._2006_03.Core0603SessionSoapBindingSkeleton.login(Unknown Source)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:45)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
      at java.lang.reflect.Method.invoke(Method.java:599)
      at org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:397)
      at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:186)
      at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323)
      at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
      at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
      at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
      at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:454)
      at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
      at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:738)
      at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
      at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1655)
      at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1595)
      at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:131)
      at com.xxxxxxxx.presentation.gateway.filters.ResponseTimeFilter.doFilter(Unknown Source)
      at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:188)
      at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:116)
      at com.xxxxxxxx.presentation.gateway.filters.CompressionFilter.doFilter(Unknown Source)
      at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:188)
      at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:116)
      at com.xxxxxxxx.presentation.gateway.filters.ResponseTimeFilter.doFilter(Unknown Source)
      at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:188)
      at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:116)
      at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:77)
      at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:908)
      at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:932)
      at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:500)
      at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
      at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:91)
      at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:864)
      at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1583)
      at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:186)
      at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:455)
      at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:384)
      at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:272)
      at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
      at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
      at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
      at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
      at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
      at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
      at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
      at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
      at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
      at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1550)
  &lt;/ns3:stackTrace&gt;&lt;ns4:hostname xmlns:ns4="http://xml.apache.org/axis/"&gt;xxxxxxx&lt;/ns4:hostname&gt;&lt;/detail&gt;&lt;/soapenv:Fault&gt;&lt;/soapenv:Body&gt;&lt;/soapenv:Envelope&gt;
  </code></pre>
  
  <p>forgive me for such a long description with codes, but i hope it will help for better understanding of issue and my faults. In short i want help to get the Soap request format similar to SoapUI request, i know its not compulsion but hope it will solve my issue. Please give me any other alternate if possible.</p>