Oracle Service Bus, java callouts with XmlObjects

In the Oracle Service Bus we can make use of java callouts to invoke plain java.
Basically there aren’t any restrictions on the the input and output parameters of the static methods.

There are 2 situations which will differ in the way we get the data returned back from the java callout, see this

Return primitives, Strings or XmlObjects from the java callout.
In this case we can just retrieve the data from the $body variable and execute xpath expressions on it to immediately get the value of the payload.

Return anything else
In this case we will get back a java ref identifier back from the java callout.
Executing xpath expressions on the $body will only give use a reference to the java object
[sourcecode language=”xml”]
< [PipelinePairNode1, PipelinePairNode1_request, stage2, REQUEST] ### debug logging $body ###:

>
[/sourcecode]

To be able to use the data in the java object we can only pass it to other java callouts.

In this blog i will show an example of how to generate a XmlObject, mentioned as one of the return types in case 1.
If we’re able to generate this kind of object from the java callout, OSB will just be able to retrieve this in the $body variable and let us execute xpath expression on it.

1. Create a Java project in Eclipse

We will be using XML Beans to generate the java artifacts based on a Employee schema definition.
These artificats we will be using in our static method to generate the Employee java objects which represents our Employee entity definition from the xsd schema.
Read this and this to get a quickstart on XML Beans.

  1. In Eclipse we will create a new java project with a dependency on the Apache XML Beans library.
    I copied the ORACLE_MIDDLEWARE_HOME\modules\com.bea.core.xml.xmlbeans_2.1.0.0_2-5-1.jar to my lib folder in the project.
    Add the same file as build dependency (libraries) in the project properties.

  2. Create a schemas folder in the root and add the Employee.xsd to it
    [sourcecode language=”xml”]




    Employee entity










    [/sourcecode]
  3. Create a build.xml in the root of the project. I used the one mentioned in the quickstart articles and edited it a bit.
    [sourcecode language=”xml”]
























    [/sourcecode]

    Run the ant build script. Based on the xml namespace of the Employee xsd object it will generate the same package structure for the java objects.
    Verify if it generated the next list of objects

    • nl.xenta.crm.employee.EmployeeDocument
    • nl.xenta.crm.employee.EmployeeType
    • nl.xenta.crm.employee.impl.EmployeeDocumentImpl
    • nl.xenta.crm.employee.impl.EmployeeDocumentImpl

    And if it also generated the file EmployeeXmlBeans.jar in the lib folder.

  4. Next we need to create a static method which will make use of the generated classes.
    Create the next class in the same project

    [sourcecode language=”xml”]
    package nl.xenta.services;

    import org.apache.xmlbeans.XmlObject;

    import nl.xenta.crm.employee.EmployeeDocument;
    import nl.xenta.crm.employee.EmployeeType;
    import nl.xenta.entities.Employee;
    import nl.xenta.entities.Person;

    public class EmployeeService {

    /**
    * Retrieve an employee record based on an employee id and return a XmlObject
    *
    * @param empId
    *
    * @return Employee XmlObject
    */
    public static XmlObject retrieveEmployee(String empId) {
    EmployeeDocument empDoc = EmployeeDocument.Factory.newInstance();
    EmployeeType myEmp = empDoc.addNewEmployee();
    myEmp.setAge(32);
    myEmp.setFirstName(“Eric”);
    myEmp.setLastName(“Elzinga”);

    return myEmp;
    }
    }
    [/sourcecode]

  5. Run the ant build again and this time copy the EmployeeXmlBeans.jar file to your OSB project and refresh the project in Eclipse.
  6. Add the java callout to your proxy service message flow and see the response
  7. Test the proxyservice and see the response in the logging.
    [sourcecode language=”xml”]
    < [PipelinePairNode1, PipelinePairNode1_request, RetrieveEmployee, REQUEST] ### debug, logging my_employee_xml_object ###:
    Eric
    Elzinga
    32
    >
    [/sourcecode]
    1. Now we’re able to retrieve data from the variable just by using the xpath expressions and re-use it in the rest of the message flow.

