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
Posts: 58
Registered: ‎09-21-2010
My Device: Not Specified

Webservice call too slow

Hi All,

 

I am created a webservice in dotnet & it has many webservice methods. I have written client side application for iPhone & Blackberry storm2. I have generated stub for blackberry using Sun Java toolkit.

Webservice method call takes around 300ms in Phone, whereas the same method call takes around 1800ms in blackberry. For every method call, blackberry takes too much time as compared to iPhone.

 

As an example, one of the webservice method takes one argument & return boolean value. This simple method call still takes around 1600ms.

 

Can anybody please tell me how to shorten the time or am I doing something wrong?

 

 

Thanks for your help.

 

 

Developer
Posts: 105
Registered: ‎06-23-2010
My Device: 9000
My Carrier: vodaphone

Re: Webservice call too slow

Hi there,

perhaps you can post some code. I use the ksoap2 libraries and calls are fast. Also, what network connection are you suing?

 

 

-matt

Press Kudos if this helped - ;-)
Regular Contributor
Posts: 58
Registered: ‎09-21-2010
My Device: Not Specified

Re: Webservice call too slow

Hi Matt,

 

Thanks for quick reply.

 

I am using wifi connection. Following is the code snippet which I am using after generating the stub using Sun java toolkit:

webServiceStub._setProperty(IBSWebServiceSoap_Stub.ENDPOINT_ADDRESS_PROPERTY,
                        value);      // value is the webservice url + deviseside=true + interface=wifi

sessionID = webServiceStub.authenticateService( "ibs", "ibs", 1);

 

authenticateService method is defined in stub. And this returns a string. It takes around 1800ms.

 

Following is the code in stub for authenticateService method that is generated by Sun Java toolkit:

public java.lang.String authenticateService(java.lang.String username, java.lang.String password, int moduleid) throws java.rmi.RemoteException {
        // Copy the incoming values into an Object array if needed.
        Object[] inputObject = new Object[3];
        inputObject[0] = username;
        inputObject[1] = password;
        inputObject[2] = new java.lang.Integer(moduleid);

        Operation op = Operation.newInstance(_qname_AuthenticateService, _type_AuthenticateService, _type_AuthenticateServiceResponse);
        _prepOperation(op);
        NotConnectedScreen.InsertTimeStamp("Before op>>");
        op.setProperty(Operation.SOAPACTION_URI_PROPERTY, "http://tempuri.org/AuthenticateService");
        Object resultObj;
        try {
            NotConnectedScreen.InsertTimeStamp("Before invoke>>");
            resultObj = op.invoke(inputObject);
            NotConnectedScreen.InsertTimeStamp("After invoke>>");
        } catch (JAXRPCException e) {
            Throwable cause = e.getLinkedCause();
            if (cause instanceof java.rmi.RemoteException) {
                throw (java.rmi.RemoteException) cause;
            }
            throw e;
        }
        java.lang.String result;
        // Convert the result into the right Java type.
        // Unwrapped return value
        Object authenticateServiceResultObj = ((Object[])resultObj)[0];
        result = (java.lang.String)authenticateServiceResultObj;
        return result;
    }

 

Thanks for help.

 

Developer
Posts: 105
Registered: ‎06-23-2010
My Device: 9000
My Carrier: vodaphone

Re: Webservice call too slow

Hi,

I cannot see anything terribly wrong...

 

Is perhaps the authentication taking too long? Can you just test calling a webservice method that requires no authentication?

 

 

-matt

Press Kudos if this helped - ;-)
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Webservice call too slow

I might be wrong, but 1800 milliseconds is about 2 seconds, which, for a wireless connection (i.e. mobile wireless) is a pretty good response time.  What ere your expecting?

 

If you are seeing this on your Simulator, then I'm with the previous poster, look at your Web Server.

Highlighted
Developer
Posts: 1,415
Registered: ‎07-30-2008
My Device: Not Specified

Re: Webservice call too slow

you are using same libraries etc? You can suspect a couple of things- network and code

ordering. Also note that you need to do many tests due to "noise"- I have simple code take forever

if some background process starts or something. If you have emails coming in

that ties up radio etc. In this case, I have no idea what a simple method is but

if it has to do a web request and can't use an old one hopefully that is the rate

limiting step. Wifi could have quirks I guess, if you are not closing connections

or something there could be all kinds of issues.

Regular Contributor
Posts: 58
Registered: ‎09-21-2010
My Device: Not Specified

Re: Webservice call too slow

 

Hi,

 

Thanks to u all.

 

I have developed application for iPhone & for blackberry. Both are using the same webservice & pointing to same server & in the same network environment. But iPhone is takes much - much less time as compared to Blackberry.

 

The example I given above is for athentication service.

 

I have generated the stub using Sunjava tool. WHere we need to close the connection & all. As I think this should be done in the stub generated by the tool.

 

Around 2 second in the ideal environment is too much if no bulk data is going to recieve.

 

Please help me.

 

 

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Webservice call too slow

Sorry, I missed your comment that you were already using WiFi.  Do you append the URL with ";interface=wifi"?  I can't see it in my quick look (but then I missed your comment about already using WiFi, so anything is possible...)

Regular Contributor
Posts: 58
Registered: ‎09-21-2010
My Device: Not Specified

Re: Webservice call too slow

HI peter,

 

Yes,I am using the wifi & using proper interface. That is why,  I am getting response in my device. But the issue is its very slow.

 

 

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Webservice call too slow

OK, I have no answer to that sorry. 

 

Have you tried 'instrumenting' the processing so that you can see where the delay is?  Put time stamps in various places and find out if it is the network taking the time or elsewhere.  For example, when using the BrowserField2 I have found that there is significant delay while it renders the data.