ode-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Grant McDonald <gmcdon...@infocomp.com>
Subject RE: Commented code in StartCatchAction
Date Wed, 09 Aug 2006 02:40:37 GMT
I have replaced the uses of XMLInteractionObject with DescribedValue for
both the fault message and the output message in JbiInvokeAction and that
seems to have solved the problem.  Will raise an issue in ServiceMix.
Thanks for the help.

-----Original Message-----
From: cory [mailto:cory.harper@gmail.com]
Sent: Wednesday, 9 August 2006 5:38 AM
To: ode-dev@incubator.apache.org
Subject: Re: Commented code in StartCatchAction


Hi Grant,

The XMLInteractionObject is stuff that we were going to deprecate,
hence the FormattableValueAdaptor.  I haven't had a chance to look at
the SM integration and trace it all the way through, but could you try
using a DescribedValue object in the BPRuntimeException instead of the
XMLInteractionObject.

-cory

On 8/8/06, Grant McDonald <gmcdonald@infocomp.com> wrote:
> I just did some more investigation and what it ends up as is a
> CannedFormattableValue.  Is this what would be expected from an externally
> received fault message?
>
> -----Original Message-----
> From: Grant McDonald
> Sent: Wednesday, 9 August 2006 2:28 AM
> To: 'ode-dev@incubator.apache.org'
> Subject: RE: Commented code in StartCatchAction
>
>
> I think it's a combination of things:
>
> 1) (In ServiceMix JbiInvokeAction) Initially the faulted external action
is
> transformed into a Document, which is then set on an XMLInteraction object
> and the interaction is added to a BPRuntimeException object which is then
> thrown (this is simplified: read the fault name/part is determined etc
etc):
>
>                 if (me.getFault() != null) {
>                     Document fault;
>                     try {
>                         fault = (Document)
> transformer.toDOMNode(me.getFault());
>                         me.setStatus(ExchangeStatus.DONE);
>                     } catch (Exception e) {
>                         me.setError(e);
>                         throw new ActionSystemException(e);
>                     } finally {
>                         channel.send(me);
>                     }
>                     Element e = fault.getDocumentElement();
>                     // Try to determine fault name
>                     String faultName = e.getLocalName();
>                     String partName = BPEComponent.PART_PAYLOAD;
>                     QName elemName = new QName(e.getNamespaceURI(),
> e.getLocalName());
>                     if (wsdlOperation != null) {
>                         for (Iterator itFault =
> wsdlOperation.getFaults().values().iterator(); itFault.hasNext();) {
>                             Fault f = (Fault) itFault.next();
>                             Part p = (Part)
> f.getMessage().getParts().values().iterator().next();
>                             if (elemName.equals(p.getTypeName())) {
>                                 faultName = f.getName();
>                                 partName = p.getName();
>                             }
>                         }
>                     }
>                     BPRuntimeException bpre = new
> BPRuntimeException(faultName, "");
>                     bpre.setNameSpace(e.getNamespaceURI());
>                     XMLInteractionObject interaction = new
> XMLInteractionObject();
>                     interaction.setDocument(fault);
>                     bpre.addPartMessage(partName, interaction);
>                     throw bpre;
>                 } else {
>                     try {
>                         nm = me.getMessage("out");
>                         if (nm != null) {
>                             XMLInteractionObject result = new
> XMLInteractionObject();
>                             result.setDocument((Document)
> transformer.toDOMNode(nm));
>                             output.put(outputPartName, result);
>                         }
>                         me.setStatus(ExchangeStatus.DONE);
>                     } catch (Exception e) {
>                         me.setError(e);
>                         throw new ActionSystemException(e);
>                     } finally {
>                         channel.send(me);
>                     }
>                 }
>             } else if (me.getStatus() == ExchangeStatus.ERROR) {
>                 // Extract error
>                 Exception error = me.getError();
>                 throw new BPRuntimeException("Unknown", error);
>             }
>
> 2) Coming back out of BPE again we attempt to load the payload in the
> following manner:
>
>     protected Source getSourceFromPayload(Object payload) {
>         Source inputSource;
>         if (payload instanceof IFormattableValue) {
>             IFormattableValue value = (IFormattableValue) payload;
>             if (value.supportsGetValueAs(Document.class)) {
>                 Document doc = (Document)
value.getValueAs(Document.class);
>                 inputSource = new DOMSource(doc);
>             } else if (value.supportsGetValueAs(byte[].class)) {
>                 byte[] data = (byte[]) value.getValueAs(byte[].class);
>                 inputSource = new BytesSource(data);
>             } else if (value.supportsGetValueAs(String.class)) {
>                 String data = (String) value.getValueAs(String.class);
>                 inputSource = new StringSource(data);
>             } else {
>                 throw new UnsupportedOperationException("Unable to
retrieve
> value");
>             }
>         } else if (payload instanceof Document) {
>             inputSource = new DOMSource((Document) payload);
>         } else if (payload instanceof byte[]) {
>             inputSource = new BytesSource((byte[]) payload);
>         } else if (payload instanceof String) {
>             inputSource = new StringSource((String) payload);
>         } else {
>             throw new UnsupportedOperationException("Unable to retrieve
> value");
>         }
>         return inputSource;
>     }
>
> In this case the payload (which is the payload of the faultHandlers
> variable) implements IFormattableValue and in actual fact is an instance
> FormattableValueAdapter (I added logging to check this). What's strange is
> that although the value is initially created as a Document object it
doesn't
> return true to the supportedGetValueAs method. The only way I could fudge
it
> was for the else case was to use the value.toString() to generate a string
> response out of the object (which was in actual fact an xml message).
>
> I don't know if any of this sheds some light on the situation or not. Can
> you tell me how these Interaction objects fit into the picture?
>
> -Grant
>
>
>
> -----Original Message-----
> From: cory [mailto:cory.harper@gmail.com]
> Sent: Wednesday, 9 August 2006 2:11 AM
> To: ode-dev@incubator.apache.org
> Subject: Re: Commented code in StartCatchAction
>
>
> It's a bug that the catch by fault type was never fully implemented.
> I think the commented out code in the StartCatchAction is a remnant
> from an attempt to implement the catch by fault type.  Do you think
> the exception your are seeing is related to the catch by fault type
> bug?  Is your invoke in the fault handler trying to access a variable
> that is not initialized or out of scope?
>
> -cory
>
> On 8/8/06, Grant McDonald <gmcdonald@infocomp.com> wrote:
> > Hi,
> >
> > My colleagues and I have been using the BPE subproject from Apache ODE
> > integrated with ServiceMix for some time now.  During the development of
> our
> > BPEL flows it became obvious that the contents of fault messages is not
> > properly available to faultHandlers and results in the following
> stacktrace:
> >
> > java.lang.UnsupportedOperationException: Unable to retrieve value
> >         at
> >
>
org.apache.servicemix.bpe.external.JbiInvokeAction.getSourceFromPayload(JbiI
> > nvokeAction.java:276)
> >         at
> >
>
org.apache.servicemix.bpe.external.JbiInvokeAction.execute(JbiInvokeAction.j
> > ava:179)
> >         at
> >
>
org.apache.ode.bpe.action.bpel.ExternalServiceAction.execute(ExternalService
> > Action.java:230)
> >         at
> >
>
org.apache.servicemix.bpe.external.JbiExternalAction.execute(JbiExternalActi
> > on.java:129)
> >         at
> >
>
org.apache.ode.bpe.engine.ProcessInstance.executeActions(ProcessInstance.jav
> > a:359)
> >         at
> >
>
org.apache.ode.bpe.engine.ProcessInstance.evaluate(ProcessInstance.java:325)
> >         at
> >
>
org.apache.ode.bpe.engine.ProcessInstance.evaluate(ProcessInstance.java:414)
> >         at
> >
>
org.apache.ode.bpe.engine.ProcessInstance.processInternalEvent(ProcessInstan
> > ce.java:254)
> >         at
> >
>
org.apache.ode.bpe.engine.ProcessInstance.processEvent(ProcessInstance.java:
> > 209)
> >         at
> >
>
org.apache.ode.bpe.scope.service.impl.FCScopeInstanceImpl.executeProcess(FCS
> > copeInstanceImpl.java:392)
> >         at
> >
>
org.apache.ode.bpe.scope.service.impl.FCScopeInstanceImpl.handleFault(FCScop
> > eInstanceImpl.java:531)
> >         at
> >
>
org.apache.ode.bpe.engine.ProcessInstance.processInternalEvent(ProcessInstan
> > ce.java:287)
> >         at
> >
>
org.apache.ode.bpe.engine.ProcessInstance.processEvent(ProcessInstance.java:
> > 209)
> >         at
> >
>
org.apache.ode.bpe.correlation.CorrelationService.createInstanceAndRoute(Cor
> > relationService.java:231)
> >         at
> >
>
org.apache.ode.bpe.correlation.CorrelationService.correlateEvent(Correlation
> > Service.java:338)
> >         at
> >
>
org.apache.ode.bpe.bped.unmanaged.EventDirectorSLImpl.sendEvent(EventDirecto
> > rSLImpl.java:116)
> >         at
> > org.apache.servicemix.bpe.BPEEndpoint.process(BPEEndpoint.java:146)
> >
> > <snip>
> >
> > After do some code diving I came across areas of the code I'd like to
ask
> > about:
> >
> > 1) FScopeInstanceImpl - the HashMap which contains the faultHandlers
keyed
> > by faultType is never actually populated by fault type since the
> > addFaultHandler method is only called from StartScopeAction which
> populates
> > the faultType as "" (and hence the ServiceMix integration layer does not
> > populate the faultType on the BPRuntimeException). Was this a planned
> > implementation that never got finished?
> >
> > 2) StartCatchAction - this class has commented out code that deals with
> > faultTypes created on the faultHandler and the creation of an
Interaction
> to
> > hold the faultMessage contents instead of using the straight data
object.
> > Was this also an area that was yet to be fully implemented? What was the
> > intention of the commented out code and was there some caveat with the
> > approach that was previously being taken?
> >
> > I am aware that the majority of work is being done in trunk now as PXE
and
> > BPE have been subsumed into ODE now. Any help would be appreciated in
this
> > area.
> >
> > Kind regards,
> >
> > Grant McDonald
> >
> >
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message