Share this Post:
Digg Google Bookmarks reddit Mixx StumbleUpon Technorati Yahoo! Buzz DesignFloat Delicious BlinkList Furl

34 Responses to “Oracle Service Bus, java callouts with XmlObjects”

Martin Vergara B. | September 1st, 2011 at 8:54 am
commenter

Awesome, thank a lot for sharing your knowlegde.

commenter

Hi Eric,

Thanks for the nice blog !!

I was trying to do the same as done by you.

I did the same till step 6 and was able to generate all the artifacts required.
I am coming up with a problem at the 7 step while testing the java callout to have xml return .

#########fault coming ##########

BEA-382515

Callout to java method “public static org.apache.xmlbeans.XmlObject nl.xenta.services.EmployeeService.retrieveEmployee(java.lang.String)” resulted in exception: null
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at stages.transform.runtime.JavaCalloutRuntimeStep$1.run(JavaCalloutRuntimeStep.java:173)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:146)
at weblogic.security.Security.runAs(Security.java:61)
at stages.transform.runtime.JavaCalloutRuntimeStep.processMessage(JavaCalloutRuntimeStep.java:195)
at com.bea.wli.sb.pipeline.debug.DebuggerRuntimeStep.processMessage(DebuggerRuntimeStep.java:74)
at com.bea.wli.sb.stages.StageMetadataImpl$WrapperRuntimeStep.processMessage(StageMetadataImpl.java:346)
at com.bea.wli.sb.stages.impl.SequenceRuntimeStep.processMessage(SequenceRuntimeStep.java:33)
at com.bea.wli.sb.pipeline.PipelineStage.processMessage(PipelineStage.java:84)
at com.bea.wli.sb.pipeline.PipelineContextImpl.execute(PipelineContextImpl.java:1055)
at com.bea.wli.sb.pipeline.Pipeline.processMessage(Pipeline.java:141)
at com.bea.wli.sb.pipeline.PipelineContextImpl.execute(PipelineContextImpl.java:1055)
at com.bea.wli.sb.pipeline.PipelineNode.doRequest(PipelineNode.java:55)
at com.bea.wli.sb.pipeline.Node.processMessage(Node.java:67)
at com.bea.wli.sb.pipeline.PipelineContextImpl.execute(PipelineContextImpl.java:1055)
at com.bea.wli.sb.pipeline.Router.processMessage(Router.java:214)
at com.bea.wli.sb.pipeline.MessageProcessor.processRequest(MessageProcessor.java:96)
at com.bea.wli.sb.pipeline.RouterManager$1.run(RouterManager.java:593)
at com.bea.wli.sb.pipeline.RouterManager$1.run(RouterManager.java:591)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:146)
at com.bea.wli.sb.security.WLSSecurityContextService.runAs(WLSSecurityContextService.java:55)
at com.bea.wli.sb.pipeline.RouterManager.processMessage(RouterManager.java:590)
at com.bea.wli.sb.test.service.ServiceMessageSender.send0(ServiceMessageSender.java:332)
at com.bea.wli.sb.test.service.ServiceMessageSender.access$000(ServiceMessageSender.java:79)
at com.bea.wli.sb.test.service.ServiceMessageSender$1.run(ServiceMessageSender.java:137)
at com.bea.wli.sb.test.service.ServiceMessageSender$1.run(ServiceMessageSender.java:135)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:146)
at com.bea.wli.sb.security.WLSSecurityContextService.runAs(WLSSecurityContextService.java:55)
at com.bea.wli.sb.test.service.ServiceMessageSender.send(ServiceMessageSender.java:140)
at com.bea.wli.sb.test.service.ServiceProcessor.invoke(ServiceProcessor.java:454)
at com.bea.wli.sb.test.TestServiceImpl.invoke(TestServiceImpl.java:172)
at com.bea.wli.sb.test.client.ejb.TestServiceEJBBean.invoke(TestServiceEJBBean.java:167)
at com.bea.wli.sb.test.client.ejb.TestService_sqr59p_EOImpl.__WL_invoke(Unknown Source)
at weblogic.ejb.container.internal.SessionRemoteMethodInvoker.invoke(SessionRemoteMethodInvoker.java:40)
at com.bea.wli.sb.test.client.ejb.TestService_sqr59p_EOImpl.invoke(Unknown Source)
at com.bea.wli.sb.test.client.ejb.TestService_sqr59p_EOImpl_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:174)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:345)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:259)
at com.bea.wli.sb.test.client.ejb.TestService_sqr59p_EOImpl_1035_WLStub.invoke(Unknown Source)
at com.bea.alsb.console.test.TestServiceClient.invoke(TestServiceClient.java:174)
at com.bea.alsb.console.test.actions.DefaultRequestAction.invoke(DefaultRequestAction.java:117)
at com.bea.alsb.console.test.actions.DefaultRequestAction.execute(DefaultRequestAction.java:70)
at com.bea.alsb.console.test.actions.ServiceRequestAction.execute(ServiceRequestAction.java:143)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.access$201(PageFlowRequestProcessor.java:97)
at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor$ActionRunner.execute(PageFlowRequestProcessor.java:2044)
at org.apache.beehive.netui.pageflow.interceptor.action.internal.ActionInterceptors.wrapAction(ActionInterceptors.java:91)
at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.processActionPerform(PageFlowRequestProcessor.java:2116)
at com.bea.alsb.console.common.base.SBConsoleRequestProcessor.processActionPerform(SBConsoleRequestProcessor.java:91)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.processInternal(PageFlowRequestProcessor.java:556)
at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.process(PageFlowRequestProcessor.java:853)
at com.bea.alsb.console.common.base.SBConsoleRequestProcessor.process(SBConsoleRequestProcessor.java:191)
at org.apache.beehive.netui.pageflow.AutoRegisterActionServlet.process(AutoRegisterActionServlet.java:631)
at org.apache.beehive.netui.pageflow.PageFlowActionServlet.process(PageFlowActionServlet.java:158)
at com.bea.console.internal.ConsoleActionServlet.process(ConsoleActionServlet.java:262)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at com.bea.console.internal.ConsoleActionServlet.doGet(ConsoleActionServlet.java:134)
at com.bea.alsb.console.common.base.SBConsoleActionServlet.doGet(SBConsoleActionServlet.java:49)
at org.apache.beehive.netui.pageflow.PageFlowUtils.strutsLookup(PageFlowUtils.java:1199)
at org.apache.beehive.netui.pageflow.PageFlowUtils.strutsLookup(PageFlowUtils.java:1129)
at com.bea.portlet.adapter.scopedcontent.ScopedContentCommonSupport.executeAction(ScopedContentCommonSupport.java:687)
at com.bea.portlet.adapter.scopedcontent.ScopedContentCommonSupport.processActionInternal(ScopedContentCommonSupport.java:142)
at com.bea.portlet.adapter.scopedcontent.StrutsStubImpl.processAction(StrutsStubImpl.java:76)
at com.bea.portlet.adapter.NetuiActionHandler.raiseScopedAction(NetuiActionHandler.java:111)
at com.bea.netuix.servlets.controls.content.NetuiContent.raiseScopedAction(NetuiContent.java:181)
at com.bea.netuix.servlets.controls.content.NetuiContent.raiseScopedAction(NetuiContent.java:167)
at com.bea.netuix.servlets.controls.content.NetuiContent.handlePostbackData(NetuiContent.java:225)
at com.bea.netuix.nf.ControlLifecycle$2.visit(ControlLifecycle.java:180)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:324)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walk(ControlTreeWalker.java:130)
at com.bea.netuix.nf.Lifecycle.processLifecycles(Lifecycle.java:395)
at com.bea.netuix.nf.Lifecycle.processLifecycles(Lifecycle.java:361)
at com.bea.netuix.nf.Lifecycle.processLifecycles(Lifecycle.java:352)
at com.bea.netuix.nf.Lifecycle.runInbound(Lifecycle.java:184)
at com.bea.netuix.nf.Lifecycle.run(Lifecycle.java:159)
at com.bea.netuix.servlets.manager.UIServlet.runLifecycle(UIServlet.java:388)
at com.bea.netuix.servlets.manager.UIServlet.doPost(UIServlet.java:258)
at com.bea.netuix.servlets.manager.UIServlet.service(UIServlet.java:199)
at com.bea.netuix.servlets.manager.SingleFileServlet.service(SingleFileServlet.java:251)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at weblogic.servlet.AsyncInitServlet.service(AsyncInitServlet.java:130)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111)
at java.security.AccessController.doPrivileged(Native Method)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)
at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:161)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:136)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class nl.xenta.crm.employee.EmployeeDocument
at nl.xenta.crm.employee.EmployeeDocument$Factory.newInstance(EmployeeDocument.java:45)
at nl.xenta.services.EmployeeService.retrieveEmployee(EmployeeService.java:19)
… 140 more

