Oracle’s BPEL example ‘StockQuoteService’ is not working correctly

Just for those going through the examples of Oracle BPEL that are delivered with the SOA Suite There is a minor issue with the supplied service ‘StockQuoteService’ which is in the ‘/samples/tools’ directory and is used in some of the supplied tutorials. If you run this service, it will always return ‘0.00’, for every symbol.
This is caused by the Java code that is used in the StockQuiteService.bpel file. If you view the source of this file you will see somewehere in the file the line:
String symbol = el.getNodeValue();
This always returns ‘null’ since the nodeValue of an element is ‘null’ by definition. See the javadoc of the w3c Element object. By modifying the code to:
String symbol = el.getFirstChild().getNodeValue();
you will get the expected result for an existing symbol.

About Pascal Alma

Pascal is a senior software developer and architect. Pascal has been designing and building applications since 2001. He is particularly interested in Open Source toolstack (Mule, Spring Framework, JBoss) and technologies like Web Services, SOA and Cloud technologies. Lately he is having great fun by building iOS apps with Swift. Specialties: JEE AWS XML/XSD/XSLT Web Services/SOA Mule ESB/ WSO2 ESB Maven Cloud Technology Swift/ iOS
This entry was posted in BPEL and tagged . Bookmark the permalink.