title: Soap Fault VersionMismatch KSOAP2 for Android
body: <p>I'm trying to access a Web Service which is hosted here</p>
  
  <p><a href="http://srilanka.lk:9080/services/CropServiceProxy?wsdl" rel="nofollow">http://srilanka.lk:9080/services/CropServiceProxy?wsdl</a></p>
  
  <p>Works in SoapUI ok. I get the proper response in it. </p>
  
  <p><strong>SoapUI Request</strong></p>
  
  <pre><code>&lt;soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:v1="http://schemas.icta.lk/xsd/crop/handler/v1/"&gt;
     &lt;soap:Header/&gt;
     &lt;soap:Body&gt;
        &lt;v1:getCropDataList&gt;
           &lt;v1:code&gt;ABK&lt;/v1:code&gt;
        &lt;/v1:getCropDataList&gt;
     &lt;/soap:Body&gt;
  &lt;/soap:Envelope&gt;
  </code></pre>
  
  <p><strong>SoapUI Response</strong></p>
  
  <pre><code>&lt;soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"&gt;
     &lt;soapenv:Body&gt;
        &lt;ns1:getCropDataListResponse xmlns:ns1="http://schemas.icta.lk/xsd/crop/handler/v1/"&gt;
           &lt;ns1:cropInfo&gt;
              &lt;ns1:name&gt;Ambul Kesel&lt;/ns1:name&gt;
              &lt;ns1:price&gt;35.0&lt;/ns1:price&gt;
              &lt;ns1:location&gt;Dambulla&lt;/ns1:location&gt;
           &lt;/ns1:cropInfo&gt;
           &lt;ns1:cropInfo&gt;
              &lt;ns1:name&gt;Ambul Kesel&lt;/ns1:name&gt;
              &lt;ns1:price&gt;40.0&lt;/ns1:price&gt;
              &lt;ns1:location&gt;Dambulla&lt;/ns1:location&gt;
           &lt;/ns1:cropInfo&gt;
        &lt;/ns1:getCropDataListResponse&gt;
     &lt;/soapenv:Body&gt;
  &lt;/soapenv:Envelope&gt;
  </code></pre>
  
  <p>But in Ksoap2 for android the soap response is an error. Following are the requestDump and responseDump respectively.</p>
  
  <p><strong>requestDump</strong></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;n0:getCropDataList id="o0" c:root="1" xmlns:n0="http://schemas.icta.lk/xsd/crop/handler/v1/"&gt; 
  &lt;code i:type="d:string"&gt;CNT&lt;/code&gt;
  &lt;/n0:getCropDataList&gt;
  &lt;/v:Body&gt;
  &lt;/v:Envelope&gt;
  </code></pre>
  
  <p><strong>responseDump</strong></p>
  
  <pre><code>&lt;?xml version='1.0' encoding='UTF-8'?&gt;
  &lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"&gt;
  &lt;soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing"&gt;
  &lt;wsa:Action&gt;http://www.w3.org/2005/08/addressing/soap/fault&lt;/wsa:Action&gt;
  &lt;wsa:RelatesTo&gt;urn:uuid:3257ABC779195052D01293913466558&lt;/wsa:RelatesTo&gt;
  &lt;/soapenv:Header&gt;
  &lt;soapenv:Body&gt;
  &lt;soapenv:Fault&gt;
  &lt;faultcode&gt;VersionMismatch&lt;/faultcode&gt;
  &lt;faultstring&gt;Only SOAP 1.1 or SOAP 1.2 messages are supported in the system&lt;/faultstring&gt;
  &lt;detail /&gt;
  &lt;/soapenv:Fault&gt;
  &lt;/soapenv:Body&gt;
  &lt;/soapenv:Envelope&gt;
  </code></pre>
  
  <p>Here is my code. </p>
  
  <pre><code>public void btnOnClick(View v){
          String NAMESPACE = "http://schemas.icta.lk/xsd/crop/handler/v1/";
          String URL = "http://220.247.225.202:9080/services/CropServiceProxy.CropServiceProxyHttpSoap12Endpoint";
  
          String METHOD_NAME = "getCropDataList";
          String SOAP_ACTION = "http://schemas.icta.lk/xsd/crop/handler/v1/getCropDataList";
  
          SoapObject soap_request = new SoapObject(NAMESPACE, METHOD_NAME);
          soap_request.addProperty("code", "ABK" );
  
          SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER12);
          envelope.setOutputSoapObject(soap_request);
          envelope.addMapping(NAMESPACE, "cropInfo", CropInfo.class);
          envelope.dotNet=false;
  
          Marshal floatMarshal = new MarshalFloat();
          floatMarshal.register(envelope);
  
          System.out.println("body out : " + envelope.bodyOut.toString());
  
          AndroidHttpTransport http_transport = new AndroidHttpTransport(URL);
          //HttpTransportSE http_transport  = new HttpTransportSE(URL);
          http_transport.debug = true;
          try {
              http_transport.call(SOAP_ACTION, envelope);         
  
              //because we should expect a vector, two kinds of prices are given
              Vector&lt;CropInfo&gt; result_array = (Vector&lt;CropInfo&gt;)envelope.getResponse();
              if(result_array != null){
                  for (CropInfo current_crop: result_array){
                      System.out.println(current_crop.getName());
                      System.out.println(Float.toString(current_crop.getPrice()));
                  }
              }
  
          } catch (Exception e) {
              e.printStackTrace();
              answer.setText("error caught");
              System.out.print("REQUEST: ");
              System.out.println(http_transport.requestDump);
              System.out.print("RESPONSE: ");
              System.out.println(http_transport.responseDump);
          }
  
  
  
      }
  </code></pre>
  
  <p>How can I get a proper response in Ksoap2 for this? </p>