PipelinePairNode1
PipelinePairNode1_request
stage1
request-pipeline

###########################################
then i tried to test the retrieveEmployee in eclipse by adding a main and calling the retrieveEmployee method and running it but ended up with error like

####################################
Exception in thread “Main Thread” java.lang.ExceptionInInitializerError
at nl.xenta.crm.employee.EmployeeDocument$Factory.newInstance(EmployeeDocument.java:45)
at nl.xenta.services.EmployeeService.retrieveEmployee(EmployeeService.java:19)

Would you please guide me !!

Cheers,
Abhinav Gupta
at nl.xenta.services.EmployeeService.main(EmployeeService.java:29)
Caused by: java.lang.RuntimeException: Cannot load SchemaTypeSystem. Unable to load class with name schemaorg_apache_xmlbeans.system.s272538D6DA7FACDB8DE110C0BE3F1CA4.TypeSystemHolder. Make sure the generated binary files are on the classpath.
at org.apache.xmlbeans.XmlBeans.typeSystemForClassLoader(XmlBeans.java:783)
at nl.xenta.crm.employee.EmployeeDocument.(EmployeeDocument.java:20)
… 3 more
Caused by: java.lang.ClassNotFoundException: schemaorg_apache_xmlbeans.system.s272538D6DA7FACDB8DE110C0BE3F1CA4.TypeSystemHolder
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:305)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:246)
at org.apache.xmlbeans.XmlBeans.typeSystemForClassLoader(XmlBeans.java:770)
at nl.xenta.crm.employee.EmployeeDocument.(EmployeeDocument.java:20)
at nl.xenta.crm.employee.EmployeeDocument$Factory.newInstance(EmployeeDocument.java:45)
at nl.xenta.services.EmployeeService.retrieveEmployee(EmployeeService.java:20)
at nl.xenta.services.EmployeeService.main(EmployeeService.java:30)

