Image via WikipediaNext up, calling an existing OpenESB BPEL from a plain Java class that has been included in a Netbeans "Web Application" project and deployed to Glassfish in an "Enterprise Application" project.
Firstly, the web service client can be added to the Web Application project by file only, not by URL. Adding the service client by URL fails to retrieve the imported XSDs for some reason. Adding the client by local file works fine and the required service and port classes are generated in the build directory, as normally.
So far so good. I can add the call of the web service to any Java class as usual, by dragging the port reference into the editor. However, at runtime, the call fails:
javax.xml.ws.WebServiceException: Unsupported endpoint address:A quick aside about adding the web service call... One should be able to do this by right-clicking in the editor and selecting "Web Service Client Resources" and "Call Web Service Operation". However this only lists WSDLs in EJB projects. You can cannot select a WSDL that leads to a BPEL in this way, for some reason.
Back to the unsupport endpoint problem, the issue has something to do with the port I'm guessing. I resolved this by editing the generated service class and replacing the file URI for the WSDL with a full URL, port and all. Now more needs to be done - the service class is in the build directory. It is recreated each time, and the edits are lost. So to do all this, you must create a new service class. This is easy.
1) Create a new Java package in the source folder.
2) Create a new (plain) Java class in there, with the same name as your service class.
3) Paste the source of the generated service class into the new class file.
The resulting new service class will not be rebiult with the project and can be edited, to change the WSDL location.
I had to make two other edits in this new class. The last "get port" method, at the bottom, in the generated class is somehow invalid in the newly created class. How it could be valid in one place and not the other is beyond me. It is not used, so I removed it. Secondly, the new service class will need imports for the other generated classes.
The Java class can then use this new service class, with the WSDL as an HTTP URL, to invoke the BPEL.