Jeff Sexton

Wednesday, November 12, 2008

Calling a BPEL WSDL From an Object Outside an SA

Simple EJB ArchitectureImage 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:
at com.sun.xml.ws.api.pipe.TransportTubeFactory.create(TransportTubeFactory.java:144)
at com.sun.xml.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:112)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:595)
...
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.


Reblog this post [with Zemanta]

Post a Comment
3D modeling Advertising Air Canada Airline Alfa Romeo Spider Touring Gran Sport Analog signal Android Anomalies and Alternative Science Apache Apollo Astoria Augmented reality Aurora Famous Fighters auto-awesome Automobile Autos Barack Obama Batman Beards Beer Bell System Berkshire Hathaway Bigfoot Bird Toys Birds Blogger Books Build Management Business and Economy Business Process Execution Language Byte-order mark Canadian Carrot Cats Christmas Civil Defense CNN Cockatiels Collections Crows Dear Jane Debian Diabetes Digital Living Network Alliance Digital television Disney Doll House Dow Jones Industrial Average Duesenburg SJ Roadster Durham University E-mail address ebauche Economics EJB Energy development Enterprise JavaBean ESP Facebook Fedora Filesharing Finance Ford Fossil fuel Garfield James Abram Garfield Minus Garfield Glassfish Global warming Golden Arches Goofy Google Google Buzz Google Docs Google Lively Google Photos Google Reader Google Wave Google+ Greenhouse gas Half-Life 2 Helbros High-definition television History Hybrid electric vehicle IBM Inner city Instagram Insulin Investing Irony J.C. Penny Jane Austen Java Java Architecture for XML Binding JDBC Jeff's! Jim Davis joe the plumber John McCain Karma Kay Thompson Kermit the Frog Kids and Teens LA Auto Show Larry King Laser Logging Lowry Sexton Mark Cuban Market trends McDonald Meier and Frank Microsoft Microsoft Windows Models Monkey monsters Moon MOUNT HOOD Music Music industry Muxtape MySQL NetBeans Netflix Nintendo Nissan Cube Norm Coleman Nuclear fallout Nuclear warfare Office Depot Open ESB Oracle Corporation Pacific Ocean Packard Boattail Pearl District Pearl District Portland Oregon Philip K Dick photography PlayStation 3 Pocher Pokémon HeartGold and SoulSilver Politics Portal Portland Portland Development Commission Presidents Pride and Prejudice Programming Projects Radio Recording Industry Association of America Renewable energy RIAA Robot Chicken Rock-paper-scissors Sarcasm Science fiction film Serbia Service-oriented architecture Shopping Slide Rule Social Security Social Studies Society6 Spirit of St. Louis SQL Stanford Hospital Star Wars Starbucks Stock market Strip search Sun Microsystems T-Mobile TechCrunch Technical ThinkGeek Toaster Total Recall Transportation Security Administration Unicode United States United States Department of Homeland Security Universal Plug and Play Unknown Primates Vegetable garden Video game Vintage Images Vintage Vintage! Virtual world Volvo C70 Wall Street Warren Buffett watches We Can Remember It for You Wholesale Web service Web Services Description Language Wii Windows 7 Windows Phone 7 Windows Vista Windows XP X-Files X-ray vision XML XML Schema YouTube Yugo Zima