WCF Service for Android Client - Errors: Could not find class and NoClassDefFoundError

I am working on a project where I am using WCF (.Net Framework 4) as my web service and Android app as my client (Android 2.2 (API 8)) . I created a WCF project and published it to IIS server. Then I used the "wsimport" command (provided by the java JDK) using the following structure:

wsimport -p testWCF -keep -verbose -d "d:\webservice\java" http://192.168.2.103/MyWebService.svc?wsdl

      

I imported the jar file by pasting it into the "libs" folder of the Androids project and adding the jar file to the build path by clicking the Add External Jar button. Then checked the jar file in the Order and Export tab as shown below:

Image of my "Build Path"

From Eclipse I get the following message:

The type javax.xml.bind.annotation.XmlNsForm cannot be resolved. It is indirectly referenced from required .class files

      

However Eclipse still runs Android project on my device, but then I get the following errors from Log Cat

  • Could not find class
  • NoClassDefFoundError

When I imported the jar file into a regular Java project, I was able to access the web service successfully using the following code, but not in an Android project.

MyWebService service = new MyWebService();
IMyWebService client = service.getBasicHttpBindingIMyWebService();

System.out.println(client.getMessage());

      

I searched for the above errors and many solutions suggested that the "build path" was missing references, however these solutions didn't work for my android project. What am I doing wrong? what am i missing?

thank

+3


source to share





All Articles