Package javax.xml.ws.addressing.soap

Examples of javax.xml.ws.addressing.soap.SOAPAddressingProperties


  protected boolean handleOutbound(MessageContext msgContext)
  {
    log.debug("handleOutbound");

      SOAPAddressingProperties addrProps = (SOAPAddressingProperties)msgContext.get(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES);
      if (addrProps != null)
      {
         msgContext.put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND, addrProps);
         msgContext.setScope(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND, Scope.APPLICATION);
      }
     
      addrProps = (SOAPAddressingProperties)msgContext.get(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND);
      if (addrProps == null)
      {
         // supply default addressing properties
         addrProps = (SOAPAddressingPropertiesImpl)ADDR_BUILDER.newAddressingProperties();
         msgContext.put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND, addrProps);
         msgContext.setScope(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND, Scope.APPLICATION);
      }
     
      if (addrProps.getAction() == null)
      {
         try
         {
            OperationMetaData opMetaData = ((CommonMessageContext)msgContext).getOperationMetaData();
            addrProps.setAction(ADDR_BUILDER.newURI(opMetaData.getJavaName()));
         }
         catch (URISyntaxException ex)
         {
            // ignore
         }
      }
     
    SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
    addrProps.writeHeaders(soapMessage);

    return true;
  }
View Full Code Here


    {
      SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
      if (soapMessage.getSOAPPart().getEnvelope() != null)
      {
        SOAPAddressingBuilder builder = (SOAPAddressingBuilder)SOAPAddressingBuilder.getAddressingBuilder();
        SOAPAddressingProperties addrProps = (SOAPAddressingProperties)builder.newAddressingProperties();
        addrProps.readHeaders(soapMessage);
            msgContext.put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES, addrProps);
            msgContext.setScope(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES, Scope.APPLICATION);
            msgContext.put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_INBOUND, addrProps);
            msgContext.setScope(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_INBOUND, Scope.APPLICATION);
      }
View Full Code Here

   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();
      RMSequence sequenceImpl = (RMSequence)rmOutboundContext.get(RMConstant.SEQUENCE_REFERENCE);
     
View Full Code Here

   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);
      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();
      RMSequence sequenceImpl = (RMSequence)rmOutboundContext.get(RMConstant.SEQUENCE_REFERENCE);
     
