-1

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) 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 ::

    • 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)

    • 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

bharath
  • 14,283
  • 16
  • 57
  • 95
nagesh
  • 1

1 Answers1

1

You need to find a WSDL client library that is compatible with J2ME. Axis library used by Eclipse wizards definitely isn't.

I recommend that you use Netbeans that can create a client automatically for you. See this article.

kgiannakakis
  • 103,016
  • 27
  • 158
  • 194