I've been using rpclib to auto-generate a WSDL and implement it in Python.
Then I wanted to call a web-service* that has this WSDL using JavaEE, so I simply used the Web Service from WSDL option in the creation wizard in Eclipse (Indigo 3.7.1 with OEPE), but then the Ant build failed with the exception (in short):
weblogic.wsee.tools.WsBuildException Error running JAX-WS wsdlc
Caused by java.lang.NoSuchMethodException: javax.xml.bind.annotation.XmlElementRef.required()
What should I do? How can I call the web-service using JavaEE?
* The web service is configured with: Apache HTTP Server 2.2.2 + mod_wsgi 3.3 + Python 2.6.5 + rpclib 2.6.1.
Ok, stumbled upon your post the second time, so I'll elaborate my comment given before :).
First I recapitulate your set-up:
General options for invoking a WS:
The first option won't work in your set-up because DI will only work in an container-managed-environment (see my comment). That means that the WS class and the executing class have to be in the same container (e.g. the same server).
So what is left is to generate your WS stubs manually. Therefore you can use the wsimport
tool mentioned in your own answer. There are several different ways to use this tool. Lets have a look in the CLI use:
%IDE_WORKSPACE%/your project/src
stub
wsimport -keep <http://yourwsdl?wsdl>
Back in your IDE:
Now you're able to use your generated stub-files to connect to the WS by getting a port
from the generated service
-file
public class WsClient {
public static void main(String[] args) {
//Create Service
'GeneratedFile'Service service = new 'GeneratedFile'Service();
//create proxy
'GeneratedFile' proxy = service.get'GeneratedFile'Port();
//invoke
System.out.println(proxy.yourMethod(yourParam));
}
}
Last hints:
wsimport
tool to set this directly in the import routine.wsimport
tool in a GUI out of Eclipse. Once set up it should accelerate your work.Hope this helped, have Fun!
EDIT: Just to clarify:
After you used the wsimport
tool you should have a directory containing files like shown in the image. To make this example clear you'll need to get a Service from the RequestFileService
(this is my WS operation) like RequestFileService service = new RequestFileService();
and after this you'll need a Port on this service like RequestFile proxy = service.getRequestFilePort();
.
After this you can invoke your method calls by using the port proxy.yourMethod(yourParam);