View Full Code Here

   @Override
   public boolean handleFault(MessageContext msgContext)
   {
      log.debug("handling fault 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();
      RMFault sequenceFault = (RMFault)rmOutboundContext.get(RMConstant.FAULT_REFERENCE);
View Full Code Here

  protected boolean handleInbound(MessageContext msgContext)
  {
    if(log.isDebugEnabled()) log.debug("handleInbound");

    SOAPAddressingProperties addrProps = (SOAPAddressingProperties)ADDR_BUILDER.newAddressingProperties();
    SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
    CommonMessageContext commonMsgContext = (CommonMessageContext)msgContext;
    ServerEndpointMetaData serverMetaData = (ServerEndpointMetaData)commonMsgContext.getEndpointMetaData();
    AddressingFeature addrFeature = serverMetaData.getFeature(AddressingFeature.class);
        if (addrFeature != null && addrFeature.isRequired())
        {
           try
           {
               soapMessage.setProperty("isRequired", true);
           }
           catch (Exception e)
           {
              //ignore
           }
          
        }
        addrProps.readHeaders(soapMessage);
        msgContext.put(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND, addrProps);
        msgContext.setScope(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND, Scope.APPLICATION);
        msgContext.put(MessageContext.REFERENCE_PARAMETERS, convertToElementList(addrProps.getReferenceParameters().getElements()));
        msgContext.setScope(MessageContext.REFERENCE_PARAMETERS, Scope.APPLICATION);
       
        //check if soap action matches wsa action
        String[] soapActions = commonMsgContext.getMessageAbstraction().getMimeHeaders().getHeader("SOAPAction");
        if (soapActions != null && soapActions.length > 0)
        {
         String soapAction = soapActions[0];
         if (!soapAction.equals("\"\""&& addrProps.getAction() != null)               
         {
            String wsaAction = addrProps.getAction().getURI().toString();
            // R1109 The value of the SOAPAction HTTP header field in a HTTP request MESSAGE MUST be a quoted string.
            if (!soapAction.equals(wsaAction) && !soapAction.equals("\"" + wsaAction + "\""))
            {
               try
               {
                  SOAPFault fault = new SOAPFaultImpl();
                  fault.setFaultCode(new QName(ADDR_CONSTANTS.getNamespaceURI(), "ActionMismatch"));
                  fault.setFaultString("Mismatch between soap action:" + soapAction + " and wsa action:\""
                        + addrProps.getAction().getURI() + "\"");
                  Detail detail = fault.addDetail();
                  detail.addDetailEntry(new QName(ADDR_CONSTANTS.getNamespaceURI(), "ProblemAction"));
                  throw new SOAPFaultException(fault);
               }
               catch (SOAPException e)
View Full Code Here

  private void handleResponseOrFault(MessageContext msgContext, boolean isFault)
  {
    SOAPAddressingBuilder builder = (SOAPAddressingBuilder)SOAPAddressingBuilder.getAddressingBuilder();
    SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();

    SOAPAddressingProperties inProps = (SOAPAddressingProperties)msgContext.get(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND);
    SOAPAddressingProperties outProps = (SOAPAddressingProperties)msgContext.get(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_OUTBOUND);

    if (outProps == null)
    {
      // create new response properties
      outProps = (SOAPAddressingProperties)builder.newAddressingProperties();
      msgContext.put(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_OUTBOUND, outProps);
      msgContext.setScope(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_OUTBOUND, Scope.APPLICATION);
    }
      
    if (inProps != null)
    outProps.initializeAsReply(inProps, isFault);

    try
    {
      // supply the response action

      OperationMetaData opMetaData = ((CommonMessageContext)msgContext).getOperationMetaData();
         if (opMetaData == null)
         {
            // Apparently the operation couldn't be determined
            return;
         }
     
      if (!isFault && !opMetaData.isOneWay())
      {

        AddressingOpMetaExt addrExt = (AddressingOpMetaExt)opMetaData.getExtension(ADDR_CONSTANTS.getNamespaceURI());
        if (addrExt != null)
        {
            outProps.setAction(ADDR_BUILDER.newURI(addrExt.getOutboundAction()));
        }
        else
        {
          log.warn("Unable to resolve replyAction for " + opMetaData.getQName());
        }

      }
      else if (isFault)        
      {
         AddressingOpMetaExt addrExt = (AddressingOpMetaExt)opMetaData.getExtension(ADDR_CONSTANTS.getNamespaceURI());
               if (addrExt != null && msgContext.get("Exception") != null
                     && addrExt.getFaultActions() != null && addrExt.getFaultActions().length > 0)
               {
                  Exception ex = (Exception)msgContext.get("Exception");
                  for(FaultAction faultAction  : addrExt.getFaultActions())
                  {
                     if (faultAction.className().getName().equals(ex.getClass().getName()))
                     {
                        outProps.setAction(ADDR_BUILDER.newURI(faultAction.value()));
                        break;
                     }
                  }                                          
               }
               if (outProps.getAction() == null) {
                  outProps.setAction(ADDR_BUILDER.newURI(ADDR_CONSTANTS.getDefaultFaultAction()));
               }       
      }

    }
    catch (URISyntaxException e)
    {
      log.error("Error setting response action", e);
    }

    outProps.writeHeaders(soapMessage);
  }
View Full Code Here

/*     */
/*     */   protected boolean handleInbound(MessageContext msgContext)
/*     */   {
/*  78 */     if (log.isDebugEnabled()) log.debug("handleInbound");
/*     */
/*  80 */     SOAPAddressingProperties addrProps = (SOAPAddressingProperties)ADDR_BUILDER.newAddressingProperties();
/*  81 */     SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
/*  82 */     addrProps.readHeaders(soapMessage);
/*  83 */     msgContext.put("javax.xml.ws.addressing.context.inbound", addrProps);
/*  84 */     msgContext.setScope("javax.xml.ws.addressing.context.inbound", MessageContext.Scope.APPLICATION);
/*     */
/*  86 */     return true;
/*     */   }
View Full Code Here

/*     */   private void handleResponseOrFault(MessageContext msgContext, boolean isFault)
/*     */   {
/* 109 */     SOAPAddressingBuilder builder = (SOAPAddressingBuilder)SOAPAddressingBuilder.getAddressingBuilder();
/* 110 */     SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
/*     */
/* 112 */     SOAPAddressingProperties inProps = (SOAPAddressingProperties)msgContext.get("javax.xml.ws.addressing.context.inbound");
/* 113 */     SOAPAddressingProperties outProps = (SOAPAddressingProperties)msgContext.get("javax.xml.ws.addressing.context.outbound");
/*     */
/* 115 */     if (outProps == null)
/*     */     {
/* 118 */       outProps = (SOAPAddressingProperties)builder.newAddressingProperties();
/* 119 */       msgContext.put("javax.xml.ws.addressing.context.outbound", outProps);
/* 120 */       msgContext.setScope("javax.xml.ws.addressing.context.outbound", MessageContext.Scope.APPLICATION);
/*     */     }
/*     */
/* 123 */     outProps.initializeAsReply(inProps, isFault);
/*     */     try
/*     */     {
/* 129 */       OperationMetaData opMetaData = ((CommonMessageContext)msgContext).getOperationMetaData();
/*     */
/* 131 */       if ((!isFault) && (!opMetaData.isOneWay()))
/*     */       {
/* 134 */         AddressingOpMetaExt addrExt = (AddressingOpMetaExt)opMetaData.getExtension(ADDR_CONSTANTS.getNamespaceURI());
/* 135 */         if (addrExt != null)
/*     */         {
/* 137 */           outProps.setAction(ADDR_BUILDER.newURI(addrExt.getOutboundAction()));
/*     */         }
/*     */         else
/*     */         {
/* 141 */           log.warn("Unable to resolve replyAction for " + opMetaData.getQName());
/*     */         }
/*     */
/*     */       }
/* 145 */       else if (isFault)
/*     */       {
/* 147 */         outProps.setAction(ADDR_BUILDER.newURI(ADDR_CONSTANTS.getDefaultFaultAction()));
/*     */       }
/*     */
/*     */     }
/*     */     catch (URISyntaxException e)
/*     */     {
/* 153 */       log.error("Error setting response action", e);
/*     */     }
/*     */
/* 156 */     outProps.writeHeaders(soapMessage);
/*     */   }
View Full Code Here

/*     */
/*     */   protected boolean handleOutbound(MessageContext msgContext)
/*     */   {
/*  77 */     log.debug("handleOutbound");
/*     */
/*  79 */     SOAPAddressingProperties addrProps = (SOAPAddressingProperties)msgContext.get("javax.xml.ws.addressing.context");
/*  80 */     if (addrProps != null)
/*     */     {
/*  82 */       msgContext.put("javax.xml.ws.addressing.context.outbound", addrProps);
/*  83 */       msgContext.setScope("javax.xml.ws.addressing.context.outbound", MessageContext.Scope.APPLICATION);
/*     */     }
/*     */
/*  86 */     addrProps = (SOAPAddressingProperties)msgContext.get("javax.xml.ws.addressing.context.outbound");
/*  87 */     if (addrProps != null)
/*     */     {
/*  89 */       SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
/*  90 */       addrProps.writeHeaders(soapMessage);
/*     */     }
/*     */     else
/*     */     {
/*  95 */       addrProps = (SOAPAddressingPropertiesImpl)ADDR_BUILDER.newAddressingProperties();
/*  96 */       msgContext.put("javax.xml.ws.addressing.context.outbound", addrProps);
View Full Code Here

TOP

Related Classes of javax.xml.ws.addressing.soap.SOAPAddressingProperties

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.