Win a copy of Classic Computer Science Problems in Swift this week in the iOS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic


Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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();

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
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!