diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2009-02-13 16:00:24 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2009-02-13 16:00:24 +0000 |
commit | 67b28d98f6564c29665cd353532646b59e477b7b (patch) | |
tree | fe613b02516ce72eb5a925cebfbd5bf8e5838076 | |
parent | 7e4905f1f1b4eacdabb84e8539851ce537fb9b66 (diff) |
Partial fix for exceptions for sca clients using text xml wireformat
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@744151 13f79535-47bb-0310-9956-ffa450edef68
2 files changed, 25 insertions, 12 deletions
diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/XMLTextMessageProcessor.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/XMLTextMessageProcessor.java index c453b20c5d..8794f80126 100644 --- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/XMLTextMessageProcessor.java +++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/XMLTextMessageProcessor.java @@ -71,6 +71,15 @@ public class XMLTextMessageProcessor extends AbstractMessageProcessor { } @Override + public Object extractPayloadFromJMSMessage(Message msg) { + if (msg instanceof TextMessage) { + return extractPayload(msg); + } else { + return super.extractPayloadFromJMSMessage(msg); + } + } + + @Override protected Message createJMSMessage(Session session, Object o) { if (session == null) { logger.fine("no response session to create message: " + String.valueOf(o)); @@ -116,4 +125,5 @@ public class XMLTextMessageProcessor extends AbstractMessageProcessor { return super.createFaultMessage(session, o); } } + } diff --git a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLReferenceInterceptor.java b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLReferenceInterceptor.java index c40429d836..adf3fda98c 100644 --- a/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLReferenceInterceptor.java +++ b/branches/sca-java-1.x/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLReferenceInterceptor.java @@ -21,31 +21,23 @@ package org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml.runtime; -import java.util.Map; - -import javax.jms.DeliveryMode; import javax.jms.JMSException; import javax.jms.Session; +import javax.xml.namespace.QName; -import org.apache.tuscany.sca.assembly.Reference; -import org.apache.tuscany.sca.assembly.WireFormat; +import org.apache.axiom.om.OMElement; import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext; import org.apache.tuscany.sca.binding.jms.impl.JMSBinding; import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants; import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException; -import org.apache.tuscany.sca.binding.jms.provider.JMSBindingServiceBindingProvider; import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessor; import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessorUtil; import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory; import org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml.WireFormatJMSTextXML; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.interfacedef.java.JavaInterface; +import org.apache.tuscany.sca.interfacedef.util.FaultException; import org.apache.tuscany.sca.invocation.Interceptor; import org.apache.tuscany.sca.invocation.Invoker; import org.apache.tuscany.sca.invocation.Message; -import org.apache.tuscany.sca.runtime.ReferenceParameters; -import org.apache.tuscany.sca.runtime.RuntimeComponentReference; -import org.apache.tuscany.sca.runtime.RuntimeComponentService; import org.apache.tuscany.sca.runtime.RuntimeWire; /** @@ -104,9 +96,20 @@ public class WireFormatJMSTextXMLReferenceInterceptor implements Interceptor { public Message invokeResponse(Message msg) { if (msg.getBody() != null){ - Object response = responseMessageProcessor.extractPayloadFromJMSMessage((javax.jms.Message)msg.getBody()); + javax.jms.Message jmsMsg = (javax.jms.Message)msg.getBody(); + Object response = responseMessageProcessor.extractPayloadFromJMSMessage(jmsMsg); if (response != null ){ msg.setBody(response); + try { + if (jmsMsg.getBooleanProperty(JMSBindingConstants.FAULT_PROPERTY)) { + FaultException e = new FaultException("remote exception", response); + OMElement om = (OMElement) response; + e.setFaultName(new QName(om.getNamespace().getNamespaceURI(), om.getLocalName())); + msg.setFaultBody(e); + } + } catch (JMSException e) { + throw new JMSBindingException(e); + } } else { msg.setBody(null); } |