commenter

Hi Eric ,

I got it working, actually the build jar was not added to the classpath.

Thanks for nice blog, Would be happy to see more in future from you related to OSB and JMS

Abhinav Gupta

commenter

Hi Eric,very good article,t’s so helpful me.I have query.I’m able to publish the event with java class by adding the liabraries like Java EE1.5,JRF API,Oracle XML Parserv2 and Weblogic10.3Remote-Client.But I would like to publish the event with samee java class from the Eclipse but I didn’t find how to add the libraries in Eclipse.And one more thing is when i create the java project in Eclipse it’s not come to the OSB configuration,due to this I’m unable to invoke the java method by using the java call out.Thanks in Advance

commenter

Don’t you just need to add the libraries to the build path in eclipse like this : http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.jdt.doc.user/reference/ref-properties-build-path.htm
When you created a java project in eclipse you can rightmouseclick on it > export > jar. This jar you just need to store in your osb project.
Make sure you package also all the generated xml beans objects in the jar, otherwise it wont help.

the ant build will package the jar with the generated xmlbean resources, i think you’re missing those in yours.

commenter

Hi Eric,Can u plz tel me how to create build.xml for above schema.
Thanks
Mani

commenter

You can download it from one of the samples of the xmlbeans site, http://xmlbeans.apache.org/samples/index.html#Getting+the+Samples

