Package javax.xml.ws.addressing.soap

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


  {
    try
    {
      SOAPHeader soapHeader = message.getSOAPHeader();

      SOAPAddressingBuilder builder = new SOAPAddressingBuilderImpl();
      AddressingConstants ADDR = builder.newAddressingConstants();
      registerNamespaces(ADDR, soapHeader);   

      // wsa:To
      // This OPTIONAL element provides the value for the [destination] property.
      // If this element is NOT present then the value of the [destination]
      // property is "http://www.w3.org/2005/08/addressing/anonymous".
      String to = getOptionalHeaderContent(soapHeader, ADDR.getToQName());     
      if(to!=null)
        setTo(builder.newURI(to));
   
      // Read wsa:From
      // This OPTIONAL element (of type wsa:EndpointReferenceType) provides the value for the [source endpoint] property.
      Element wsaFrom = DOMUtils.getFirstChildElement(soapHeader, ADDR.getFromQName());
      if (wsaFrom != null)
      {
        EndpointReferenceImpl ref = new EndpointReferenceImpl(wsaFrom);
        setReplyTo(ref);
      }

      // Read wsa:ReplyTo
      // This OPTIONAL element provides the value for the [reply endpoint] property.
      // If this element is NOT present then the value of the [address] property of the [reply endpoint]
      // EPR is "http://www.w3.org/2005/08/addressing/anonymous".
      Element wsaReplyTo = DOMUtils.getFirstChildElement(soapHeader, ADDR.getReplyToQName());
      if (wsaReplyTo != null)
      {
        EndpointReferenceImpl ref = new EndpointReferenceImpl(wsaReplyTo);
        setReplyTo(ref);
      }
     
      // Read wsa:FaultTo
      // This OPTIONAL element (of type wsa:EndpointReferenceType) provides the value for the [fault endpoint] property.
      // If this element is present, wsa:MessageID MUST be present.
      Element wsaFaultTo = DOMUtils.getFirstChildElement(soapHeader, ADDR.getFaultToQName());
      if (wsaFaultTo != null)
      {
        EndpointReferenceImpl ref = new EndpointReferenceImpl(wsaFaultTo);
        setFaultTo(ref);
      }

      // wsa:Action
      // This REQUIRED element of type xs:anyURI conveys the [action] property.
      // The [children] of this element convey the value of this property.
      String action = getRequiredHeaderContent(soapHeader, ADDR.getActionQName());
      setAction(builder.newURI(action));

      // Read wsa:MessageID
      // This OPTIONAL element (whose content is of type xs:anyURI) conveys the [message id] property.
      String messageID = getOptionalHeaderContent(soapHeader, ADDR.getMessageIDQName());
      if(messageID!=null) setMessageID(builder.newURI(messageID));

      // Read wsa:RelatesTo
      // This OPTIONAL attribute conveys the relationship type as an IRI.
      // When absent, the implied value of this attribute is "http://www.w3.org/2005/08/addressing/reply".
      Iterator itRelatesTo = DOMUtils.getChildElements(soapHeader, ADDR.getRelatesToQName());
      List<Relationship> relList = new ArrayList<Relationship>();
      while (itRelatesTo.hasNext())
      {
        Element wsaRelatesTo = (Element)itRelatesTo.next();
        QName type = DOMUtils.getAttributeValueAsQName(wsaRelatesTo, ADDR.getRelationshipTypeName());
        String uri = DOMUtils.getTextContent(wsaRelatesTo);
        Relationship rel = builder.newRelationship(new URI(uri));
        rel.setType(type);
        relList.add(rel);
      }
      Relationship[] relArr = (Relationship[])Array.newInstance(Relationship.class, relList.size());
      relList.toArray(relArr);
View Full Code Here


      return true;
   }

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

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

      if (outProps == null)
      {
         // create new response properties
         outProps = (SOAPAddressingProperties)builder.newAddressingProperties();
         msgContext.setProperty(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_OUTBOUND, outProps);
      }

      outProps.initializeAsReply(inProps, isFault);
View Full Code Here

      try
      {
         SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
         if (soapMessage.getSOAPPart().getEnvelope() != null)
         {
            SOAPAddressingBuilder builder = (SOAPAddressingBuilder)SOAPAddressingBuilder.getAddressingBuilder();
            SOAPAddressingProperties addrProps = (SOAPAddressingProperties)builder.newAddressingProperties();
            addrProps.readHeaders(soapMessage);
            msgContext.setProperty(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_INBOUND, addrProps);
         }
      }
      catch (SOAPException ex)
View Full Code Here

      {
         Element epRef = toElement();
         return DOMWriter.printNode(epRef, true);
      }

      SOAPAddressingBuilder builder = new SOAPAddressingBuilderImpl();
      AddressingConstants ADDR = builder.newAddressingConstants();

      String rootname = getPrefixedName(rootQName);
      StringBuilder xmlBuffer = new StringBuilder("<" + rootname);
      appendAttributes(xmlBuffer, getAttributes());
      xmlBuffer.append(">");
View Full Code Here

    return true;
  }

  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);
    }

    outProps.initializeAsReply(inProps, isFault);
View Full Code Here

    try
    {
      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_INBOUND, addrProps);
        msgContext.setScope(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_INBOUND, Scope.APPLICATION);
      }
    }
View Full Code Here

   protected boolean handleOutbound(MessageContext msgContext)
   {
      log.info("handleRequest" + this);
      try
      {
         SOAPAddressingBuilder builder = (SOAPAddressingBuilder)SOAPAddressingBuilder.getAddressingBuilder();
         SOAPAddressingProperties outProps = (SOAPAddressingProperties)builder.newAddressingProperties();
         outProps.setTo(builder.newURI("http://localhost:8080/jaxrpc-addressing-action-rpc/ActionService"));
         outProps.setAction(builder.newURI("urn:wsa-action-bar"));
         msgContext.put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND, outProps);
      }
      catch (URISyntaxException ex)
      {
         throw new IllegalStateException("Cannot handle request", ex);
View Full Code Here

   protected boolean handleOutbound(MessageContext msgContext)
   {
      log.info("handleRequest" + this);
      try
      {
         SOAPAddressingBuilder builder = (SOAPAddressingBuilder)SOAPAddressingBuilder.getAddressingBuilder();
         SOAPAddressingProperties outProps = (SOAPAddressingProperties)builder.newAddressingProperties();
         outProps.setTo(builder.newURI("http://localhost:8080/jaxrpc-addressing-action-rpc/ActionService"));
         outProps.setAction(builder.newURI("urn:wsa-action-bar"));
         msgContext.put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND, outProps);
      }
      catch (URISyntaxException ex)
      {
         throw new IllegalStateException("Cannot handle request", ex);
View Full Code Here

    return true;
  }

  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)
View Full Code Here

    try
    {
      SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
      if (soapMessage.getSOAPPart().getEnvelope() != null)
      {
        SOAPAddressingBuilder builder = (SOAPAddressingBuilder)SOAPAddressingBuilder.getAddressingBuilder();
        SOAPAddressingProperties addrProps = (SOAPAddressingProperties)builder.newAddressingProperties();
            CommonMessageContext commonMsgContext = (CommonMessageContext)msgContext;
            ClientEndpointMetaData serverMetaData = (ClientEndpointMetaData)commonMsgContext.getEndpointMetaData();
            AddressingFeature addrFeature = serverMetaData.getFeature(AddressingFeature.class);
            if (addrFeature != null && addrFeature.isRequired())
            {
View Full Code Here

TOP

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

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.