BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 12-02-2009, 05:58 AM   #1 (permalink)
New Member
 
Join Date: Nov 2009
Model: 8800
PIN: N/A
Carrier: Vodafone
Posts: 6
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default unexpected type (position:TEXT Connection refus

Please Login to Remove!

Hi,

i am trying to access a webservice using ksoap2. I am working in blackberry JDE 4.2.1.

Below is my code snippet:

Code:
       try
         {
             //Create a instance of SoapObject
            String ServiceUrl=<Web Service Url>;
            String serviceNamespace = <Name Space>;
            String SoapAction=<Web Service Url>/HelloWorld;
            SoapObject rpc = new SoapObject(serviceNamespace,"HelloWorld"); 

            SoapSerializationEnvelope envelope=new SoapSerializationEnvelope(SoapEnvelope.VER11);
            envelope.bodyOut=rpc;
            envelope.dotNet=true;
            envelope.encodingStyle=SoapSerializationEnvelope.XSD;
            HttpTransport ht=new HttpTransport(ServiceUrl);
            ht.debug=true;  
                 
            try
            {
            ht.call(SoapAction,envelope);      
            String result=(envelope.getResult()).toString();
            }
            catch(org.xmlpull.v1.XmlPullParserException ex2)
            {                
                System.out.println( ht.requestDump.toString());
                System.out.println( ht.responseDump.toString());            
            }            
            //Dialog.alert("Archival Started");
            System.out.println("Archival Started");

            }

            catch(Exception ex)
            {
                System.out.println(ex);
            }
At the line ht.call(SoapAction,envelope);

an org.xmlpull.v1.XmlPullParserException occurs. The details are as follows:


@67EE0000 "unexpected type (position:TEXT Connection refus...@1:30 in java.io.InputStreamReader@7c6b177c) "


I have looked up online but no luck.

Can someone please guide me here.....

Thanks,
Saket
Offline  
Old 12-03-2009, 04:53 AM   #2 (permalink)
New Member
 
Join Date: Nov 2009
Model: 8800
PIN: N/A
Carrier: Vodafone
Posts: 6
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default A possible explanation

Okay,

After further consulation with my colleague (Mr.Mahesh Labhe) we seem to have found out what why this error occurs and how to work around it.

The issue is in the url to the .net webservice.

If you are facing the same issue then please make a sure the following points are addressed:

1) In the ServiceUrl use the hostname ("//hostname:1234/....")of the machine rather than using "//localhost:1234/....". You can get the hostname by typing "hostname" in the command prompt. I guess localhost is relative, so if you use localhost in your url while running the app on the simulator then the simulator considers itself to be the localhost and hence your service will not be detected.

2) Make sure that your web serivce is running when trying to access the service from the client app.

3) If you are unable to directly access the .net webservice try deploying the serive on the IIS.

3) Check the version compatibility of the web service with the IIS. For example if the service is built on .net framework 3.5 then try building the same in 2.0 and check.

4) In IIS goto the properties of the website where you have deployed your service and under the ASP.NET tag change the version to "2.0.XXXXX".

After taking care of thr above points we were able to get the app up and running......

Hope this will be useful to someone else too.....

-Saket
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.