commenter

Hi Eric,Thanks for reply,I copy the code from blog
when i open the build.xml nothing is there,but when i open it in editplus it’s visible.
After build.xml how to run antbuild based on xml namespace,give me guideline.

Thanks
Mani

[…] this blog on how to send the java object to a java callout and return a XmlObject back. I added the […]

Jhon Jairo Gamboa | March 5th, 2012 at 6:12 pm
commenter

I need return a collection (List) in Java Callout Action, i recive only this content in any variable:

how i do for read or convert to list in OSB message flow ?

my escenary is, excecute un method in java callout, this method recive a colection and return a collection. i cant view estructur in message flow. only view <con:java-content…..

can any help me?

I need your help.
Regards
jgamboita@gmail.com

commenter

i think you need to create a static method with a xmlboject for this to be able to retrieve the list and the xsd will contain the maxOccurs or your array/list element

Jhon Jairo Gamboa | March 6th, 2012 at 9:45 am
commenter

Eric tks, i have static method, this method return a list, in message flow (proxy service) i need read this collection. i only view <con:java-content… in body, how i do for view list content?

commenter

you can’t read the java content..you can only pass it on to some other java callout or for example to a file jca adapter..but you can’t ‘edit’ this data in your proxy service flow. Can’t you change the static method so it returns an xml object which contains the array structure ?

commenter

i dont know. how i do this?
need i convert list to xmlobject? How?
or cant return collection to proxy service and after get data? cant with java callout ?

commenter

what do you want to do with the collection in the proxy service flow? you do the callout and you receive back a list (whether or not it’s a java collection or a xml array), but what’s the next step in your process ?

commenter

In Proxy service i have a stage with a java callout, the metho in java C. need receive a list, after transforming and generate a new list with new data.
after i need return this list in proxy services message flow,
After i need send this list to a route node (WEb services legacy)

the problem is in java callout response variable in proxy S.
i cant view data. i view this :

i cant read data.

commenter

When you do the call to the WEb services legacy you’re talking xml again i assume? (soap + http?). So for that you need to java list response transformed back to the xml representive. Knowing this it’s easier to start with a xsd like this



Comment describing your root element






And use this to generate your xml beans java code. With these generated artifacts you can eassily generate your xmlobject in which the List exists.

Jhon Jairo Gamboa | March 6th, 2012 at 2:36 pm
commenter

OK Erik. im trying undestand you: in resumen i never cant read directly java list(Collection) in java callout response variable? i need generate a xmlobject in java callout for return list in xml format.?

Jhon Jairo Gamboa | March 6th, 2012 at 2:38 pm
commenter

Eric, talking about http soap for send list to web service, that is correct i will send list content in a soap message.

commenter

Well you can read the java response directly, but you can execute any xpath expressions on it. And since you need to transform the java representive to the xml-representive to be able to call the legacy webservice i would not return a java list collection but a xmlobject. Because then when you arrive back in the proxy service from the java callout you already have a xml representive of your list, so you can use xslt/xquery directly to transform the input of your legacy webservice

Jhon Jairo Gamboa | March 6th, 2012 at 2:55 pm
commenter

Erik thank you for your coments and your help, for finish the java callout response variable have this content :

con:java-content ref= jcid : 716fca9e:135e8409ebb:-7f6b

can i convert this?

commenter

You can’t convert it from java to xml in the proxy service itself by use of xslt or xquery

commenter

Hi,

I bought your book and is helped me a lot.

However would like to ask you a thing that is not inside the book but OSB related.

I hava a service that return a soap payload of 4MB ..but when it trasiting OSB due to some xml manipulation (split join merge) the ememory shows 400 MB …

