6 Replies Latest reply: Feb 27, 2012 2:14 AM by Karthikeyan RS RSS

Calling java method in BPEL assign step

Karthikeyan RS Newbie

I need your valuable support for the below issues. Kindly provide any possible solution

 

My queries :

  We have used JCAPS and developed bpel2.0 processes.Now we need to convert those into JBoss bpel using this JBDStudio.

I am facing below  issues while converting,

 

  1. ) We Used the xmlns:sxxf=http://www.sun.com/wsbpel/2.0/process/executable/SUNExtension/XPathFunctions reff imported in my bpel:process and we called the below functions in my copy assign

   <bpel:copy>

<bpel:from> sxxf:current-dateTime()</bpel:from>

            <bpel:to part="payload" variable="output">

<bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[tns:result]]></bpel:query>

</bpel:to>

</bpel:copy>

 

But in JBDStudio I am getting the Unknown function "sxxf:current-dateTime" used in <bpel:from>

 

  1. ) I have a java class as a jar and placed in the D:\Jboss\jboss-soa-p-5\jboss-as\server\default\lib in my server location.

Now I am trying to call the one method which is there in the java class like below,

<bpel:copy xmlns:addQuery="java://com.emdeon.poc.java.TstEmpJavaClass">

<bpel:from>addQuery:display()</bpel:from>

            <bpel:to part="payload" variable="output">

<bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[tns:result]]></bpel:query>

</bpel:to>

</bpel:copy>

 

Same error I am getting in design time. While run time I am getting error below,

 

17:10:31,583 INFO  [ASSIGN] Assignment Fault: {http://docs.oasis-open.org/wsbpel/2.0/process/executable}selectionFailure,lineNo=78,faultExplanation=An exception occured while evaluating "{OXPath10Expression addQuery:display()}": No Such Function display

 

But the above two things are working well in the JCAPS and glassfish server.

 

Please provide the possible solutions , how can I achieve in the JBoss riftsaw. I am using JBoss SOA 5 platform as server.

  • 1. Re: Calling java method in BPEL assign step
    Jeff Yu Master

    Hi,

     

    For the 1st question, this thread (http://mail-archives.apache.org/mod_mbox/ode-user/201008.mbox/%3CAANLkTinLG1dkC9N0b6M5G-sqosraGpmx9_POqGDGXnaT@mail.gmail.com%3Euser/201008.mbox/%3CAANLkTinLG1dkC9N0b6M5G-sqosraGpmx9_POqGDGXnaT@mail.gmail.com%3E) might be of your interest.

     

    In terms of invoking a java class from RiftSaw, I don't think it is doable right now. Why not expose that java class as JAX-WS web service, and then invoke it via web service way.

     

    Hope It Helps.

    Jeff

  • 2. Re: Calling java method in BPEL assign step
    Jeff Yu Master

    Just to let you know, the above two (your original version) are the SUNExtension, so it is not in the BPEL 2.0 spec. Therefore, they are vendor specific.

     

    Regards

    Jeff

  • 3. Re: Calling java method in BPEL assign step
    Karthikeyan RS Newbie

    Thanks Jeff.

    So suppose if i use my custion class and invoking any method inside the class how should i need to do? Where should place my classes in server path location?

    Whethere should need make it as a java class jar or in any other way?

     

    We can expose the java class as a webservice, but as per my requirent i can use only java code only.Once its working than i will update the same to my peers.

     

    Kindly help me.

     

    Regards,

    karthick

  • 4. Re: Calling java method in BPEL assign step
    Karthikeyan RS Newbie

    Again Thanks Jeff,

     

    Your correct thats SUNExtension only.So where can i find the same functionality in Apache ODE or in RiftSaw.

    Kindly provide the extension.

     

    Regards,

    Karthick

  • 5. Re: Calling java method in BPEL assign step
    Jeff Yu Master

    Hi Karthick,

     

    This link might be of your interest.. http://www.intalio.org/confluence/display/PXE/Custom+XPath+Functions

     

    You also can look up the thread on the ode user mailing list: such as: http://mail-archives.apache.org/mod_mbox/ode-user/201202.mbox/browser

     

    Regards

    Jeff

  • 6. Re: Calling java method in BPEL assign step
    Karthikeyan RS Newbie

    Hi Jeff,

     

    Thanks for your support.

    I have used the same but when invoke the service using SOAP UI Tool i am getting the below error message,

     

    12:07:53,185 INFO  [STDOUT] Retrieving document at 'file:/D:/Jboss/jboss-soa-p-5/jboss-as/server/default/deploy/EMP_Java_Process-20120227120745.jar/empjavaprocessArtifacts.wsdl'.

    12:07:53,340 INFO  [WatchDog] [Endpoint files for {DeploymentUnit EMP_Java_Process-20120227120745}] updated

    12:07:55,336 INFO  [ASSIGN] Assignment Fault: {http://docs.oasis-open.org/wsbpel/2.0/process/executable}selectionFailure,lineNo=78,faultExplanation=An exception occured while evaluating "{OXPath10Expression ext:display()}": Error while executing an XPath expression: net.sf.saxon.trans.XPathException: XPath syntax error at char 13 in {ext:display()}:

        Cannot find a matching 0-argument function named {java:com.example.xpath.Random}display()

     

     

    My Java Class is

    public class TstEmpJavaClass {

     

     

              public static void display(){

                        System.out.println("This is Process");

              }

     

              public static void main(String arg[]){

     

              }

    }

     

    I have created jar and placed in the following location - D:\Jboss\jboss-soa-p-5\jboss-as\server\default\lib

     

    My process step code is below,

     

    <bpel:sequence name="main">

           

            <!-- Receive input from requester.

                 Note: This maps to operation defined in empjavaprocess.wsdl

                 -->

            <bpel:receive name="receiveInput" partnerLink="client"

                     portType="tns:empjavaprocess"

                     operation="process" variable="input"

                     createInstance="yes"/>

           

            <!-- Generate reply to synchronous request -->

            <bpel:assign validate="no" name="assign">

     

     

                <bpel:copy xmlns:ext="java:com.example.xpath.Random">

                    <bpel:from expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0">ext:display()</bpel:from>              

                    <bpel:to variable="myVar">

                        <bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[tns:input]]></bpel:query>

                    </bpel:to>

                </bpel:copy>

            </bpel:assign>

            <bpel:reply name="replyOutput"

                   partnerLink="client"

                   portType="tns:empjavaprocess"

                   operation="process"

                   variable="output"

                   />

        </bpel:sequence>

     

     

    Regards,

    Karthick.