Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Regular Contributor
milan555
Posts: 52
Registered: ‎07-04-2011
My Device: Bold-3
My Carrier: Developer

Exception : org.xmlpull.v1.XmlPullParserException: unexpected type (position:END_DOCUMENT null@1:0

Hi,

When I try to "AUTHENTICATE" Ksoap "HTTPS" webservice

 

I am using Ksop2 ksoap2-j2me-core-2.1.2.jar for soap parsing.

 

For http Authentication  I am using HttpTransportBasicAuth class but  I got following exception :

 

org.xmlpull.v1.XmlPullParserException: unexpected type (position:END_DOCUMENT null@1:0

 

When I use on http base url it's work fine but whet use https base url it's not working and throw exeption.

 

If any one has any idea why I am getting this exception Please help me.

 

 

Please use plain text.
Developer
simon_hain
Posts: 16,113
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Exception : org.xmlpull.v1.XmlPullParserException: unexpected type (position:END_DOCUMENT null@1:0

this most likely means that the server responds with an http error message. ksoap cannot parse http errors.
we have added this capability manually to the library.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Regular Contributor
milan555
Posts: 52
Registered: ‎07-04-2011
My Device: Bold-3
My Carrier: Developer

Re: Exception : org.xmlpull.v1.XmlPullParserException: unexpected type (position:END_DOCUMENT null@1:0

Thanks for Reply.

 

Sorry , I can not understand what you are saying .

Can you please explain it ?

 

Regards,

Please use plain text.
Developer
simon_hain
Posts: 16,113
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Exception : org.xmlpull.v1.XmlPullParserException: unexpected type (position:END_DOCUMENT null@1:0

ksoap expects xml.
if the server returns an http error, like 401, ksoap cannot parse this as it is not valid xml.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Regular Contributor
milan555
Posts: 52
Registered: ‎07-04-2011
My Device: Bold-3
My Carrier: Developer

Re: Exception : org.xmlpull.v1.XmlPullParserException: unexpected type (position:END_DOCUMENT null@1:0

OK.

Thank you for your reply.

Can you please help me to resolve this error ?

 

Regards,

Milan

Please use plain text.
Regular Contributor
milan555
Posts: 52
Registered: ‎07-04-2011
My Device: Bold-3
My Carrier: Developer

Re: Exception : org.xmlpull.v1.XmlPullParserException: unexpected type (position:END_DOCUMENT null@1:0

I want to do authentication .

so if you have any idea plz let me know.

 

Thanks

Please use plain text.
Regular Contributor
milan555
Posts: 52
Registered: ‎07-04-2011
My Device: Bold-3
My Carrier: Developer

Re: Exception : org.xmlpull.v1.XmlPullParserException: unexpected type (position:END_DOCUMENT null@1:0

Hi,

 

I am using "ServiceConnectionMidp" , but not getting the proper response.

I am still getting following error :

org.xmlpull.v1.XmlPullParserException: unexpected type (position:END_DOCUMENT null@1:0

So,can any one please help me to resolve it ?

 

Regards,

 

Please use plain text.
Developer
simon_hain
Posts: 16,113
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Exception : org.xmlpull.v1.XmlPullParserException: unexpected type (position:END_DOCUMENT null@1:0

We have overwritten ServiceConnectionMidp like this:

 

/**
 * {@inheritDoc}
 *
 * @see org.ksoap2.transport.ServiceConnection#openInputStream()
 */
public InputStream openInputStream() throws IOException {
 InputStream is = connection.openInputStream();
 if (connection.getResponseCode() != HttpConnection.HTTP_OK) {

 How you handle a http error is up to you, we opted to throw a custom exception, to give an example.

The sourcecode of ksoap2 is available on http://ksoap2.sourceforge.net/ if you want to recompile the whole lib instead of overwriting the class only.

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.