开发者

org.xmlpull.v1.XmlPullParserException: unexpected type (position:END_DOCUMENT null@1:0 in java.io.InputStreamReader@c599f9fd)

I am new to blackberry , iam just trying to call a Web service that do some operations on SAP CRM , ,but iam getting this exception: org.xmlpull.v1.XmlPullParserException: unexpected type (position:END_DOCUMENT null@1:0 in java.io.InputStreamReader@c599f9fd)

Here is the code...

   SoapObject rpc = new SoapObject(serviceNamespace,"zws_incoming_email");

   rpc.addProperty("username","sreenu");

   rpc.addProperty("Password","ravi");

   SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
   envelope.bodyOut = rpc;

   envelope.dotNet = true;
   envelope.encodingStyle = SoapSerializationEnvelope.ENC;
   envelope.env = "http://schemas.xmlsoap.org/soap/envelope/";
   HttpTransport ht = new HttpTransport(serviceUrl);
 //s  ht.requestDump=msg;
   ht.debug = true;
   String request="";
   ht.setXmlVersionTag("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"  ); 
   String response=ht.responseDump;
        try
            {  
            System.out.print("2222222");
            ht.call(soapAction,envelope);
            String result = (envelope.getResponse()).toString();
            System.out.println("in try block"+result);
            System.out.println("Request"+request);
            System.out.println("Response"+response);
            System.out.println("Result......"+result);  
             }        
        catch(org.xmlpull.v1.XmlPullParserException ex2){
            String msg2 = ex2.toString();
              request=ht.requestDump;
               response=ht.responseDump;
             System.out.println("Exception...... "+msg2);
              System.out.println("request...... "+request);
              System.out.println("response...... "+response);
                 }

          catch(Exception ex)
           {
        String msg1 = ex.toString();
           System.out.println(".......... catch block"+msg1);开发者_开发问答
          }     
}

Exception raises after ht.call() method,Please help me..............


I had the same problem, getting the END_DOCUMENT error, but I solved it.

The main issue was in the proxy settings in simulator.

When I was trying to access web service from Blackberry simulator, I was getting this error all the time, no matter what I did. After 2 days of "research", I fixed the problem. Do the following:

  1. Make sure that you have preverified KSOAP2 jar. If not do the steps: http://www.craigagreen.com/index.php?/Blog/blackberry-and-net-webservice-tutorial-part-1.html
  2. Make sure you have installed MDS. If not, go https://swdownloads.blackberry.com/Downloads/entry.do?code=996009F2374006606F4C0B0FDA878AF1 download and install Blackberry Email and MDS Services Simulator Package.
  3. Go to C:\Program Files (x86)\Research In Motion\BlackBerry Email and MDS Services Simulators 4.1.2\MDS\config (which is where package from Step 2 is installed). Open rimpublic.property file. Under [HTTP HANDLER] add the following lines:

    application.handler.http.proxyEnabled = true
    application.handler.http.proxyHost=YOUR_PROXY_IP
    application.handler.http.proxyPort=PROXY_PORT
    application.handler.http.proxyUser=PROXY_USER (with domain if required)
    application.handler.http.proxyPass=PASSWORD
    application.handler.http.proxyAutoConfig = false`
    
  4. Now quite IMPORTANT and interesting step. First Blackberry simulator I have user in Eclipse did not take proxy settings. And I WAS NOT PROMTED to enter proxy settings. So I had no internet access in simulator (THAT WAS THE MAIN ISSUE). Then I tried to install other simulator. (in my case Blackberry Pearl 9100 version 5.0.0.884 You can download it here: http://us.blackberry.com/developers/resources/simulators.jsp). When i tried to connect to internet through the web browser I was prompted for username, domain and password. And boom, I have internet connection. Problem solved. My app was working fine.


I had the same problem and I was able to resolve it by again downloading the KSOAP library

ksoap2-android-assembly-3.0.0-RC.4-jar-with-dependencies

found at https://code.google.com/p/ksoap2-android/

Seems that they had an issue with the previous version. I hope it helps people having the same problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