Question

I am developing an application which should serve as a client to a Web Service.

I have generated source files based on the WSDL file using the wsimport utility. It works fine on my development machine with JDK 1.7 (e.g. it compiles and runs fine).

I cannot even compile the application in the test environment though, where I have JDK 1.5. I get a bunch of errors like the following:

Cannot find symbol: class WebMethod

Is suspect the problem is with the lesser version of JDK.

What should I do to fix this, e.g. to update the application to become Java 1.5 compatible?

It must be run a standalone console application.

Était-ce utile?

La solution

You're correct, it is a function of your JDK, JAX-WS(annotations) was included in the J2SE JDK with v1.6. Doesn't exist in 1.5. It lives outside of the JDK as Project Metro, sample code

Autres conseils

You can regenerate the source classes using the wsimport utility with -target 2.0 option.

The generated source is jdk 1.5 compliant and doesn't use the @WebService and @WebMethod annotation (introduced with jdk 1.6).

The client class will be generated with the @WebServiceClient annotation contained in the javax.xml.ws package

@WebServiceClient(name = "ContestService", targetNamespace = "", wsdlLocation = "file:/C:/sviluppo/Lavoro/ContestWS/contestWS.wsdl")
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top