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
Developer
Posts: 96
Registered: ‎03-06-2009
My Device: Not Specified

Weird behavior while receiving a web service response

I'm crossposting my problem to this forum too, hope that is OK. I will post answer on both if I find one.

 

I have a web service which returns a big string (10000+ characters) representing XML code.

Here is a part of it (the beginning and the end):
Code:
<Advertisers>[...]</reportTable></Sites><reportDate>Thu Apr 02 12:04:42 PDT 2009</reportDate>
I tested it with SOAPSonar, which is a tool to test web services with their wsdl. Anyway that works.

So I developped a blackberry client using ksoap2 to connect to the web service. Here is the code:
Code:
SoapObject request = new SoapObject(URL, SERVICE);
        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        request.addProperty("username", "testuser");
        envelope.setOutputSoapObject(request);
        try {
            HttpTransport ht = new HttpTransport("ht tp://xxxxxxxxxxxx:xxxx/xxx/xx/xx");
            ht.call(null, envelope);
            result = (envelope.getResponse()).toString();
            System.out.println("DEBUG: Response=*" + result + "*");
And here is the strangest part. This is the result I get while debugging:
Code:
DEBUG: result=*</Sites><reportDate></reportDate>*
So this is supposed to be the end of the request but there is not even all the elements (some text is missing between the reportDate tags).
I've tried to hard-code the string and it does work so I don't think the issue is related to the size of the string.

I'm totally lost and any advice is appreciated.
Developer
Posts: 96
Registered: ‎03-06-2009
My Device: Not Specified

Re: Weird behavior while receiving a web service response

any idea why im only getting a partial response?

do I read it wrong?

Developer
Posts: 96
Registered: ‎03-06-2009
My Device: Not Specified

Re: Weird behavior while receiving a web service response

any suggestion?
Highlighted
BlackBerry Development Advisor
Posts: 15,697
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Weird behavior while receiving a web service response

I recommend enabling HTTP logging in the MDS Simulator to verify what data it is receiving.  Check and see if it is what you are expecting the server to send.  You can find the steps to do so here:

 

How To - Enable HTTP and HTML logging in the BlackBerry MDS Simulator
Article Number: DB-00156

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800792/801079/How_To_...

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker