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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Developer
Posts: 40
Registered: ‎07-16-2008
My Device: Not Specified
Accepted Solution

Generating stubs for accessing webservices in Eclipse JDE Plugin

Hi,

 

I am developing a sample application to access a webservice by using JDE Eclipse plu in.

i have generated stubs using  axis.jar.

but problem is all the classes are directly/indirectly pointing to java.io.Serialiazable. which is not in J2ME packages.

is there any other way to generating the web services stubs...?

 

Please let me know... URGENT.....

 

Thanks in Advance

Highlighted
Retired
Posts: 856
Registered: ‎07-15-2008
My Device: Passport
My Carrier: Bell

Re: Generating stubs for accessing webservices in Eclipse JDE Plugin

I'm not aware of a stub generator for J2ME Webservices, but the BlackBerry API offers support for JSR 172, which is for Web Services on J2ME. This is supported as of version 4.3.0.

 

Another option would be to try kSOAP2, which offers a SOAP interface in J2ME.

Tim Windsor
Open Source Technical Lead
Developer
Posts: 105
Registered: ‎05-22-2008
My Device: Not Specified

Re: Generating stubs for accessing webservices in Eclipse JDE Plugin

The way I go about this, is to have a simple jsp / web proxy app, that talks web services on one end, and simple http back to the device at the other.

 

It may look like a pain, but actually it reduces all the extra XML and optimizes bandwidth (IMHO).

 

Yes, you do have to develop a custom protocol from your app to the proxy, but I have had great success with this

in my project.

Developer
Posts: 40
Registered: ‎07-16-2008
My Device: Not Specified

Re: Generating stubs for accessing webservices in Eclipse JDE Plugin

Thanks for repply,

 

i have  generated the stubs by using J2MEWirelessToolkit , comiling...

 

it is working fine with sun simulator,

 

it is giving JAXRPCException in BlackBerry simulator only....

 

is JDE/ JDE Simulator supports the webservices....?

 

Thanks in advance...

BlackBerry Development Advisor
Posts: 15,889
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Generating stubs for accessing webservices in Eclipse JDE Plugin

When you say you are only getting the exception in the BlackBerry Simulator, does this mean the application is working fine on an actual BlackBerry?  Please ensure that you are also running the MDS Simulator along with the BlackBerry Simulator.  This simulates the MDS Connection Service found on a BlackBerry Enterprise Server.

 

If this is not the case, can you provide a code snippet of the section that is triggering the error?

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Developer
Posts: 40
Registered: ‎07-16-2008
My Device: Not Specified

Re: Generating stubs for accessing webservices in Eclipse JDE Plugin

Thanks for repply,

 

i didn't test  it on  actual Blackberry.. yes i am running the MDS simulator also on 8085 port.

 

Please find the method where i m getting the error.


public java.lang.String login(java.lang.String userName, java.lang.String passWord, int loginType, java.lang.String strAssocDefName, java.lang.String strLocale, boolean bExternAuth) throws java.rmi.RemoteException, loginStubs.ClfyException {
  Object[] inputObject = new Object[6];
  inputObject[0] = userName;
  inputObject[1] = passWord;
  Operation op = Operation.newInstance(_qname_login, _type_login, _type_loginResponse, this);
  _prepOperation(op);
  op.setProperty(Operation.SOAPACTION_URI_PROPERTY, "" );
  Object resultObj;
  try {
   resultObj = op.invoke(inputObject);

  } catch (JAXRPCException e)
                {
   throw e;
  }
  java.lang.String result;
  // Convert the result into the right Java type.
  // Unwrapped return value
  Object loginReturnObj = ((Object[])resultObj)[0];
  result = (java.lang.String)loginReturnObj;
  return result;
 } 


in the above code, exactly in bold  line i m getting the JAXRPCException StringIndexOutOfBoundsException.

 

if i change the

         op.setProperty(Operation.SOAPACTION_URI_PROPERTY, "" );
               to

         op.setProperty(Operation.SOAPACTION_URI_PROPERTY, " " );

 

i am getting the marshal Exception.

 

what i need to set in this property...?

 

BlackBerry Development Advisor
Posts: 15,889
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Generating stubs for accessing webservices in Eclipse JDE Plugin

Try populating the rest of the inputObject array with empty strings or null values so that each element in the array has been set to something.
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Developer
Posts: 88
Registered: ‎09-25-2008
My Device: Not Specified

Re: Generating stubs for accessing webservices in Eclipse JDE Plugin

This doesnt work for me. I have this:

javax.xml.rpc.JAXRPCException: java.lang.StringIndexOutOfBoundsException: Index 0 >= 0

 

My code is like this:

public stub.Articulo obtenerArticulo(long id) throws java.rmi.RemoteException {
        // Copy the incoming values into an Object array if needed.
        Operation op = Operation.newInstance(_qname_urn_PruebaWSWsd_obtenerArticulo, _type_obtenerArticulo, _type_obtenerArticuloResponse);
        _prepOperation(op);
        op.setProperty(Operation.SOAPACTION_URI_PROPERTY, "");       
        Object resultObj;
        try {
            resultObj = op.invoke(String.valueOf(id));
        } catch (JAXRPCException e) {
            Throwable cause = e.getLinkedCause();
            if (cause instanceof java.rmi.RemoteException) {
                throw (java.rmi.RemoteException) cause;
            }
            throw e;
        }
        stub.Articulo result;
        // Convert the result into the right Java type.
        // Unwrapped return value
        Object[] responseObj = (Object[]) ((Object[])resultObj)[0];
        if (responseObj == null) {
            result = null;
        } else {
            result = new stub.Articulo();
            long a_long;
            Object idObj = responseObj[0];
            a_long = ((java.lang.Long)idObj).longValue();
            result.setId(a_long);
            java.lang.String string;
            Object nombreObj = responseObj[1];
            string = (java.lang.String)nombreObj;
            result.setNombre(string);
            java.lang.String string2;
            Object referenciaObj = responseObj[2];
            string2 = (java.lang.String)referenciaObj;
            result.setReferencia(string2);
        }
        return result;
    }

BlackBerry Development Advisor
Posts: 15,889
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Generating stubs for accessing webservices in Eclipse JDE Plugin

What line of code is triggering the exception?
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Developer
Posts: 88
Registered: ‎09-25-2008
My Device: Not Specified

Re: Generating stubs for accessing webservices in Eclipse JDE Plugin

[ Edited ]

This line:

 

resultObj = op.invoke(String.valueOf(id));

 

I've tried too this code:

Object[] inputObject = new Object[1];       
inputObject[0] = String.valueOf(id);

.

.

.

resultObj = op.invoke(inputObject);

 

and I have the same exception.

Message Edited by sickned on 09-26-2008 04:44 AM