Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to solve org.xmlpull.v1.XmlPullParserException: unexpected type (position:END_DOCUMENT null@1:1 in java.io.InputStreamReader@40d310f0)
    primarykey
    data
    text
    <p>i have create simple webservice using jax-ws. i need to consume that webservice in android. when i consume that webservice i got this error <strong><code>org.xmlpull.v1.XmlPullParserException: unexpected type (position:END_DOCUMENT null@1:1 in java.io.InputStreamReader@40d310f0)</code></strong> </p> <p>my wsdl code:</p> <pre><code>&lt;definitions targetNamespace="http://sample.jaxws.ws.blog.accrd.com/" name="SimpleWebServiceService"&gt; &lt;types&gt; &lt;xsd:schema&gt; &lt;xsd:import namespace="http://sample.jaxws.ws.blog.accrd.com/" schemaLocation="http://localhost:8080/SimpleWebService/SimpleWebService?xsd=1"/&gt; &lt;/xsd:schema&gt; &lt;/types&gt; &lt;message name="sayHello"&gt;&lt;part name="parameters" element="tns:sayHello"/&gt;&lt;/message&gt;&lt;message name="sayHelloResponse"&gt; &lt;part name="parameters" element="tns:sayHelloResponse"/&gt; &lt;/message&gt; &lt;portType name="SimpleWebService"&gt;&lt;operation name="sayHello"&gt; &lt;input wsam:Action="http://sample.jaxws.ws.blog.accrd.com/SimpleWebService/sayHelloRequest" message="tns:sayHello"/&gt; &lt;output wsam:Action="http://sample.jaxws.ws.blog.accrd.com/SimpleWebService/sayHelloResponse" message="tns:sayHelloResponse"/&gt; &lt;/operation&gt; &lt;/portType&gt; &lt;binding name="SimpleWebServicePortBinding" type="tns:SimpleWebService"&gt; &lt;soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/&gt;&lt;operation name="sayHello"&gt; &lt;soap12:operation soapAction=""/&gt; &lt;input&gt; &lt;soap12:body use="literal"/&gt; &lt;/input&gt; &lt;output&gt; &lt;soap12:body use="literal"/&gt; &lt;/output&gt; &lt;/operation&gt; &lt;/binding&gt; &lt;service name="SimpleWebServiceService"&gt; &lt;port name="SimpleWebServicePort" binding="tns:SimpleWebServicePortBinding"&gt;&lt;soap12:address location="http://localhost:8080/SimpleWebService/SimpleWebService"/&gt; &lt;/port&gt; &lt;/service&gt; &lt;/definitions&gt; </code></pre> <p>My Activity:</p> <pre><code>public class MainActivity extends Activity { public final static String URL ="http://localhost:8080/SimpleWebService/SimpleWebService?wsdl"; public static final String NAMESPACE = "http://sample.jaxws.ws.blog.accrd.com/"; public static final String SOAP_ACTION = "http://sample.jaxws.ws.blog.accrd.com/sayHello"; private static final String METHOD = "sayHello"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final TextView tv = (TextView) findViewById(R.id.txt1); Button btn = (Button) findViewById(R.id.button1); btn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { SoapObject request = new SoapObject(NAMESPACE, METHOD); Customer cu = new Customer(); cu.setFirstName("FirstName"); cu.setLastName("LastName"); PropertyInfo propInfo = new PropertyInfo(); propInfo.name = "arg0"; propInfo.type = Customer.class; request.addProperty(propInfo, cu); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope( SoapEnvelope.VER12); envelope.setOutputSoapObject(request); HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); try { androidHttpTransport.call(SOAP_ACTION, envelope); Log.d("Error", "Finished"); SoapObject response=(SoapObject)envelope.bodyIn; tv.setText(response.toString()); } catch (Exception e) { Log.d("Error", e.toString()); } } }); }} </code></pre> <p>My Customer.java</p> <pre><code> public class Customer implements KvmSerializable { private String firstName; private String lastName; public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } @Override public Object getProperty(int arg0) { Object object = null; switch (arg0) { case 0: object = this.firstName; break; case 1: object = this.lastName; break; } return object; } @Override public int getPropertyCount() { // TODO Auto-generated method stub return 2; } @Override public void getPropertyInfo(int arg0, Hashtable arg1, PropertyInfo propertyInfo) { switch (arg0) { case 0: propertyInfo.name = "firstName"; propertyInfo.type = PropertyInfo.STRING_CLASS; break; case 1: propertyInfo.name = "lastName"; propertyInfo.type = PropertyInfo.STRING_CLASS; break; } } @Override public void setProperty(int arg0, Object object) { switch (arg0) { case 0: this.firstName = object.toString(); break; case 1: this.lastName = object.toString(); break; } } } </code></pre> <p>when i use @BindingType is soap1.1 in my jax-ws webservice i get correct response. but when i use @BindingType is soap1.2 in my jax-ws webservice i get this error <strong>org.xmlpull.v1.XmlPullParserException: unexpected type (position:END_DOCUMENT null@1:1 in java.io.InputStreamReader@40d310f0).</strong></p> <p>How can solve this Problem?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload