This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Java Micro Edition and the fly likes J2ME-WEBSERVICE Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "J2ME-WEBSERVICE" Watch "J2ME-WEBSERVICE" New topic
Author

J2ME-WEBSERVICE

Nagesh Golem
Greenhorn

Joined: Dec 22, 2010
Posts: 7
Hello Experts,

I am working on J2ME-WEBSERVICES to get information from server through SOAP protocol. For this task actually i went through two ways,

1) i) First created Web-service with normal java class in elipse and then created Client project for the web-service then it creates stub and service classes.
ii) And then i deploy the war file in to tomcat server and i successfully used the java class method got result correctly,
iii) URL i have used in Android application, With KSOAP api application works correctly, even i tested in mobile.
iv) but when i used the same url in j2me-midlet code i was written like:

SoapObject soap=new SoapObject(NAMESPACE,METHOD_NAME);
soap.addProperty("barcode", barnum);
HttpTransport se=new HttpTransport();
se.setUrl(URL);
se.setSoapAction(SOAP_ACTION);
se.call(soap);

but i am getting Nullpointer exception when pointer at SoapWriter.writeProperty() class.

2) Second way is, I used the stub and service classes of WebserviceClient project, and i created a MIDlet in same package (placed all supported jar files for MIDlet in lib folder)
DBWEBSoapBindingStub stub=new DBWEBSoapBindingStub();
DBWEBService service=(DBWEBService)stub;
stub._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, "URL of webservice at server");
String result=stub.getBarcodeDetails(barcode);
ii) I successfully compiled and preverified, with the generated class files i created jar, and when i deploy application in mobile, getting below exceptions :
:1) Noclassfound exception for org.apache.axis.client.stub : For this i placed axis.jar file in to application jar file. but still problem is when i deploy in to mobile, " jar file is max size" problem (size==1.6MB)
2) second exception is javax.xml.rpc.Service class not found : if i place the jar file in my application jar file it gives me exception like : " cannot create a class in system package "


so please let me know the solution for this issue, hope experts can help me out.

Thank You in advance
Walter Gabrielsen Iii
Ranch Hand

Joined: Apr 09, 2011
Posts: 158
I don't know SOAP, but I do know that the spec for Java ME Web Services is jsr 172. Perhaps a list of links can help you.

Introduction to J2ME Web Services

Web services in J2ME

JSR 172 J2ME Web Services (Online API Link)

JSR 172: J2ME(TM) Web Services Specification (Download API Link)


Moving on, in your first attempt, I don't understand what SoapObject is, is it a new class or subclass that you made?

Also, in your second attempt, there isn't an "org.apache.axis" package or "javax.xml.rpc.Service" class in jsr 172, you should register your jar with your eclipse project instead of just adding a jar file into the resource folder, and the size error says that your jar's file size exceeds the limit set by the device implementation.
 
GeeCON Prague 2014
 
subject: J2ME-WEBSERVICE