Package org.jboss.ws.extensions.wsrm.protocol

Examples of org.jboss.ws.extensions.wsrm.protocol.RMConstants


   {
      RMCloseSequence o = (RMCloseSequence)object;
      try
      {
         SOAPBody soapBody = soapMessage.getSOAPPart().getEnvelope().getBody();
         RMConstants wsrmConstants = provider.getConstants();
        
         // read required wsrm:CloseSequence element
         QName closeSequenceQName = wsrmConstants.getCloseSequenceQName();
         SOAPElement closeSequenceElement = getRequiredElement(soapBody, closeSequenceQName, "soap body");

         // read required wsrm:Identifier element
         QName identifierQName = wsrmConstants.getIdentifierQName();
         SOAPElement identifierElement = getRequiredElement(closeSequenceElement, identifierQName, closeSequenceQName);
         String identifier = getRequiredTextContent(identifierElement, identifierQName);
         o.setIdentifier(identifier);
        
         // read optional wsrm:LastMsgNumber element
         QName lastMsgNumberQName = wsrmConstants.getLastMsgNumberQName();
         SOAPElement lastMsgNumberElement = getOptionalElement(closeSequenceElement, lastMsgNumberQName, closeSequenceQName);
         if (lastMsgNumberElement != null)
         {
            String lastMsgNumberString = getRequiredTextContent(lastMsgNumberElement, lastMsgNumberQName);
            long lastMsgNumberValue = stringToLong(lastMsgNumberString, "Unable to parse LastMsgNumber element text content");
View Full Code Here


   {
      RMCloseSequence o = (RMCloseSequence)object;
      try
      {
         SOAPEnvelope soapEnvelope = soapMessage.getSOAPPart().getEnvelope();
         RMConstants wsrmConstants = provider.getConstants();
        
         // Add xmlns:wsrm declaration
         soapEnvelope.addNamespaceDeclaration(wsrmConstants.getPrefix(), wsrmConstants.getNamespaceURI());

         // write required wsrm:CloseSequence element
         QName closeSequenceQName = wsrmConstants.getCloseSequenceQName();
         SOAPElement closeSequenceElement = soapEnvelope.getBody().addChildElement(closeSequenceQName);

         // write required wsrm:Identifier element
         QName identifierQName = wsrmConstants.getIdentifierQName();
         closeSequenceElement.addChildElement(identifierQName).setValue(o.getIdentifier());
        
         if (o.getLastMsgNumber() != 0)
         {
            // write optional wsrm:LastMsgNumber element
            QName lastMsgNumberQName = wsrmConstants.getLastMsgNumberQName();
            SOAPElement lastMsgNumberElement = closeSequenceElement.addChildElement(lastMsgNumberQName);
            lastMsgNumberElement.setValue(String.valueOf(o.getLastMsgNumber()));
         }
      }
      catch (SOAPException se)
View Full Code Here

   {
      RMCloseSequenceResponse o = (RMCloseSequenceResponse)object;
      try
      {
         SOAPBody soapBody = soapMessage.getSOAPPart().getEnvelope().getBody();
         RMConstants wsrmConstants = provider.getConstants();
        
         // read required wsrm:CloseSequenceResponse element
         QName closeSequenceResponseQName = wsrmConstants.getCloseSequenceResponseQName();
         SOAPElement closeSequenceResponseElement = getRequiredElement(soapBody, closeSequenceResponseQName, "soap body");

         // read required wsrm:Identifier element
         QName identifierQName = wsrmConstants.getIdentifierQName();
         SOAPElement identifierElement = getRequiredElement(closeSequenceResponseElement, identifierQName, closeSequenceResponseQName);
         String identifier = getRequiredTextContent(identifierElement, identifierQName);
         o.setIdentifier(identifier);
      }
      catch (SOAPException se)
View Full Code Here

   {
      RMCloseSequenceResponse o = (RMCloseSequenceResponse)object;
      try
      {
         SOAPEnvelope soapEnvelope = soapMessage.getSOAPPart().getEnvelope();
         RMConstants wsrmConstants = provider.getConstants();
        
         // Add xmlns:wsrm declaration
         soapEnvelope.addNamespaceDeclaration(wsrmConstants.getPrefix(), wsrmConstants.getNamespaceURI());

         // write required wsrm:CloseSequenceResponse element
         QName closeSequenceResponseQName = wsrmConstants.getCloseSequenceResponseQName();
         SOAPElement closeSequenceResponseElement = soapEnvelope.getBody().addChildElement(closeSequenceResponseQName);

         // write required wsrm:Identifier element
         QName identifierQName = wsrmConstants.getIdentifierQName();
         closeSequenceResponseElement.addChildElement(identifierQName).setValue(o.getIdentifier());
      }
      catch (SOAPException se)
      {
         throw new RMException("Unable to serialize RM message", se);
View Full Code Here

   {
      RMAckRequested o = (RMAckRequested)object;
      try
      {
         SOAPHeader soapHeader = soapMessage.getSOAPPart().getEnvelope().getHeader();
         RMConstants wsrmConstants = provider.getConstants();
        
         // read required wsrm:AckRequested element
         QName ackRequestedQName = wsrmConstants.getAckRequestedQName();
         SOAPElement ackRequestedElement = getRequiredElement(soapHeader, ackRequestedQName, "soap header");

         // read required wsrm:Identifier element
         QName identifierQName = wsrmConstants.getIdentifierQName();
         SOAPElement identifierElement = getRequiredElement(ackRequestedElement, identifierQName, ackRequestedQName);
         String identifier = getRequiredTextContent(identifierElement, identifierQName);
         o.setIdentifier(identifier);
        
         // read optional wsrm:MessageNumber element
         QName messageNumberQName = wsrmConstants.getMessageNumberQName();
         SOAPElement messageNumberElement = getOptionalElement(ackRequestedElement, messageNumberQName, ackRequestedQName);
         if (messageNumberElement != null)
         {
            String messageNumberString = getRequiredTextContent(messageNumberElement, messageNumberQName);
            long messageNumberValue = stringToLong(messageNumberString, "Unable to parse MessageNumber element text content");
View Full Code Here

   {
      RMAckRequested o = (RMAckRequested)object;
      try
      {
         SOAPEnvelope soapEnvelope = soapMessage.getSOAPPart().getEnvelope();
         RMConstants wsrmConstants = provider.getConstants();
        
         // Add xmlns:wsrm declaration
         soapEnvelope.addNamespaceDeclaration(wsrmConstants.getPrefix(), wsrmConstants.getNamespaceURI());

         // write required wsrm:AckRequested element
         QName ackRequestedQName = wsrmConstants.getAckRequestedQName();
         SOAPElement ackRequestedElement = soapEnvelope.getHeader().addChildElement(ackRequestedQName);

         // write required wsrm:Identifier element
         QName identifierQName = wsrmConstants.getIdentifierQName();
         ackRequestedElement.addChildElement(identifierQName).setValue(o.getIdentifier());
        
         if (o.getMessageNumber() != 0)
         {
            // write optional wsrm:MessageNumber element
            QName messageNumberQName = wsrmConstants.getMessageNumberQName();
            SOAPElement messageNumberElement = ackRequestedElement.addChildElement(messageNumberQName);
            messageNumberElement.setValue(String.valueOf(o.getMessageNumber()));
         }
      }
      catch (SOAPException se)
View Full Code Here

   {
      RMTerminateSequence o = (RMTerminateSequence)object;
      try
      {
         SOAPBody soapBody = soapMessage.getSOAPPart().getEnvelope().getBody();
         RMConstants wsrmConstants = provider.getConstants();
        
         // read required wsrm:TerminateSequence element
         QName terminateSequenceQName = wsrmConstants.getTerminateSequenceQName();
         SOAPElement terminateSequenceElement = getRequiredElement(soapBody, terminateSequenceQName, "soap body");

         // read required wsrm:Identifier element
         QName identifierQName = wsrmConstants.getIdentifierQName();
         SOAPElement identifierElement = getRequiredElement(terminateSequenceElement, identifierQName, terminateSequenceQName);
         String identifier = getRequiredTextContent(identifierElement, identifierQName);
         o.setIdentifier(identifier);
        
         // read optional wsrm:LastMsgNumber element
         QName lastMsgNumberQName = wsrmConstants.getLastMsgNumberQName();
         SOAPElement lastMsgNumberElement = getOptionalElement(terminateSequenceElement, lastMsgNumberQName, terminateSequenceQName);
         if (lastMsgNumberElement != null)
         {
            String lastMsgNumberString = getRequiredTextContent(lastMsgNumberElement, lastMsgNumberQName);
            long lastMsgNumberValue = stringToLong(lastMsgNumberString, "Unable to parse LastMsgNumber element text content");
View Full Code Here

   {
      RMTerminateSequence o = (RMTerminateSequence)object;
      try
      {
         SOAPEnvelope soapEnvelope = soapMessage.getSOAPPart().getEnvelope();
         RMConstants wsrmConstants = provider.getConstants();
        
         // Add xmlns:wsrm declaration
         soapEnvelope.addNamespaceDeclaration(wsrmConstants.getPrefix(), wsrmConstants.getNamespaceURI());

         // write required wsrm:TerminateSequence element
         QName terminateSequenceQName = wsrmConstants.getTerminateSequenceQName();
         SOAPElement terminateSequenceElement = soapEnvelope.getBody().addChildElement(terminateSequenceQName);

         // write required wsrm:Identifier element
         QName identifierQName = wsrmConstants.getIdentifierQName();
         terminateSequenceElement.addChildElement(identifierQName).setValue(o.getIdentifier());
        
         if (o.getLastMsgNumber() != 0)
         {
            // write optional wsrm:LastMsgNumber element
            QName lastMsgNumberQName = wsrmConstants.getLastMsgNumberQName();
            SOAPElement lastMsgNumberElement = terminateSequenceElement.addChildElement(lastMsgNumberQName);
            lastMsgNumberElement.setValue(String.valueOf(o.getLastMsgNumber()));
         }
      }
      catch (SOAPException se)
View Full Code Here

         if (false == isSoap11)
         {
            throw new NotImplementedException("TODO: implement SOAP 12 serialization");
         }
        
         RMConstants wsrmConstants = provider.getConstants();
        
         // Add xmlns:wsrm declaration
         soapEnvelope.addNamespaceDeclaration(wsrmConstants.getPrefix(), wsrmConstants.getNamespaceURI());

         // write required wsrm:SequenceFault element
         QName sequenceFaultQName = wsrmConstants.getSequenceFaultQName();
         SOAPElement sequenceFaultElement = soapEnvelope.getHeader().addChildElement(sequenceFaultQName);

         // write required wsrm:FaultCode element
         RMFault rmFault = (RMFault)o.getDetail();
         QName faultCodeQName = wsrmConstants.getFaultCodeQName();
         String subcode = wsrmConstants.getPrefix() + ":" + rmFault.getFaultCode().getSubcode().getValue();
         sequenceFaultElement.addChildElement(faultCodeQName).setValue(subcode);

         Map<String, Object> details = rmFault.getDetails()
         if (details.size() > 0)
         {
            for (Iterator<String> i = details.keySet().iterator(); i.hasNext(); )
            {
               // write optional wsrm:Detail elements
               QName detailQName = wsrmConstants.getDetailQName();
               SOAPElement detailElement = sequenceFaultElement.addChildElement(detailQName);

               String key = i.next();
               if (RMFaultConstant.IDENTIFIER.equals(key))
               {
                  // write optional wsrm:Identifier element
                  String sequenceId = (String)details.get(key);
                  QName identifierQName = wsrmConstants.getIdentifierQName();
                  detailElement.addChildElement(identifierQName).setValue(sequenceId);
               }
               else if (RMFaultConstant.ACKNOWLEDGEMENT.equals(key))
               {
                  // write optional wsrm:AcknowledgementRange element
                  RMSequenceAcknowledgement.RMAcknowledgementRange ackRange = (RMSequenceAcknowledgement.RMAcknowledgementRange)details.get(key);
                  QName acknowledgementRangeQName = wsrmConstants.getAcknowledgementRangeQName();
                  QName upperQName = wsrmConstants.getUpperQName();
                  QName lowerQName = wsrmConstants.getLowerQName();

                  SOAPElement acknowledgementRangeElement = detailElement.addChildElement(acknowledgementRangeQName);
                  // write required wsrm:Lower attribute
                  acknowledgementRangeElement.addAttribute(lowerQName, String.valueOf(ackRange.getLower()));
                  // write required wsrm:Upper attribute
                  acknowledgementRangeElement.addAttribute(upperQName, String.valueOf(ackRange.getUpper()));
               }
               else if (RMFaultConstant.MAX_MESSAGE_NUMBER.equals(key))
               {
                  // write optional wsrm:MaxMessageNumber element
                  Long maxMessageNumber = (Long)details.get(key);
                  QName maxMessageNumberQName = wsrmConstants.getMaxMessageNumberQName();
                  detailElement.addChildElement(maxMessageNumberQName).setValue(maxMessageNumber.toString());
               }
               else throw new IllegalArgumentException("Can't serialize detail with key " + key);
            }
         }
View Full Code Here

            if (RMConstant.PROTOCOL_OPERATION_QNAMES.contains(opName) == false)
            {
               Map<String, Object> wsrmResCtx = (Map<String, Object>) msgContext.get(RMConstant.RESPONSE_CONTEXT);
               if (wsrmResCtx != null)
               {
                  RMConstants wsrmConstants = RMProvider.get().getConstants();
                  Map<QName, RMSerializable> mapping = (Map<QName, RMSerializable>)wsrmResCtx.get(RMConstant.PROTOCOL_MESSAGES_MAPPING);
                  QName seq = wsrmConstants.getSequenceQName();
                  if (mapping.keySet().contains(seq))
                  {
                     RMHelper.handleSequenceHeader((RMSequence)mapping.get(seq), this.wsrmSequence);
                  }
                  QName seqAck = wsrmConstants.getSequenceAcknowledgementQName();
                  if (mapping.keySet().contains(seqAck))
                  {
                     RMHelper.handleSequenceAcknowledgementHeader((RMSequenceAcknowledgement)mapping.get(seqAck), this.wsrmSequence);
                  }
                  QName ackReq = wsrmConstants.getAckRequestedQName();
                  if (mapping.keySet().contains(ackReq))
                  {
                     RMHelper.handleAckRequestedHeader((RMAckRequested)mapping.get(ackReq), this.wsrmSequence);
                  }
               }
View Full Code Here

TOP

Related Classes of org.jboss.ws.extensions.wsrm.protocol.RMConstants

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.