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
New Developer
oreyraj
Posts: 32
Registered: ‎10-07-2008
My Device: Not Specified
Accepted Solution

Error on Ksoap2 ?

try {
            SoapObject client = new SoapObject("","HelloWorld");
            client.addProperty("name","Rajesh");
            SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
            envelope.bodyOut = client;
            HttpTransport ht = new HttpTransport("http://localhost:8085/axis/HelloWorldService.jws");
            ht.call("", envelope);

            SoapObject result = (SoapObject)envelope.getResponse();
	     System.out.println(result.getProperty(0).toString());
         
        }
        catch ( SoapFault sf){
            String faultString = "Code: " + sf.faultcode + "\nString: " + sf.faultstring;
            System.out.println("Soap Fault--->"+faultString);
        }
        catch ( Exception e){
            e.printStackTrace();
            System.out.println("Error--->"+e.getMessage());
        }

 

public class HelloWorldService
{
	public String HelloWorld(String data)
	{
		System.out.println("The webservice data - > "+data);
		return "Hello World! You sent the string '" + data + "'.";
	}
}

        can any one tell me why am i getting this error message?
       
        unexpected type (position:TEXT Not authorized t...@1:39 in java.io.InputStreamReader@ada44f35)

 

       Any help would be greatly appreciated!

 

      Thanks.

 

 

 

 

Developer
simon_hain
Posts: 16,282
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: Error on Ksoap2 ?

ksoap2 cannot handle http error messages. you have to modify it to do it, i would suggest in ServiceConnectionMidp (download the source and add http response handling).

----------------------------------------------------------
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
New Developer
oreyraj
Posts: 32
Registered: ‎10-07-2008
My Device: Not Specified

Re: Error on Ksoap2 ?

Thanks for your response.

 

I dont unserstand where to download the source and add http response handling.

 

Could you please send me a sample piece of code connecting the webservice with the client ksoap2.

 

I am using eclipse 3.4 with JDE 4.2.1 components library and axis

 

 

Thanks

Developer
simon_hain
Posts: 16,282
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: Error on Ksoap2 ?

http://ksoap2.sourceforge.net/ is the project page.

 

here are some links about the basics:

http://www.ddj.com/mobile/208800166

http://www.blackberryforums.com/developer-forum/140930-blackberry-jde-ksoap-noobs.html

http://www.codeproject.com/KB/mobile/CallWebServiceFromkSOAP.aspx?msg=2784881

 

to fix the http response inability overwrite openInputStream in  ServiceConnectionMidp and check the response code prior to returning the inputstream.

----------------------------------------------------------
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
New Developer
oreyraj
Posts: 32
Registered: ‎10-07-2008
My Device: Not Specified

Re: Error on Ksoap2 ?

Thanks. I will work on this

New Developer
oreyraj
Posts: 32
Registered: ‎10-07-2008
My Device: Not Specified

Re: Error on Ksoap2 ?

Hi sorry for the late reply i made this working.

 

Thanks you.