The heap dump confirms this and there are other faceing the same problem

https://kr.forums.oracle.com/forums/thread.jspa?threadID=2125210

My soluton is to do a java callout and to to the merge from splitjoin there and the get back to osb …

What do you say ?

commenter

I read this as well….and it worries me, if true.


OSB uses XmlBeans to “materialize” payload in memory… this is not a very memory-efficient framework, because each payload is represented as a XmlObject, a self describing (hence redundant) object.
My experience is that with the text representation of the object occupying 1 MB, you can occasionally take 100 MB or memory, but this also depends on the structural complexity of the payload.
In any case, OSB is NOT a ETL tool, it’s not meant to handle large (> 10MB) payloads. It behaves well for small (100K) messages, ,but above the 5MB I would be cautious.

thanks

commenter

true, it’s not really ment to transform big chunks of data.
is all the data in the payload needed for ‘transformation’ or just parts of it?

and do you expect a constant stream of big data payload or is this just occuring once in a while. if you expect a lot of big payloads you could think of other better solutions of oracle products which process these kind of message flows in a more performed way.

commenter

Thanks for the answer.Yes i need t modify the request…to merge some results from several backends…unfortunqatey no time and money now for a new oracle product..:( so some workaround i will do…stil 4mb payload to become 400 mb in memory? What it is behind ?

commenter

It is from time to time for certain user profiles.

What worries me is that we do not really need to transform the message rather then merge some responses in a split join.

insert
$splitjoinResponse1/Tag1/Tag2
into
$finalResponse

tag 2 has hundreds of occurences but the whole payload response from each split join business service is around 4MB

4 MB * 4 split join ==> 1.6GB 🙁 when doing this

create a huge consumption of memory + cpu usage

Cheers

Cristian C.

commenter

You don’t have the option to use for example a bpel process to do some orchestration and enrichments.

Otherwise try using some other library instead of xmlbeans and see how it performs. Since you’re a java callout atm, you’re free to go on that side.
See : http://mail-archives.apache.org/mod_mbox/xmlbeans-user/200411.mbox/%3C4159586400014EFE@mta12.wss.scd.yahoo.com%3E what’s causing the memory footprint.

commenter

Will do that and post my findings here in case others will be interested
Thanks.

commenter

OK great! If you need any help just leave a comment again. Have a nice weekend!

commenter

Hi,I have a doubt of somewhat of similar kind,
i created a java project and i m making some DB connection inside the code, the DB connection details are different for different environment, so in order to pick the required DB details i used ExternalPropertiesReader.getProperty(ConfigConstants.CONFIGNAME,ConfigConstants.CONTENTTYPEVALUE)

created a config.xml file and kept properties file in my local machine, if i run the java code its working fine, but if i make a jar file of the java project and put it in Osb service then its giving me the error as below:

Callout to java method “public static java.lang.String uk.co.o2.manageproductregistration.service.RegisterProductImpl.linkIdentity(java.lang.String,java.lang.String)” resulted in exception: null
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at stages.transform.runtime.JavaCalloutRuntimeStep$1.run(JavaCalloutRuntimeStep.java:183)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:146)
at weblogic.security.Security.runAs(Security.java:61)
at stages.transform.runtime.JavaCalloutRuntimeStep.processMessage(JavaCalloutRuntimeStep.java:205)
at com.bea.wli.sb.pipeline.debug.DebuggerRuntimeStep.processMessage(DebuggerRuntimeStep.java:74)
at com.bea.wli.sb.stages.StageMetadataImpl$WrapperRuntimeStep.processMessage(StageMetadataImpl.java:346)
at com.bea.wli.sb.stages.impl.SequenceRuntimeStep.processMessage(SequenceRuntimeStep.java:33)
at com.bea.wli.sb.pipeline.PipelineStage.processMessage(PipelineStage.java:84)
at com.bea.wli.sb.pipeline.PipelineContextImpl.execute(PipelineContextImpl.java:1095)
at com.bea.wli.sb.pipeline.Pipeline.processMessage(Pipeline.java:141)
at com.bea.wli.sb.pipeline.PipelineContextImpl.execute(PipelineContextImpl.java:1095)
at com.bea.wli.sb.pipeline.PipelineNode.doRequest(PipelineNode.java:55)
at com.bea.wli.sb.pipeline.Node.processMessage(Node.java:67)
at com.bea.wli.sb.pipeline.PipelineContextImpl.execute(PipelineContextImpl.java:1095)
at com.bea.wli.sb.pipeline.Router.processMessage(Router.java:214)
at com.bea.wli.sb.pipeline.MessageProcessor.processRequest(MessageProcessor.java:101)
at com.bea.wli.sb.pipeline.RouterManager$1.run(RouterManager.java:597)
at com.bea.wli.sb.pipeline.RouterManager$1.run(RouterManager.java:595)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:146)
at com.bea.wli.sb.security.WLSSecurityContextService.runAs(WLSSecurityContextService.java:55)
at com.bea.wli.sb.pipeline.RouterManager.processMessage(RouterManager.java:594)
at com.bea.wli.sb.test.service.ServiceMessageSender.send0(ServiceMessageSender.java:368)
at com.bea.wli.sb.test.service.ServiceMessageSender.access$000(ServiceMessageSender.java:91)
at com.bea.wli.sb.test.service.ServiceMessageSender$1.run(ServiceMessageSender.java:149)
at com.bea.wli.sb.test.service.ServiceMessageSender$1.run(ServiceMessageSender.java:147)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:146)
at com.bea.wli.sb.security.WLSSecurityContextService.runAs(WLSSecurityContextService.java:55)
at com.bea.wli.sb.test.service.ServiceMessageSender.send(ServiceMessageSender.java:152)
at com.bea.wli.sb.test.service.ServiceProcessor.invoke(ServiceProcessor.java:486)
at com.bea.wli.sb.test.TestServiceImpl.invoke(TestServiceImpl.java:172)
at com.bea.wli.sb.test.client.ejb.TestServiceEJBBean.invoke(TestServiceEJBBean.java:167)
at com.bea.wli.sb.test.client.ejb.TestService_sqr59p_EOImpl.__WL_invoke(Unknown Source)
at weblogic.ejb.container.internal.SessionRemoteMethodInvoker.invoke(SessionRemoteMethodInvoker.java:40)
at com.bea.wli.sb.test.client.ejb.TestService_sqr59p_EOImpl.invoke(Unknown Source)
at com.bea.wli.sb.test.client.ejb.TestService_sqr59p_EOImpl_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:174)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:345)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:259)
at com.bea.wli.sb.test.client.ejb.TestService_sqr59p_EOImpl_1036_WLStub.invoke(Unknown Source)
at com.bea.alsb.console.test.TestServiceClient.invoke(TestServiceClient.java:174)
at com.bea.alsb.console.test.actions.DefaultRequestAction.invoke(DefaultRequestAction.java:117)
at com.bea.alsb.console.test.actions.DefaultRequestAction.execute(DefaultRequestAction.java:70)
at com.bea.alsb.console.test.actions.ServiceRequestAction.execute(ServiceRequestAction.java:157)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.access$201(PageFlowRequestProcessor.java:97)
at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor$ActionRunner.execute(PageFlowRequestProcessor.java:2044)
at org.apache.beehive.netui.pageflow.interceptor.action.internal.ActionInterceptors.wrapAction(ActionInterceptors.java:91)
at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.processActionPerform(PageFlowRequestProcessor.java:2116)
at com.bea.alsb.console.common.base.SBConsoleRequestProcessor.processActionPerform(SBConsoleRequestProcessor.java:91)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.processInternal(PageFlowRequestProcessor.java:556)
at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.process(PageFlowRequestProcessor.java:853)
at com.bea.alsb.console.common.base.SBConsoleRequestProcessor.process(SBConsoleRequestProcessor.java:191)
at org.apache.beehive.netui.pageflow.AutoRegisterActionServlet.process(AutoRegisterActionServlet.java:631)
at org.apache.beehive.netui.pageflow.PageFlowActionServlet.process(PageFlowActionServlet.java:158)
at com.bea.console.internal.ConsoleActionServlet.process(ConsoleActionServlet.java:262)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at com.bea.console.internal.ConsoleActionServlet.doGet(ConsoleActionServlet.java:134)
at com.bea.alsb.console.common.base.SBConsoleActionServlet.doGet(SBConsoleActionServlet.java:49)
at org.apache.beehive.netui.pageflow.PageFlowUtils.strutsLookup(PageFlowUtils.java:1199)
at org.apache.beehive.netui.pageflow.PageFlowUtils.strutsLookup(PageFlowUtils.java:1129)
at com.bea.portlet.adapter.scopedcontent.ScopedContentCommonSupport.executeAction(ScopedContentCommonSupport.java:687)
at com.bea.portlet.adapter.scopedcontent.ScopedContentCommonSupport.processActionInternal(ScopedContentCommonSupport.java:142)
at com.bea.portlet.adapter.scopedcontent.StrutsStubImpl.processAction(StrutsStubImpl.java:76)
at com.bea.portlet.adapter.NetuiActionHandler.raiseScopedAction(NetuiActionHandler.java:111)
at com.bea.netuix.servlets.controls.content.NetuiContent.raiseScopedAction(NetuiContent.java:181)
at com.bea.netuix.servlets.controls.content.NetuiContent.raiseScopedAction(NetuiContent.java:167)
at com.bea.netuix.servlets.controls.content.NetuiContent.handlePostbackData(NetuiContent.java:225)
at com.bea.netuix.nf.ControlLifecycle$2.visit(ControlLifecycle.java:180)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:324)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
at com.bea.netuix.nf.ControlTreeWalker.walk(ControlTreeWalker.java:130)
at com.bea.netuix.nf.Lifecycle.processLifecycles(Lifecycle.java:395)
at com.bea.netuix.nf.Lifecycle.processLifecycles(Lifecycle.java:361)
at com.bea.netuix.nf.Lifecycle.processLifecycles(Lifecycle.java:352)
at com.bea.netuix.nf.Lifecycle.runInbound(Lifecycle.java:184)
at com.bea.netuix.nf.Lifecycle.run(Lifecycle.java:159)
at com.bea.netuix.servlets.manager.UIServlet.runLifecycle(UIServlet.java:388)
at com.bea.netuix.servlets.manager.UIServlet.doPost(UIServlet.java:258)
at com.bea.netuix.servlets.manager.UIServlet.service(UIServlet.java:199)
at com.bea.netuix.servlets.manager.SingleFileServlet.service(SingleFileServlet.java:251)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at weblogic.servlet.AsyncInitServlet.service(AsyncInitServlet.java:130)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:301)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
at java.security.AccessController.doPrivileged(Native Method)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:324)
at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:460)
at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:163)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3730)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3696)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2273)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2179)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1490)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
Caused by: java.lang.NoClassDefFoundError: uk/co/o2/fwk/config/ExternalPropertiesReader
at uk.co.o2.manageproductregistration.service.RegisterProductImpl.getConnection(RegisterProductImpl.java:1113)
at uk.co.o2.manageproductregistration.service.RegisterProductImpl.linkIdentity(RegisterProductImpl.java:833)
… 140 more
Caused by: java.lang.ClassNotFoundException: uk.co.o2.fwk.config.ExternalPropertiesReader
at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:297)
at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:270)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at com.bea.wli.sb.resources.archive.classloader.HookedJarClassLoader.loadClass(HookedJarClassLoader.java:295)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:179)
… 142 more

can anyone tell me how to male this config.xml file working by picking the Db values depending on the different environment.

Leave a Reply:

Name (required):
Mail (will not be published) (required):
Website:
Comment (required):
XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>