title: Trying to build a correct SOAP Request
body: <p>I have been struggling for hours trying to build the correct SOAP request using ksoap2 for Android with no luck. The ideal request looks like this: </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;
    &lt;soap:Header&gt;
      &lt;AuthorizationToken xmlns="http://www.avectra.com/2005/"&gt;
        &lt;Token&gt;string&lt;/Token&gt;
      &lt;/AuthorizationToken&gt;
    &lt;/soap:Header&gt;
    &lt;soap:Body&gt;
      &lt;ExecuteMethod xmlns="http://www.avectra.com/2005/"&gt;
        &lt;serviceName&gt;string&lt;/serviceName&gt;
        &lt;methodName&gt;string&lt;/methodName&gt;
        &lt;parameters&gt;
          &lt;Parameter&gt;
            &lt;Name&gt;string&lt;/Name&gt;
            &lt;Value&gt;string&lt;/Value&gt;
          &lt;/Parameter&gt;
        &lt;/parameters&gt;
      &lt;/ExecuteMethod&gt;
    &lt;/soap:Body&gt;
  &lt;/soap:Envelope&gt;
  </code></pre>
  
  <p>I am using the following code to generate my request:</p>
  
  <pre><code>    SoapObject request = new SoapObject(NAMESPACE, METHOD);
      request.addProperty("serviceName", SERVICENAME);
      request.addProperty("methodName", METHODNAME);
  
      SoapObject nestedParameters = new SoapObject(NAMESPACE, "parameters");
      SoapObject param = new SoapObject(NAMESPACE, "Parameter");
      param.addProperty("Name", name);
      param.addProperty("Value", value);
      nestedParameters.addSoapObject(param);
      request.addSoapObject(nestedParameters);
  
      SoapSerializationEnvelope envelope = 
              new SoapSerializationEnvelope(SoapEnvelope.VER11);
      envelope.setOutputSoapObject(request);
      envelope.dotNet = true;
      envelope.implicitTypes = true;
  
      envelope.headerOut = new Element[1];
      Element header = new Element().createElement(NAMESPACE, "AuthorizationToken");
      Element token = new Element().createElement(NAMESPACE, "Token");
      token.addChild(Node.TEXT, this.AUTH_TOKEN);
      header.addChild(Node.ELEMENT, token);
      envelope.headerOut[0] = header;
  </code></pre>
  
  <p>What ksoap2 is building is:</p>
  
  <pre><code>&lt;v:Envelope xmlns:i="http://www.w3.org/1999/XMLSchema-instance" xmlns:d="http://www.w3.org/1999/XMLSchema" xmlns:c="http://schemas.xmlsoap.org/soap/encoding/" xmlns:v="http://schemas.xmlsoap.org/soap/envelope/"&gt;
    &lt;v:Header&gt;
      &lt;n0:AuthorizationToken xmlns:n0="http://www.avectra.com/2005/"&gt;
        &lt;n0:Token&gt;string&lt;/n0:Token&gt;
      &lt;/n0:AuthorizationToken&gt;
    &lt;/v:Header&gt;
    &lt;v:Body&gt;
      &lt;ExecuteMethod xmlns="http://www.avectra.com/2005/" id="o0" c:root="1"&gt;   
        &lt;serviceName&gt;AHAWebServices&lt;/serviceName&gt;
        &lt;methodName&gt;MemberDirectory&lt;/methodName&gt;
        &lt;parameters i:type="n1:parameters" xmlns:n1="http://www.avectra.com/2005/"&gt;
          &lt;Parameter i:type="n1:Parameter"&gt;
            &lt;Name&gt;string&lt;/Name&gt;
            &lt;Value&gt;string&lt;/Value&gt;
          &lt;/Parameter&gt;
        &lt;/parameters&gt;
      &lt;/ExecuteMethod&gt;
    &lt;/v:Body&gt;
  &lt;/v:Envelope&gt;
  </code></pre>
  
  <p>I have a feeling that the problem is in the header with the n0 prefixes but I have no clue how to get rid of them. I removed them from from the body by setting implicitTypes to true but I cannot find a similar setting for the header. I am new to SOAP so any other advice is greatly appreciated. Does anyone have an idea of how I could fix this? </p>