1

I need to extract the activities and their XPath of a BPEL Process out of the xml file.

I'm familiar with the theory behind BPEL but not the fileformat itself. If I read a BPEL file I have difficulties to identify the specific activities. Not to speak of the XPath.

How do I parse a BPEL file in a way that I get every activity, no mather what orchestration type, and its XPath?

ps: in java

EDIT: what I want to extract

<name>CallService1Op2</name>
<xpath>/process/sequence[1]/invoke[1]</xpath>

(the xml-tags are not actually in the xml. it's just for pointing out what I want.)

From the following bpel:sequence

    <bpel:sequence name="main">

        <!-- Receive input from requester. 
             Note: This maps to operation defined in LoadProcess.wsdl 
             -->
        <bpel:receive name="receiveInput" partnerLink="client"
                 portType="tns:LoadProcess"
                 operation="process" variable="input"
                 createInstance="yes"/>

        <!-- Generate reply to synchronous request -->
        <bpel:assign validate="no" name="Assign">


            <bpel:copy>
                <bpel:from><bpel:literal><impl:callService2 xmlns:impl="http://loadWS.iaas.unistuttgart.de" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <impl:sleepMiliSeconds>0</impl:sleepMiliSeconds>
</impl:callService2>
</bpel:literal></bpel:from>
                <bpel:to variable="Service1PLRequest" part="parameters"></bpel:to>
            </bpel:copy>
            <bpel:copy>
                <bpel:from part="payload" variable="input">
                    <bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[tns:input]]></bpel:query>
                </bpel:from>
                <bpel:to part="parameters" variable="Service1PLRequest">
                    <bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[ns:sleepMiliSeconds]]></bpel:query>
                </bpel:to>
            </bpel:copy>
        </bpel:assign>
        <bpel:invoke name="CallService1Op2" partnerLink="Service1PL" operation="callService2" portType="ns:Service1" inputVariable="Service1PLRequest" outputVariable="Service1PLResponse"></bpel:invoke>
        <bpel:assign validate="no" name="Assign1">
            <bpel:copy>
                <bpel:from><bpel:literal><tns:LoadProcessResponse xmlns:tns="de.unistuttgart.iaas.bpel.loadProcess" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <tns:result>tns:result</tns:result>
</tns:LoadProcessResponse>
</bpel:literal></bpel:from>
                <bpel:to variable="output" part="payload"></bpel:to>
            </bpel:copy>
            <bpel:copy>
                <bpel:from part="parameters" variable="Service1PLResponse">
                    <bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[ns:callService2Return]]></bpel:query>
                </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>
        </bpel:assign>
        <bpel:reply name="replyOutput" 
               partnerLink="client"
               portType="tns:LoadProcess"
               operation="process" 
               variable="output"
               />
    </bpel:sequence>

the above is a quite simple example. the xpath more often looks like

/process/sequence[1]/sequence[1]/repeatUntil[1]/sequence[1]/invoke[1]

because the activity is nested into squences, flows, loops, ifs or what not.

EDIT2:

Usecase: BPEL Process is running on Apache-ODE. Apache-ODE puts out events for start/stop/whatever of a Process/Activity. The event contains only the XPath. But I want to see the name, so I have to match against the XPath.

snippl
  • 235
  • 1
  • 2
  • 13
  • Is there a use case for this? did you try using a bpel lib? As for your question, you just want to have the list of activities with no order? Or do you want to keep the structure? and what do you want to extract exactly? – florent Dec 13 '12 at 12:26
  • Usecase: BPEL Process is running on Apache-ODE. Apache-ODE puts out events for start/stop/whatever of a Process/Activity. The event contains only the XPath. But I want to see the name, so I have to match it with something. The order is not important. I want to extract the activity name and it's XPath (edited my question). – snippl Dec 13 '12 at 13:27
  • can you add a sample BPEL together with what you want to extract? That would help :) – florent Dec 13 '12 at 13:48
  • so you want to find the activity by name and then get their xpath locator? right? – florent Dec 13 '12 at 16:29
  • I want to get the name and xpath of every activity. I don't know either. – snippl Dec 13 '12 at 17:19
  • Possible copy of this http://stackoverflow.com/questions/2495740/how-to-parse-wsdl-in-java/10024407#10024407 – Sree Dec 18 '12 at 17:04
  • I hope that can help. However I'm not too sure because wsdl != bpel. It's both xml, but bpel is not at all as straight forward as wsdl. – snippl Dec 18 '12 at 17:15

1 Answers1

1

I think you should chek this post: Get Xpath from the org.w3c.dom.Node

Also in it is mentionned this lib: http://code.google.com/p/joox/ which seems useful

What I'd do: A generic Xpath to list all the activity nodes from the xml. Then using Dom or the joox lib if it works well for you (disclaimer, not tested) you get the name and an xpath string...

Hope this helps

Community
  • 1
  • 1
florent
  • 801
  • 4
  • 17
  • I'd like too use jOOX. I even found through your link an example [Generate/get xpath from XML node java](http://stackoverflow.com/questions/4746299/generate-get-xpath-from-xml-node-java/8943144#8943144). But I can't figure out how to use it properly. – snippl Dec 14 '12 at 15:51