Hi Milinda,
thank you for your answer and your kind offer. Using an ESB could help
me solve the problem although it's not very elegant.
Luckily one can do it also in another way. I finally succeeded to read
and set soap headers without any knowledge in advance with the help of
XPath.
If anyone encounters the same problem, the following snippet does the
job (first read the incoming headers, then set those in the outgoing
message):
<bpel:forEach counterName="counter" parallel="no">
<bpel:startCounterValue>"1"</bpel:startCounterValue>
<bpel:finalCounterValue>count($input.payload/../../*...@headerpart="true"])</bpel:finalCounterValue>
<bpel:scope>
<bpel:sequence>
<bpel:assign>
<bpel:copy ignoreMissingFromData="yes">
<bpel:from
queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0">
ode:insert-as-first-into($output.payload/../..,
$input/*...@headerpart="true"][$counter])
</bpel:from>
<bpel:to>$output.payload/../..</bpel:to>
</bpel:copy>
</bpel:assign>
</bpel:sequence>
</bpel:scope>
</bpel:forEach>
Note however that this solution is bound to ODE interals, this may not
work with other BPEL engines!
Cheers,
Markus
On Wed, Jul 14, 2010 at 1:39 PM, Milinda Pathirage
<[email protected]> wrote:
> I think you can copy all the incoming headers to the outgoing call and place
> ESB(Apache Synapse or Alternative) in-between external service and BPEL
> process to manipulate the headers. If this approach is good for you and you
> want to know more information on this, please reply back to this thread.
>
> Thanks
> Milinda
>
> On Mon, Jul 5, 2010 at 4:19 PM, Markus Piff <[email protected]> wrote:
>
>> Hi Łukasz,
>>
>> thanks for your answer.
>> The article is about dynamic headers, which have the restriction to
>> know in advance which headers are present in the incoming message. In
>> your case you know that the ProcessId header is set. You can't simply
>> copy all header elements to a variable unless you know which are
>> present.
>>
>> Unfortunately I need to access all soap headers without the knowledge
>> which are present. Hints, anyone?
>>
>> Cheers,
>> Markus
>>
>> On Mon, Jul 5, 2010 at 12:37 PM, Łukasz Budnik <[email protected]>
>> wrote:
>> > Hi Markus,
>> >
>> > Take a look at this:
>> >
>> http://jee-bpel-soa.blogspot.com/2009/07/manipulating-soap-headers-in-apache-ode.html
>> >
>> > Hope this solves your problem :)
>> >
>> > cheers,
>> > Łukasz
>> >
>> > On 5 July 2010 12:23, Markus Piff <[email protected]> wrote:
>> >> Hi,
>> >>
>> >> according to
>> http://mail-archives.apache.org/mod_mbox/ode-commits/200803.mbox/%[email protected]%3e
>> >>
>> >> the extension urn:ode.apache.org/axis2-il/headers/ has been removed
>> >> two years ago. Has anybody any information on this?
>> >> All I need is get access to soap headers, read them and set them again
>> >> for another call (without knowing which headers are present).
>> >>
>> >> Cheers,
>> >> Markus
>> >>
>> >> On Sat, Jul 3, 2010 at 9:34 PM, Markus Piff <[email protected]>
>> wrote:
>> >>> Hi,
>> >>>
>> >>> I'm currently implementing a process which uses the incoming soap
>> >>> headers as the soap headers for the invocation of a webservice.
>> >>>
>> >>> Simply put:
>> >>>
>> >>> Client --> Process --> Webservice
>> >>>
>> >>> So the client provides some headers to the process, which are being
>> >>> used as the headers for the invocation of another webservice.
>> >>> However since custom headers may be transferred as well (which are not
>> >>> known in advance), I can't use the standard dynamic headers, or can I?
>> >>>
>> >>> Luckily some ODE extensions seem to exist (
>> http://ode.apache.org/assign.html):
>> >>>
>> >>> urn:ode.apache.org/axis2-il/headers/
>> >>> name: in
>> >>> name: out
>> >>>
>> >>> <bpel:assign>
>> >>> <bpel:copy>
>> >>> <bpel:from variable="input"
>> part="payload"
>> >>> extension="urn:ode.apache.org/axis2-il/headers/:in"/>
>> >>> <bpel:to variable="output"
>> part="payload"
>> >>> extension="urn:ode.apache.org/axis2-il/headers/:out"/>
>> >>> </bpel:copy>
>> >>> </bpel:assign>
>> >>>
>> >>> However this doesn't seem to work either. I always keep getting an
>> error.
>> >>>
>> >>> Without providing a part or header attribute, the file won't even
>> >>> compile, therefore I assume that any input may be valid (part payload
>> >>> exists btw)?
>> >>> Invoking gives me the following error:
>> >>>
>> >>> FATAL - GeronimoLog.fatal(120) | Internal Error
>> >>> org.apache.ode.bpel.iapi.BpelEngineException:
>> >>> java.lang.RuntimeException: java.lang.IllegalArgumentException: null
>> >>> name
>> >>> at
>> org.apache.ode.bpel.engine.ODEProcess.doInstanceWork(ODEProcess.java:490)
>> >>> at
>> org.apache.ode.bpel.engine.ODEProcess.invokeProcess(ODEProcess.java:293)
>> >>> at
>> org.apache.ode.bpel.engine.MyRoleMessageExchangeImpl.doInvoke(MyRoleMessageExchangeImpl.java:122)
>> >>> at
>> org.apache.ode.bpel.engine.UnreliableMyRoleMessageExchangeImpl$1.call(UnreliableMyRoleMessageExchangeImpl.java:44)
>> >>> at
>> org.apache.ode.bpel.engine.UnreliableMyRoleMessageExchangeImpl$1.call(UnreliableMyRoleMessageExchangeImpl.java:1)
>> >>> at
>> org.apache.ode.bpel.engine.ODEProcess$ProcessCallable.call(ODEProcess.java:1206)
>> >>> at
>> org.apache.ode.bpel.engine.Contexts.execTransaction(Contexts.java:106)
>> >>> at
>> org.apache.ode.bpel.engine.BpelServerImpl$TransactedCallable.call(BpelServerImpl.java:968)
>> >>> at
>> org.apache.ode.bpel.engine.BpelServerImpl$ServerCallable.call(BpelServerImpl.java:948)
>> >>> at
>> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
>> >>> at java.util.concurrent.FutureTask.run(FutureTask.java:138)
>> >>> at
>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>> >>> at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>> >>> at java.lang.Thread.run(Thread.java:619)
>> >>> Caused by: java.lang.RuntimeException:
>> >>> java.lang.IllegalArgumentException: null name
>> >>> at
>> org.apache.ode.jacob.vpu.JacobVPU$JacobThreadImpl.run(JacobVPU.java:464)
>> >>> at org.apache.ode.jacob.vpu.JacobVPU.execute(JacobVPU.java:139)
>> >>> at
>> org.apache.ode.bpel.rtrep.v2.RuntimeInstanceImpl.execute(RuntimeInstanceImpl.java:639)
>> >>> at
>> org.apache.ode.bpel.engine.BpelRuntimeContextImpl.execute(BpelRuntimeContextImpl.java:595)
>> >>> at
>> org.apache.ode.bpel.engine.BpelRuntimeContextImpl.executeCreateInstance(BpelRuntimeContextImpl.java:583)
>> >>> at
>> org.apache.ode.bpel.engine.ODEProcess.executeCreateInstance(ODEProcess.java:373)
>> >>> at
>> org.apache.ode.bpel.engine.ODEProcess$2.call(ODEProcess.java:295)
>> >>> at
>> org.apache.ode.bpel.engine.ODEProcess$2.call(ODEProcess.java:1)
>> >>> at
>> org.apache.ode.bpel.engine.ODEProcess$ProcessCallable.call(ODEProcess.java:1206)
>> >>> at
>> org.apache.ode.bpel.engine.BpelInstanceWorker.doInstanceWork(BpelInstanceWorker.java:174)
>> >>> at
>> org.apache.ode.bpel.engine.BpelInstanceWorker.execInCurrentThread(BpelInstanceWorker.java:108)
>> >>> at
>> org.apache.ode.bpel.engine.ODEProcess.doInstanceWork(ODEProcess.java:487)
>> >>> ... 13 more
>> >>> Caused by: java.lang.IllegalArgumentException: null name
>> >>> at
>> org.apache.ode.utils.DOMUtils.findChildByName(DOMUtils.java:745)
>> >>> at
>> org.apache.ode.utils.DOMUtils.findChildByName(DOMUtils.java:738)
>> >>> at
>> org.apache.ode.bpel.rtrep.v2.ASSIGN.evalRValue(ASSIGN.java:181)
>> >>> at org.apache.ode.bpel.rtrep.v2.ASSIGN.copy(ASSIGN.java:353)
>> >>> at org.apache.ode.bpel.rtrep.v2.ASSIGN.run(ASSIGN.java:76)
>> >>> at sun.reflect.GeneratedMethodAccessor36.invoke(Unknown Source)
>> >>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>> >>> at java.lang.reflect.Method.invoke(Method.java:597)
>> >>> at
>> org.apache.ode.jacob.vpu.JacobVPU$JacobThreadImpl.run(JacobVPU.java:451)
>> >>> ... 24 more
>> >>>
>> >>> Any hints?
>> >>>
>> >>> Cheers,
>> >>> Markus
>> >>>
>> >>
>> >
>>
>
>
>
> --
> Milinda Pathirage
> Technical Lead & Product Manager WSO2 BPS; http://wso2.org/bps
> WSO2 Inc.; http://wso2.com
> E-mail: [email protected], [email protected]
> Web: http://mpathirage.com
> Blog: http://blog.mpathirage.com
>