Author: richard.opalka(a)jboss.com
Date: 2007-12-14 01:28:41 -0500 (Fri, 14 Dec 2007)
New Revision: 5307
Added:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/jaxws/RMHandlerAbstractBase.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/jaxws/RMHandlerHelper.java
Removed:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/jaxws/RMHandler.java
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMClientSequence.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMSequenceIface.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/common/RMHelper.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/jaxws/RMClientHandler.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/jaxws/RMServerHandler.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/server/RMServerSequence.java
Log:
refactoring handlers
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java 2007-12-13
16:12:38 UTC (rev 5306)
+++
stack/native/trunk/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java 2007-12-14
06:28:41 UTC (rev 5307)
@@ -257,7 +257,8 @@
msgContext.setMessageAbstraction(resMessage);
}
- if ((oneway == false) || (msgContext.get(RMConstant.RESPONSE_CONTEXT) != null))
// RM hack
+ boolean isWsrmMessage = msgContext.get(RMConstant.RESPONSE_CONTEXT) != null;
+ if ((oneway == false) || (isWsrmMessage)) // RM hack
{
// call the response handler chain, removing the fault type entry will not
call handleFault for that chain
handlersPass = callResponseHandlerChain(sepMetaData, handlerType[2]);
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMClientSequence.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMClientSequence.java 2007-12-13
16:12:38 UTC (rev 5306)
+++
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMClientSequence.java 2007-12-14
06:28:41 UTC (rev 5307)
@@ -81,6 +81,7 @@
private AtomicBoolean inboundMessageAckRequested = new AtomicBoolean();
private AtomicLong messageNumber = new AtomicLong();
private AtomicInteger countOfUnassignedMessagesAvailable = new AtomicInteger();
+ private static final String ANONYMOUS_URI =
AddressingBuilder.getAddressingBuilder().newAddressingConstants().getAnonymousURI();
public RMClientSequence(boolean addrType, RMConfig wsrmConfig)
{
@@ -202,6 +203,11 @@
// no need for synchronization
return (this.addressableClient) ? this.backPort : null;
}
+
+ public final String getAcksTo()
+ {
+ return (this.addressableClient) ? this.backPort.toString() : ANONYMOUS_URI;
+ }
public final long newMessageNumber()
{
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMSequenceIface.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMSequenceIface.java 2007-12-13
16:12:38 UTC (rev 5306)
+++
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMSequenceIface.java 2007-12-14
06:28:41 UTC (rev 5307)
@@ -39,5 +39,6 @@
long getLastMessageNumber();
String getInboundId();
long getDuration();
+ String getAcksTo();
Set<Long> getReceivedInboundMessages();
}
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/common/RMHelper.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/common/RMHelper.java 2007-12-13
16:12:38 UTC (rev 5306)
+++
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/common/RMHelper.java 2007-12-14
06:28:41 UTC (rev 5307)
@@ -29,18 +29,13 @@
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.Duration;
import javax.xml.namespace.QName;
-import javax.xml.ws.addressing.AddressingBuilder;
-import javax.xml.ws.addressing.AddressingProperties;
-import javax.xml.ws.addressing.Relationship;
import org.jboss.logging.Logger;
-import org.jboss.ws.extensions.addressing.AddressingClientUtil;
import org.jboss.ws.extensions.addressing.AddressingPropertiesImpl;
import org.jboss.ws.extensions.addressing.metadata.AddressingOpMetaExt;
import org.jboss.ws.extensions.wsrm.RMConstant;
import org.jboss.ws.extensions.wsrm.RMClientSequence;
import org.jboss.ws.extensions.wsrm.api.RMException;
-import org.jboss.ws.extensions.wsrm.jaxws.RMHandler;
import org.jboss.ws.extensions.wsrm.server.RMServerSequence;
import org.jboss.ws.extensions.wsrm.spi.RMConstants;
import org.jboss.ws.extensions.wsrm.spi.RMProvider;
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/jaxws/RMClientHandler.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/jaxws/RMClientHandler.java 2007-12-13
16:12:38 UTC (rev 5306)
+++
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/jaxws/RMClientHandler.java 2007-12-14
06:28:41 UTC (rev 5307)
@@ -21,6 +21,27 @@
*/
package org.jboss.ws.extensions.wsrm.jaxws;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.addressing.JAXWSAConstants;
+import javax.xml.ws.addressing.soap.SOAPAddressingProperties;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.MessageContext.Scope;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.extensions.wsrm.RMConstant;
+import org.jboss.ws.extensions.wsrm.RMSequenceIface;
+import org.jboss.ws.extensions.wsrm.api.RMException;
+import org.jboss.ws.extensions.wsrm.spi.RMConstants;
+import org.jboss.ws.extensions.wsrm.spi.RMProvider;
+import org.jboss.ws.extensions.wsrm.spi.protocol.RMSerializable;
+
/**
* Client WS-RM JAX-WS handler
*
@@ -28,19 +49,91 @@
*
* @since Dec 12, 2007
*/
-public final class RMClientHandler extends RMHandler
+public final class RMClientHandler extends RMHandlerAbstractBase
{
- @Override
- protected boolean isClientSide()
+ private static final RMConstants rmConstants = RMProvider.get().getConstants();
+
+ protected boolean handleOutbound(MessageContext msgContext)
{
+ log.debug("handling outbound message");
+
+ CommonMessageContext commonMsgContext = (CommonMessageContext)msgContext;
+ SOAPAddressingProperties addrProps =
(SOAPAddressingProperties)commonMsgContext.get(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND);
+ Map<String, Object> rmOutboundContext = (Map<String,
Object>)commonMsgContext.get(RMConstant.REQUEST_CONTEXT);
+ List<QName> outMsgs =
(List<QName>)rmOutboundContext.get(RMConstant.PROTOCOL_MESSAGES);
+ Map<QName, RMSerializable> data = new HashMap<QName,
RMSerializable>();
+ String optionalMessageId = (addrProps.getMessageID() != null) ?
addrProps.getMessageID().getURI().toString() : null;
+ rmOutboundContext.put(RMConstant.WSA_MESSAGE_ID, optionalMessageId);
+ rmOutboundContext.put(RMConstant.PROTOCOL_MESSAGES_MAPPING, data);
+ SOAPMessage soapMessage = ((SOAPMessageContext)commonMsgContext).getMessage();
+ RMSequenceIface sequenceImpl =
(RMSequenceIface)rmOutboundContext.get(RMConstant.SEQUENCE_REFERENCE);
+
+ // try to serialize CreateSequence to message
+ serialize(rmConstants.getCreateSequenceQName(), outMsgs, data, soapMessage,
sequenceImpl);
+
+ // try to serialize Sequence to message
+ serialize(rmConstants.getSequenceQName(), outMsgs, data, soapMessage,
sequenceImpl);
+
+ // try to serialize AckRequested to message
+ serialize(rmConstants.getAckRequestedQName(), outMsgs, data, soapMessage,
sequenceImpl);
+
+ // try to serialize CloseSequence to message
+ serialize(rmConstants.getCloseSequenceQName(), outMsgs, data, soapMessage,
sequenceImpl);
+
+ // try to serialize TerminateSequence to message
+ serialize(rmConstants.getTerminateSequenceQName(), outMsgs, data, soapMessage,
sequenceImpl);
+
+ // try to serialize SequenceAcknowledgement to message
+ serialize(rmConstants.getSequenceAcknowledgementQName(), outMsgs, data,
soapMessage, sequenceImpl);
+
+ if ((outMsgs.size() != 0) && (data.size() == 0))
+ throw new RMException("RM handler did not serialize WS-RM message to the
payload");
+
return true;
}
- @Override
- protected boolean isServerSide()
+ protected boolean handleInbound(MessageContext msgContext)
{
- return false;
+ log.debug("handling inbound message");
+
+ SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+
+ // initialize RM response context
+ Map<String, Object> rmResponseContext = new HashMap<String, Object>();
+ List<QName> messages = new LinkedList<QName>();
+ rmResponseContext.put(RMConstant.PROTOCOL_MESSAGES, messages);
+ Map<QName, RMSerializable> data = new HashMap<QName,
RMSerializable>();
+ rmResponseContext.put(RMConstant.PROTOCOL_MESSAGES_MAPPING, data);
+
+ // try to read CreateSequenceResponse from message
+ deserialize(rmConstants.getCreateSequenceResponseQName(), soapMessage, messages,
data);
+
+ // try to read AckRequested from message
+ deserialize(rmConstants.getAckRequestedQName(), soapMessage, messages, data);
+
+ // try to read Sequence from message
+ deserialize(rmConstants.getSequenceQName(), soapMessage, messages, data);
+
+ // try to read SequenceAcknowledgement from message
+ deserialize(rmConstants.getSequenceAcknowledgementQName(), soapMessage, messages,
data);
+
+ // try to read CloseSequence from message
+ deserialize(rmConstants.getCloseSequenceResponseQName(), soapMessage, messages,
data);
+
+ // try to read TerminateSequence from message
+ deserialize(rmConstants.getTerminateSequenceResponseQName(), soapMessage, messages,
data);
+
+ // TODO: implement SequenceFault deserialization
+
+ if (data.size() == 0)
+ throw new RMException("RM handler was not able to find WS-RM message in the
payload");
+
+ // propagate RM response context to higher layers
+ msgContext.put(RMConstant.RESPONSE_CONTEXT, rmResponseContext);
+ msgContext.setScope(RMConstant.RESPONSE_CONTEXT, Scope.APPLICATION);
+
+ return true;
}
}
Deleted:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/jaxws/RMHandler.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/jaxws/RMHandler.java 2007-12-13
16:12:38 UTC (rev 5306)
+++
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/jaxws/RMHandler.java 2007-12-14
06:28:41 UTC (rev 5307)
@@ -1,408 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.extensions.wsrm.jaxws;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.namespace.QName;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.ws.addressing.JAXWSAConstants;
-import javax.xml.ws.addressing.soap.SOAPAddressingProperties;
-import javax.xml.ws.handler.MessageContext;
-import javax.xml.ws.handler.MessageContext.Scope;
-import javax.xml.ws.handler.soap.SOAPMessageContext;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.core.jaxws.handler.GenericSOAPHandler;
-import org.jboss.ws.extensions.wsrm.RMConstant;
-import org.jboss.ws.extensions.wsrm.RMSequenceIface;
-import org.jboss.ws.extensions.wsrm.api.RMException;
-import org.jboss.ws.extensions.wsrm.common.RMHelper;
-import org.jboss.ws.extensions.wsrm.spi.RMConstants;
-import org.jboss.ws.extensions.wsrm.spi.RMMessageFactory;
-import org.jboss.ws.extensions.wsrm.spi.RMProvider;
-import org.jboss.ws.extensions.wsrm.spi.protocol.RMAckRequested;
-import org.jboss.ws.extensions.wsrm.spi.protocol.RMCloseSequence;
-import org.jboss.ws.extensions.wsrm.spi.protocol.RMCloseSequenceResponse;
-import org.jboss.ws.extensions.wsrm.spi.protocol.RMCreateSequence;
-import org.jboss.ws.extensions.wsrm.spi.protocol.RMCreateSequenceResponse;
-import org.jboss.ws.extensions.wsrm.spi.protocol.RMSequence;
-import org.jboss.ws.extensions.wsrm.spi.protocol.RMSequenceAcknowledgement;
-import org.jboss.ws.extensions.wsrm.spi.protocol.RMSerializable;
-import org.jboss.ws.extensions.wsrm.spi.protocol.RMTerminateSequence;
-import org.jboss.ws.extensions.wsrm.spi.protocol.RMTerminateSequenceResponse;
-
-/**
- * TODO: refactor this shared handler code to server/client handlers
- *
- * RM generic JAX-WS handler
- *
- * @author richard.opalka(a)jboss.com
- *
- * @since Oct 23, 2007
- */
-@SuppressWarnings("unchecked")
-public abstract class RMHandler extends GenericSOAPHandler
-{
- protected final Logger log = Logger.getLogger(getClass());
- private static final RMMessageFactory rmFactory =
RMProvider.get().getMessageFactory();
- private static final RMConstants rmConstants = RMProvider.get().getConstants();
- private static final Set headers = RMConstant.PROTOCOL_OPERATION_QNAMES;
-
- public final Set getHeaders()
- {
- return headers;
- }
-
- protected abstract boolean isClientSide();
-
- protected abstract boolean isServerSide();
-
- protected final boolean handleOutbound(MessageContext msgContext)
- {
- log.debug("handling outbound message");
-
- CommonMessageContext commonMsgContext = (CommonMessageContext)msgContext;
- SOAPAddressingProperties addrProps =
(SOAPAddressingProperties)commonMsgContext.get(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND);
- if (addrProps == null)
- throw new RMException("WS-Addressing properties not found in message
context");
-
- String rmContext = isClientSide() ? RMConstant.REQUEST_CONTEXT :
RMConstant.RESPONSE_CONTEXT;
- Map rmOutboundContext = (Map)commonMsgContext.get(rmContext);
- List<QName> outMsgs =
(List<QName>)rmOutboundContext.get(RMConstant.PROTOCOL_MESSAGES);
- Map<QName, RMSerializable> data = new HashMap<QName,
RMSerializable>();
- String optionalMessageId = (addrProps.getMessageID() != null) ?
addrProps.getMessageID().getURI().toString() : null;
- rmOutboundContext.put(RMConstant.WSA_MESSAGE_ID, optionalMessageId);
- rmOutboundContext.put(RMConstant.PROTOCOL_MESSAGES_MAPPING, data);
- SOAPMessage soapMessage = ((SOAPMessageContext)commonMsgContext).getMessage();
- RMSequenceIface sequenceImpl =
(RMSequenceIface)rmOutboundContext.get(RMConstant.SEQUENCE_REFERENCE);
-
- QName msgQName = null;
-
- if (isClientSide())
- {
- msgQName = rmConstants.getCreateSequenceQName();
- if (outMsgs.contains(msgQName))
- {
- // try to serialize CreateSequence to message
- String replyTo = addrProps.getReplyTo().getAddress().getURI().toString();
- RMCreateSequence createSequence = rmFactory.newCreateSequence();
- createSequence.setAcksTo(replyTo);
- createSequence.serializeTo(soapMessage);
- data.put(msgQName, createSequence);
- log.debug(msgQName.getLocalPart() + " WSRM message was serialized to
payload");
- }
- }
-
- if (isServerSide())
- {
- msgQName = rmConstants.getCreateSequenceResponseQName();
- if (outMsgs.contains(msgQName))
- {
- // try to serialize CreateSequenceResponse to message
- RMCreateSequenceResponse createSequenceResponse =
rmFactory.newCreateSequenceResponse();
- createSequenceResponse.setIdentifier(sequenceImpl.getInboundId());
-
createSequenceResponse.setExpires(RMHelper.longToDuration(sequenceImpl.getDuration()));
- createSequenceResponse.serializeTo(soapMessage);
- data.put(msgQName, createSequenceResponse);
- log.debug(msgQName.getLocalPart() + " WSRM message was serialized to
payload");
- }
- }
-
- msgQName = rmConstants.getSequenceQName();
- if (outMsgs.contains(msgQName))
- {
- // try to serialize Sequence to message
- RMSequence sequence = rmFactory.newSequence();
- sequence.setIdentifier(sequenceImpl.getOutboundId());
- sequence.setMessageNumber(sequenceImpl.newMessageNumber());
- sequence.serializeTo(soapMessage);
- data.put(msgQName, sequence);
- log.debug(msgQName.getLocalPart() + " WSRM message was serialized to
payload");
- }
-
- msgQName = rmConstants.getAckRequestedQName();
- if (outMsgs.contains(msgQName))
- {
- // try to serialize AckRequested to message
- RMAckRequested ackRequested = rmFactory.newAckRequested();
- ackRequested.setIdentifier(sequenceImpl.getOutboundId());
- ackRequested.setMessageNumber(sequenceImpl.getLastMessageNumber());
- ackRequested.serializeTo(soapMessage);
- data.put(msgQName, ackRequested);
- log.debug(msgQName.getLocalPart() + " WSRM message was serialized to
payload");
- }
-
- if (isClientSide())
- {
- msgQName = rmConstants.getCloseSequenceQName();
- if (outMsgs.contains(msgQName))
- {
- // try to serialize CloseSequence to message
- RMCloseSequence closeSequence = rmFactory.newCloseSequence();
- closeSequence.setIdentifier(sequenceImpl.getOutboundId());
- if (sequenceImpl.getLastMessageNumber() > 0)
- {
- closeSequence.setLastMsgNumber(sequenceImpl.getLastMessageNumber());
- }
- closeSequence.serializeTo(soapMessage);
- data.put(msgQName, closeSequence);
- log.debug(msgQName.getLocalPart() + " WSRM message was serialized to
payload");
- }
- }
-
- if (isServerSide())
- {
- msgQName = rmConstants.getCloseSequenceResponseQName();
- if (outMsgs.contains(msgQName))
- {
- // try to serialize CloseSequenceResponse to message
- RMCloseSequenceResponse closeSequenceResponse =
rmFactory.newCloseSequenceResponse();
- closeSequenceResponse.setIdentifier(sequenceImpl.getInboundId());
- closeSequenceResponse.serializeTo(soapMessage);
- data.put(msgQName, closeSequenceResponse);
- log.debug(msgQName.getLocalPart() + " WSRM message was serialized to
payload");
- }
- }
-
- if (isClientSide())
- {
- msgQName = rmConstants.getTerminateSequenceQName();
- if (outMsgs.contains(msgQName))
- {
- // try to serialize TerminateSequence to message
- RMTerminateSequence terminateSequence = rmFactory.newTerminateSequence();
- terminateSequence.setIdentifier(sequenceImpl.getOutboundId());
- if (sequenceImpl.getLastMessageNumber() > 0)
- {
- terminateSequence.setLastMsgNumber(sequenceImpl.getLastMessageNumber());
- }
- terminateSequence.serializeTo(soapMessage);
- data.put(msgQName, terminateSequence);
- log.debug(msgQName.getLocalPart() + " WSRM message was serialized to
payload");
- }
- }
-
- if (isServerSide())
- {
- msgQName = rmConstants.getTerminateSequenceResponseQName();
- if (outMsgs.contains(msgQName))
- {
- // try to serialize terminateSequenceResponse to message
- RMTerminateSequenceResponse terminateSequenceResponse =
rmFactory.newTerminateSequenceResponse();
- terminateSequenceResponse.setIdentifier(sequenceImpl.getInboundId());
- terminateSequenceResponse.serializeTo(soapMessage);
- data.put(msgQName, terminateSequenceResponse);
- log.debug(msgQName.getLocalPart() + " WSRM message was serialized to
payload");
- }
- }
-
- msgQName = rmConstants.getSequenceAcknowledgementQName();
- if (outMsgs.contains(msgQName))
- {
- // try to serialize SequenceAcknowledgement to message
- RMSequenceAcknowledgement sequenceAcknowledgement =
rmFactory.newSequenceAcknowledgement();
- sequenceAcknowledgement.setIdentifier(sequenceImpl.getInboundId());
- Iterator<Long> receivedMessages =
sequenceImpl.getReceivedInboundMessages().iterator();
- if (false == receivedMessages.hasNext())
- {
- sequenceAcknowledgement.setNone();
- }
- else
- {
- while (receivedMessages.hasNext())
- {
- long messageNo = receivedMessages.next();
- RMSequenceAcknowledgement.RMAcknowledgementRange range =
sequenceAcknowledgement.newAcknowledgementRange();
- range.setLower(messageNo);
- range.setUpper(messageNo);
- sequenceAcknowledgement.addAcknowledgementRange(range);
- }
- }
- sequenceAcknowledgement.serializeTo(soapMessage);
- data.put(msgQName, sequenceAcknowledgement);
- log.debug(msgQName.getLocalPart() + " WSRM message was serialized to
payload");
- }
-
- if ((outMsgs.size() != 0) && (data.size() == 0))
- throw new RMException("RM handler did not serialize WS-RM message to the
payload");
-
- // TODO: implement SequenceFault serialization
-
- return true;
- }
-
- protected final boolean handleInbound(MessageContext msgContext)
- {
- log.debug("handling inbound message");
-
- SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
- Map<String, Object> rmResponseContext = new HashMap();
- List<QName> messages = new LinkedList<QName>();
- rmResponseContext.put(RMConstant.PROTOCOL_MESSAGES, messages);
- Map<QName, RMSerializable> data = new HashMap<QName,
RMSerializable>();
- rmResponseContext.put(RMConstant.PROTOCOL_MESSAGES_MAPPING, data);
- String rmContext = isClientSide() ? RMConstant.RESPONSE_CONTEXT :
RMConstant.REQUEST_CONTEXT;
- msgContext.put(rmContext, rmResponseContext);
- msgContext.setScope(rmContext, Scope.APPLICATION);
-
- if (isServerSide())
- {
- try
- {
- // try to deserialize CreateSequence from message
- QName msgQName = rmConstants.getCreateSequenceQName();
- RMCreateSequence wsrmMsg = rmFactory.newCreateSequence();
- wsrmMsg.deserializeFrom(soapMessage);
- messages.add(msgQName);
- data.put(msgQName, wsrmMsg);
- log.debug(msgQName.getLocalPart() + " WSRM message was deserialized from
payload");
- }
- catch (RMException ignore) {}
- }
-
- if (isClientSide())
- {
- try
- {
- // try to deserialize CreateSequenceResponse from message
- QName msgQName = rmConstants.getCreateSequenceResponseQName();
- RMCreateSequenceResponse wsrmMsg = rmFactory.newCreateSequenceResponse();
- wsrmMsg.deserializeFrom(soapMessage);
- messages.add(msgQName);
- data.put(msgQName, wsrmMsg);
- log.debug(msgQName.getLocalPart() + " WSRM message was deserialized from
payload");
- }
- catch (RMException ignore) {}
- }
-
- try
- {
- // try to deserialize AckRequested from message
- QName msgQName = rmConstants.getAckRequestedQName();
- RMAckRequested wsrmMsg = rmFactory.newAckRequested();
- wsrmMsg.deserializeFrom(soapMessage);
- messages.add(msgQName);
- data.put(msgQName, wsrmMsg);
- log.debug(msgQName.getLocalPart() + " WSRM message was deserialized from
payload");
- }
- catch (RMException ignore) {}
-
- try
- {
- // try to deserialize Sequence from message
- QName msgQName = rmConstants.getSequenceQName();
- RMSequence wsrmMsg = rmFactory.newSequence();
- wsrmMsg.deserializeFrom(soapMessage);
- messages.add(msgQName);
- data.put(msgQName, wsrmMsg);
- log.debug(msgQName.getLocalPart() + " WSRM message was deserialized from
payload");
- }
- catch (RMException ignore) {}
-
- try
- {
- // try to deserialize SequenceAcknowledgement from message
- QName msgQName = rmConstants.getSequenceAcknowledgementQName();
- RMSequenceAcknowledgement wsrmMsg = rmFactory.newSequenceAcknowledgement();
- wsrmMsg.deserializeFrom(soapMessage);
- messages.add(msgQName);
- data.put(msgQName, wsrmMsg);
- log.debug(msgQName.getLocalPart() + " WSRM message was deserialized from
payload");
- }
- catch (RMException ignore) {}
-
- if (isServerSide())
- {
- try
- {
- // try to deserialize CloseSequence from message
- QName msgQName = rmConstants.getCloseSequenceQName();
- RMCloseSequence wsrmMsg = rmFactory.newCloseSequence();
- wsrmMsg.deserializeFrom(soapMessage);
- messages.add(msgQName);
- data.put(msgQName, wsrmMsg);
- log.debug(msgQName.getLocalPart() + " WSRM message was deserialized from
payload");
- }
- catch (RMException ignore) {}
- }
-
- if (isClientSide())
- {
- try
- {
- // try to deserialize CloseSequenceResponse from message
- QName msgQName = rmConstants.getCloseSequenceResponseQName();
- RMCloseSequenceResponse wsrmMsg = rmFactory.newCloseSequenceResponse();
- wsrmMsg.deserializeFrom(soapMessage);
- messages.add(msgQName);
- data.put(msgQName, wsrmMsg);
- log.debug(msgQName.getLocalPart() + " WSRM message was deserialized from
payload");
- }
- catch (RMException ignore) {}
- }
-
- if (isServerSide())
- {
- try
- {
- // try to deserialize TerminateSequence from message
- QName msgQName = rmConstants.getTerminateSequenceQName();
- RMTerminateSequence wsrmMsg = rmFactory.newTerminateSequence();
- wsrmMsg.deserializeFrom(soapMessage);
- messages.add(msgQName);
- data.put(msgQName, wsrmMsg);
- log.debug(msgQName.getLocalPart() + " WSRM message was deserialized from
payload");
- }
- catch (RMException ignore) {}
- }
-
- if (isClientSide())
- {
- try
- {
- // try to deserialize TerminateSequenceResponse from message
- QName msgQName = rmConstants.getTerminateSequenceResponseQName();
- RMTerminateSequenceResponse wsrmMsg =
rmFactory.newTerminateSequenceResponse();
- wsrmMsg.deserializeFrom(soapMessage);
- messages.add(msgQName);
- data.put(msgQName, wsrmMsg);
- log.debug(msgQName.getLocalPart() + " WSRM message was deserialized from
payload");
- }
- catch (RMException ignore) {}
- }
-
- // TODO: implement SequenceFault deserialization
-
- if (data.size() == 0)
- throw new RMException("RM handler was not able to find WS-RM message in the
payload");
-
- return true;
- }
-
-}
Added:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/jaxws/RMHandlerAbstractBase.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/jaxws/RMHandlerAbstractBase.java
(rev 0)
+++
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/jaxws/RMHandlerAbstractBase.java 2007-12-14
06:28:41 UTC (rev 5307)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.extensions.wsrm.jaxws;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPMessage;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.jaxws.handler.GenericSOAPHandler;
+import org.jboss.ws.extensions.wsrm.RMConstant;
+import org.jboss.ws.extensions.wsrm.RMSequenceIface;
+import org.jboss.ws.extensions.wsrm.api.RMException;
+import org.jboss.ws.extensions.wsrm.spi.protocol.RMSerializable;
+
+/**
+ * RM generic JAX-WS handler
+ *
+ * @author richard.opalka(a)jboss.com
+ *
+ * @since Oct 23, 2007
+ */
+public abstract class RMHandlerAbstractBase extends GenericSOAPHandler
+{
+ protected final Logger log = Logger.getLogger(getClass());
+
+ public final Set<QName> getHeaders()
+ {
+ return RMConstant.PROTOCOL_OPERATION_QNAMES;
+ }
+
+ protected final void serialize(QName msgQN, List<QName> outMsgs, Map<QName,
RMSerializable> data, SOAPMessage soapMessage, RMSequenceIface seq)
+ {
+ RMSerializable msg = RMHandlerHelper.prepareData(msgQN, outMsgs, seq);
+ if (msg != null)
+ {
+ msg.serializeTo(soapMessage);
+ data.put(msgQN, msg);
+ log.debug(msgQN.getLocalPart() + " WSRM message was serialized to
payload");
+ }
+ }
+
+ protected final void deserialize(QName msgQN, SOAPMessage soapMessage,
List<QName> messages, Map<QName, RMSerializable> data)
+ {
+ try
+ {
+ RMSerializable wsrmMsg = RMHandlerHelper.getMessage(msgQN);
+ wsrmMsg.deserializeFrom(soapMessage);
+ messages.add(msgQN);
+ data.put(msgQN, wsrmMsg);
+ log.debug(msgQN.getLocalPart() + " WSRM message was deserialized from
payload");
+ }
+ catch (RMException ignore) {}
+ }
+
+}
Property changes on:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/jaxws/RMHandlerAbstractBase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/jaxws/RMHandlerHelper.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/jaxws/RMHandlerHelper.java
(rev 0)
+++
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/jaxws/RMHandlerHelper.java 2007-12-14
06:28:41 UTC (rev 5307)
@@ -0,0 +1,245 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.extensions.wsrm.jaxws;
+
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.ws.extensions.wsrm.RMSequenceIface;
+import org.jboss.ws.extensions.wsrm.common.RMHelper;
+import org.jboss.ws.extensions.wsrm.spi.RMConstants;
+import org.jboss.ws.extensions.wsrm.spi.RMMessageFactory;
+import org.jboss.ws.extensions.wsrm.spi.RMProvider;
+import org.jboss.ws.extensions.wsrm.spi.protocol.RMAckRequested;
+import org.jboss.ws.extensions.wsrm.spi.protocol.RMCloseSequence;
+import org.jboss.ws.extensions.wsrm.spi.protocol.RMCloseSequenceResponse;
+import org.jboss.ws.extensions.wsrm.spi.protocol.RMCreateSequence;
+import org.jboss.ws.extensions.wsrm.spi.protocol.RMCreateSequenceResponse;
+import org.jboss.ws.extensions.wsrm.spi.protocol.RMSequence;
+import org.jboss.ws.extensions.wsrm.spi.protocol.RMSequenceAcknowledgement;
+import org.jboss.ws.extensions.wsrm.spi.protocol.RMSerializable;
+import org.jboss.ws.extensions.wsrm.spi.protocol.RMTerminateSequence;
+import org.jboss.ws.extensions.wsrm.spi.protocol.RMTerminateSequenceResponse;
+
+/**
+ * Handler helper
+ *
+ * @author richard.opalka(a)jboss.com
+ *
+ * @since Dec 13, 2007
+ */
+public final class RMHandlerHelper
+{
+
+ private static final RMMessageFactory rmFactory =
RMProvider.get().getMessageFactory();
+ private static final RMConstants rmConstants = RMProvider.get().getConstants();
+
+ public static RMSerializable getMessage(QName msgQN)
+ {
+ if (rmConstants.getCreateSequenceQName().equals(msgQN))
+ {
+ return rmFactory.newCreateSequence();
+ }
+ if (rmConstants.getCreateSequenceResponseQName().equals(msgQN))
+ {
+ return rmFactory.newCreateSequenceResponse();
+ }
+ if (rmConstants.getCloseSequenceQName().equals(msgQN))
+ {
+ return rmFactory.newCloseSequence();
+ }
+ if (rmConstants.getCloseSequenceResponseQName().equals(msgQN))
+ {
+ return rmFactory.newCloseSequenceResponse();
+ }
+ if (rmConstants.getTerminateSequenceQName().equals(msgQN))
+ {
+ return rmFactory.newTerminateSequence();
+ }
+ if (rmConstants.getTerminateSequenceResponseQName().equals(msgQN))
+ {
+ return rmFactory.newTerminateSequenceResponse();
+ }
+ if (rmConstants.getSequenceAcknowledgementQName().equals(msgQN))
+ {
+ return rmFactory.newSequenceAcknowledgement();
+ }
+ if (rmConstants.getSequenceQName().equals(msgQN))
+ {
+ return rmFactory.newSequence();
+ }
+ if (rmConstants.getAckRequestedQName().equals(msgQN))
+ {
+ return rmFactory.newAckRequested();
+ }
+
+ throw new IllegalArgumentException();
+ }
+
+ public static RMSerializable prepareData(QName msgQN, List<QName> outMsgs,
RMSequenceIface seq)
+ {
+ if (outMsgs.contains(msgQN))
+ {
+ if (rmConstants.getSequenceQName().equals(msgQN))
+ {
+ return newSequence(seq);
+ }
+ if (rmConstants.getSequenceAcknowledgementQName().equals(msgQN))
+ {
+ return newSequenceAcknowledgement(seq);
+ }
+ if (rmConstants.getTerminateSequenceQName().equals(msgQN))
+ {
+ return newTerminateSequence(seq);
+ }
+ if (rmConstants.getTerminateSequenceResponseQName().equals(msgQN))
+ {
+ return newTerminateSequenceResponse(seq);
+ }
+ if (rmConstants.getCloseSequenceQName().equals(msgQN))
+ {
+ return newCloseSequence(seq);
+ }
+ if (rmConstants.getCloseSequenceResponseQName().equals(msgQN))
+ {
+ return newCloseSequenceResponse(seq);
+ }
+ if (rmConstants.getAckRequestedQName().equals(msgQN))
+ {
+ return newAckRequested(seq);
+ }
+ if (rmConstants.getCreateSequenceQName().equals(msgQN))
+ {
+ return newCreateSequence(seq);
+ }
+ if (rmConstants.getCreateSequenceResponseQName().equals(msgQN))
+ {
+ return newCreateSequenceResponse(seq);
+ }
+
+ throw new IllegalArgumentException(msgQN.toString());
+ }
+
+ return null;
+ }
+
+ private static RMSerializable newCreateSequence(RMSequenceIface seq)
+ {
+ RMCreateSequence createSequence = rmFactory.newCreateSequence();
+ createSequence.setAcksTo(seq.getAcksTo());
+ return createSequence;
+ }
+
+ private static RMSerializable newCreateSequenceResponse(RMSequenceIface seq)
+ {
+ RMCreateSequenceResponse createSequenceResponse =
rmFactory.newCreateSequenceResponse();
+ createSequenceResponse.setIdentifier(seq.getInboundId());
+ createSequenceResponse.setExpires(RMHelper.longToDuration(seq.getDuration()));
+ return createSequenceResponse;
+ }
+
+ private static RMSerializable newCloseSequenceResponse(RMSequenceIface seq)
+ {
+ // construct CloseSequenceResponse object
+ RMCloseSequenceResponse closeSequenceResponse =
rmFactory.newCloseSequenceResponse();
+ closeSequenceResponse.setIdentifier(seq.getInboundId());
+ return closeSequenceResponse;
+ }
+
+ private static RMSerializable newCloseSequence(RMSequenceIface seq)
+ {
+ // construct CloseSequenceResponse object
+ RMCloseSequence closeSequence = rmFactory.newCloseSequence();
+ closeSequence.setIdentifier(seq.getOutboundId());
+ if (seq.getLastMessageNumber() > 0)
+ {
+ closeSequence.setLastMsgNumber(seq.getLastMessageNumber());
+ }
+ return closeSequence;
+ }
+
+ private static RMSerializable newTerminateSequence(RMSequenceIface seq)
+ {
+ // construct CloseSequenceResponse object
+ RMTerminateSequence terminateSequence = rmFactory.newTerminateSequence();
+ terminateSequence.setIdentifier(seq.getOutboundId());
+ if (seq.getLastMessageNumber() > 0)
+ {
+ terminateSequence.setLastMsgNumber(seq.getLastMessageNumber());
+ }
+ return terminateSequence;
+ }
+
+ private static RMSerializable newTerminateSequenceResponse(RMSequenceIface seq)
+ {
+ // construct TerminateSequenceResponse object
+ RMTerminateSequenceResponse terminateSequenceResponse =
rmFactory.newTerminateSequenceResponse();
+ terminateSequenceResponse.setIdentifier(seq.getInboundId());
+ return terminateSequenceResponse;
+ }
+
+ private static RMSerializable newSequenceAcknowledgement(RMSequenceIface seq)
+ {
+ // construct SequenceAcknowledgement object
+ RMSequenceAcknowledgement sequenceAcknowledgement =
rmFactory.newSequenceAcknowledgement();
+ sequenceAcknowledgement.setIdentifier(seq.getInboundId());
+ Iterator<Long> receivedMessages =
seq.getReceivedInboundMessages().iterator();
+ if (false == receivedMessages.hasNext())
+ {
+ sequenceAcknowledgement.setNone();
+ }
+ else
+ {
+ while (receivedMessages.hasNext())
+ {
+ long messageNo = receivedMessages.next();
+ RMSequenceAcknowledgement.RMAcknowledgementRange range =
sequenceAcknowledgement.newAcknowledgementRange();
+ range.setLower(messageNo);
+ range.setUpper(messageNo);
+ sequenceAcknowledgement.addAcknowledgementRange(range);
+ }
+ }
+
+ return sequenceAcknowledgement;
+ }
+
+ private static RMSerializable newAckRequested(RMSequenceIface seq)
+ {
+ // construct AckRequested object
+ RMAckRequested wsrmMsg = rmFactory.newAckRequested();
+ wsrmMsg.setIdentifier(seq.getOutboundId());
+ wsrmMsg.setMessageNumber(seq.getLastMessageNumber());
+ return wsrmMsg;
+ }
+
+ private static RMSerializable newSequence(RMSequenceIface seq)
+ {
+ // construct Sequence object
+ RMSequence sequence = rmFactory.newSequence();
+ sequence.setIdentifier(seq.getOutboundId());
+ sequence.setMessageNumber(seq.newMessageNumber());
+ return sequence;
+ }
+
+}
Property changes on:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/jaxws/RMHandlerHelper.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/jaxws/RMServerHandler.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/jaxws/RMServerHandler.java 2007-12-13
16:12:38 UTC (rev 5306)
+++
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/jaxws/RMServerHandler.java 2007-12-14
06:28:41 UTC (rev 5307)
@@ -21,25 +21,118 @@
*/
package org.jboss.ws.extensions.wsrm.jaxws;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.addressing.JAXWSAConstants;
+import javax.xml.ws.addressing.soap.SOAPAddressingProperties;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.MessageContext.Scope;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.extensions.wsrm.RMConstant;
+import org.jboss.ws.extensions.wsrm.RMSequenceIface;
+import org.jboss.ws.extensions.wsrm.api.RMException;
+import org.jboss.ws.extensions.wsrm.spi.RMConstants;
+import org.jboss.ws.extensions.wsrm.spi.RMProvider;
+import org.jboss.ws.extensions.wsrm.spi.protocol.RMSerializable;
+
/**
- * Client WS-RM JAX-WS handler
+ * Server WS-RM JAX-WS handler
*
* @author richard.opalka(a)jboss.com
*
* @since Dec 12, 2007
*/
-public final class RMServerHandler extends RMHandler
+public final class RMServerHandler extends RMHandlerAbstractBase
{
- @Override
- protected boolean isClientSide()
+ private static final RMConstants rmConstants = RMProvider.get().getConstants();
+
+ protected final boolean handleOutbound(MessageContext msgContext)
{
- return false;
+ log.debug("handling outbound message");
+
+ CommonMessageContext commonMsgContext = (CommonMessageContext)msgContext;
+ SOAPAddressingProperties addrProps =
(SOAPAddressingProperties)commonMsgContext.get(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND);
+ Map<String, Object> rmOutboundContext = (Map<String,
Object>)commonMsgContext.get(RMConstant.RESPONSE_CONTEXT);
+ List<QName> outMsgs =
(List<QName>)rmOutboundContext.get(RMConstant.PROTOCOL_MESSAGES);
+ Map<QName, RMSerializable> data = new HashMap<QName,
RMSerializable>();
+ String optionalMessageId = (addrProps.getMessageID() != null) ?
addrProps.getMessageID().getURI().toString() : null;
+ rmOutboundContext.put(RMConstant.WSA_MESSAGE_ID, optionalMessageId);
+ rmOutboundContext.put(RMConstant.PROTOCOL_MESSAGES_MAPPING, data);
+ SOAPMessage soapMessage = ((SOAPMessageContext)commonMsgContext).getMessage();
+ RMSequenceIface sequenceImpl =
(RMSequenceIface)rmOutboundContext.get(RMConstant.SEQUENCE_REFERENCE);
+
+ // try to serialize CreateSequenceResponse to message
+ serialize(rmConstants.getCreateSequenceResponseQName(), outMsgs, data, soapMessage,
sequenceImpl);
+
+ // try to serialize Sequence to message
+ serialize(rmConstants.getSequenceQName(), outMsgs, data, soapMessage,
sequenceImpl);
+
+ // try to serialize AckRequested to message
+ serialize(rmConstants.getAckRequestedQName(), outMsgs, data, soapMessage,
sequenceImpl);
+
+ // try to serialize CloseSequenceResponse to message
+ serialize(rmConstants.getCloseSequenceResponseQName(), outMsgs, data, soapMessage,
sequenceImpl);
+
+ // try to serialize TerminateSequenceResponse to message
+ serialize(rmConstants.getTerminateSequenceResponseQName(), outMsgs, data,
soapMessage, sequenceImpl);
+
+ // try to serialize SequenceAcknowledgement to message
+ serialize(rmConstants.getSequenceAcknowledgementQName(), outMsgs, data,
soapMessage, sequenceImpl);
+
+ if ((outMsgs.size() != 0) && (data.size() == 0))
+ throw new RMException("RM handler have not serialized WS-RM message to the
payload");
+
+ // TODO: implement SequenceFault serialization
+
+ return true;
}
- @Override
- protected boolean isServerSide()
+ protected final boolean handleInbound(MessageContext msgContext)
{
+ log.debug("handling inbound message");
+
+ SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+
+ // initialize RM response context
+ Map<String, Object> rmResponseContext = new HashMap<String, Object>();
+ List<QName> messages = new LinkedList<QName>();
+ rmResponseContext.put(RMConstant.PROTOCOL_MESSAGES, messages);
+ Map<QName, RMSerializable> data = new HashMap<QName,
RMSerializable>();
+ rmResponseContext.put(RMConstant.PROTOCOL_MESSAGES_MAPPING, data);
+
+ // try to read CreateSequence from message
+ deserialize(rmConstants.getCreateSequenceQName(), soapMessage, messages, data);
+
+ // try to read AckRequested from message
+ deserialize(rmConstants.getAckRequestedQName(), soapMessage, messages, data);
+
+ // try to read Sequence from message
+ deserialize(rmConstants.getSequenceQName(), soapMessage, messages, data);
+
+ // try to read SequenceAcknowledgement from message
+ deserialize(rmConstants.getSequenceAcknowledgementQName(), soapMessage, messages,
data);
+
+ // try to read CloseSequence from message
+ deserialize(rmConstants.getCloseSequenceQName(), soapMessage, messages, data);
+
+ // try to read TerminateSequence from message
+ deserialize(rmConstants.getTerminateSequenceQName(), soapMessage, messages, data);
+
+ if (data.size() == 0)
+ throw new RMException("RM handler was not able to find WS-RM message in the
payload");
+
+ // propagate RM response context to higher layers
+ msgContext.put(RMConstant.REQUEST_CONTEXT, rmResponseContext);
+ msgContext.setScope(RMConstant.REQUEST_CONTEXT, Scope.APPLICATION);
+
return true;
}
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/server/RMServerSequence.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/server/RMServerSequence.java 2007-12-13
16:12:38 UTC (rev 5306)
+++
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/server/RMServerSequence.java 2007-12-14
06:28:41 UTC (rev 5307)
@@ -59,6 +59,11 @@
{
return this.duration;
}
+
+ public String getAcksTo()
+ {
+ return null;
+ }
public String getOutboundId()
{