Getting error when using KSoap library to consume .NET web services

I have been using ksoap library to consume .net web service. and I am getting this kind of error

"expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope (position:START_TAG @1:7 in java.io.InputStreamReader@40d0c7d8)"

I have searched every where but I couldn't find any good help.

Here is the code where I try to consume the web service.

public class WebInvoke { private static final String NAMESPACE = "http://tempuri.org/" ; private static final String METHOD_NAME = "login"; private static final String SOAP_ACTION = NAMESPACE + METHOD_NAME; private static final String URL = ""; private final SoapSerializationEnvelope envelope; public WebInvoke() { SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); PropertyInfo quotesProperty = new PropertyInfo(); quotesProperty.setName("UserName"); quotesProperty.setValue("admin"); quotesProperty.setType(String.class); request.addProperty(quotesProperty); quotesProperty = new PropertyInfo(); quotesProperty.setName("Password"); quotesProperty.setValue("a"); quotesProperty.setType(String.class); request.addProperty(quotesProperty); Log.e("Request Assign", request.toString()); envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); envelope.dotNet = true; envelope.setOutputSoapObject(request); Log.e("Envelope Assign", envelope.toString()); } public String Fetch() { String result = ""; HttpTransportSE httpRequest = new HttpTransportSE(URL); try { envelope.xsd = SoapSerializationEnvelope.XSD; envelope.enc = SoapSerializationEnvelope.ENC; httpRequest.setXmlVersionTag("<?xml version=\"1.0\" encoding=\"utf-8\"?>"); Log.e("httpRequest.call", "httpRequest.call"); httpRequest.call(SOAP_ACTION, envelope); SoapPrimitive response = (SoapPrimitive)envelope.getResponse(); result = response.toString(); } catch(Exception e) { //e.printStackTrace(); Log.e("httpRequest.call Exception", e.getMessage()); } return result; } }


Try and get a better code. Your code sounds a bit clumsy.

"org.xmlpull.v1.XmlPullParserException: expected: START_TAG" Error expected-start-tag-error

chk this.

<ol start="2"> <li>

Check your methodname and url with .netcode

</li> <li>

Exclude the app_html.offline in C# appcode file as it won’t allow any database project to run.

</li> </ol>

hope it helps ya.


I also got this error. Ultimately, it got fixed by setting these values:

String SOAP_ACTION = "BookTypeService"; String METHOD_NAME = "bookType"; String NAMESPACE = ""; String URL = "";

where, is my local I/P.

<wsdl:service name="BookTypeServiceService"> <wsdl:port name="BookTypeService" binding="impl:BookTypeServiceSoapBinding"> <wsdlsoap:address location="http://localhost:8080/MyWebService/services/BookTypeService"/> </wsdl:port> </wsdl:service>


  • SOAP response not in XML format
  • Android ksoap2 parameter issues
  • How to Build ArrayAdapter from result received from webservice?
  • How to best use PHP Soap with Android?
  • What is the best way to map two objects of the same type excluding some fields?
  • Multifield required validation is not working in client side in MVC 5?
  • How to clear the values inside a dynamic object?
  • Conversion of C# datetime to sql server datetime is throwing an error
  • How to use reflection to get just the object instance's public properties?
  • C# object to array
  • How can I find all the members of a Properties.Resources in C#
  • how to get all primitive type of an object
  • Parsing a big CSV file C# .net 4
  • Checking for Nulls on DB Record Mapping
  • Big-O of .GetProperties()
  • JAX-RS and JSON messed up
  • 401 IIS Error for SearchAdmin.asmx
  • jQuery Ajax setTimeout JSON
  • List custom class members and type
  • “org.xmlpull.v1.XmlPullParserException: expected: START_TAG” Error
  • Render partial view using knockout.js
  • ListView to open hyperlinks in android
  • C# Find properties shared by two types of the same hierarchy
  • How to get the client IP address from the request made to webservice
  • $.ajax & passing data to .asmx webservice
  • Problem serializing DecimalFormatSymbols in 2.3.4
  • renaming sheets with “full sheet” charts on them causes spreadsheet to reload
  • Setting a Sharepoint Site Theme through a Web Service?
  • Sort an arraylist of objects in java
  • Tomcat memory Leak
  • MongoError: Incorrect arguments
  • Django rest serializer Breaks when data exists
  • Seeking advice on Jetty HttpClient Hang
  • How would I use PHP exceptions to define a redirect?
  • How to redirect a user to a different server and include HTTP basic authentication credentials?
  • Symfony2: How to get request parameter
  • using conditional logic : check if record exists; if it does, update it, if not, create it
  • Codeigniter doesn't let me update entry, because some fields must be unique
  • log4net write single file for each call to log.info
  • Getting error when using KSoap library to consume .NET web services