Jeff Sexton

Monday, January 26, 2009

Performance and Calling a BPEL WSDL From an EJB

In most of my current Java SOI/JBI (Netbeans/Glassfish/OpenESB) project, where a BPEL needs to be invoked from inside an EJB, I have done some variation of simply using Netbeans' wizard to create a Web Service Client, and then dragging the operation from the WSDL over into the EJB source editor. This creates a service class, and classes for the message and response that are generally pretty close to what I needs, all using Jaxb-ws.

At one point in the project however, I determined that one of these calls created a really significant performance hit. The hit occurred someplace between leaving my EJB code:

MyOperationDataResponse myOperationDataResponse = port.MyOperationDataSoapOperation(myOperationDataRequest);

...and the initial Receive operation in the BPEL (in a different Service Assembly - this might be a factor), which was the earliest I could place a log message. The delay in there was as long as 4-5 minutes, and seemed to be driven by the size of the request payload (about 2 MBs, large but not huge).

According to VisualVM, a great tool by the way, the process was spending a large amount of time in this method:

...Which was interesting, but did not help me determine a course of action. In the end, I replaced the jaxb-style code with code that calls the web service using XMLBeans and javax.xml.soap.* classes only. I was unable to get the JAXB version of this call to hit the actually service with less than about a 5 minute delay, with the "large" payload I'm using. The equivalent part of this new call happens in .2 seconds (that's point-two). I don't know the repercussions of doing this sort of call vs. the web service client generated by Netbeans, or of having the XML Beans classes in the environment. It would be nice not to have to introduce this other style into the application. This does seem to confirm some sort of issue in either the jaxb-ws layers, or the HTTP Binding Component, though. I suspect the HTTP-BC because the payload size alone does not seem to cause a problem.

Here's the XMLBeans-style WS client code.

MyOperationDataDocument putCardDataDocument = MyOperationDataDocument.Factory.newInstance();

MyOperationDataResponse.MyOperationDataResponseDocument myOperationDataResponseDocument = MyOperationDataResponse.MyOperationDataResponseDocument.Factory.newInstance();

MyOperationDataDocument.MyOperationData myOperationData = myOperationDataDocument.addNewPutCardData();


SOAPFactory sf = SOAPFactory.newInstance();

SOAPMessage soapMessage = MessageFactory.newInstance().createMessage();

SOAPPart part = soapMessage.getSOAPPart();

SOAPEnvelope soapEnvelope = part.getEnvelope();

SOAPBody body = soapEnvelope.getBody();

org.w3c.dom.Node node = putCardDataDocument.getDomNode();

SOAPBodyElement soapBodyElement = body.addDocument((Document)node);

SOAPConnectionFactory scf = SOAPConnectionFactory.newInstance();

SOAPConnection con = scf.createConnection();

URL endpoint = new URL("http://localhost:9080/MySoapService/MySoapPort");

SOAPMessage reply =, endpoint);


The message and response classes are created using the scomp command line utility that comes bundled with an XMLBeans install. I found surprisingly few examples like the above code online, so I hope this is helpful to someone else down the road.
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 Asus Augmented reality Aurora Famous Fighters auto-awesome Automobile Autos Backups Barack Obama Batman Battery Beards Beer Bell System Berkshire Hathaway Bigfoot Bird Food Bird Toys Birds Birthdays 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 Recipes Recording Industry Association of America Renewable energy RIAA Robot Chicken Rock-paper-scissors Sarcasm SATA 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 Tablet TechCrunch Technical ThinkGeek Toaster Total Recall Transportation Security Administration Unicode United States United States Department of Homeland Security Universal Plug and Play Unknown Primates USB 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