Package javax.xml.ws.addressing

Examples of javax.xml.ws.addressing.AddressingConstants


   public boolean handleOutbound(MessageContext msgContext)
   {
      try
      {
         AddressingBuilder builder = AddressingBuilder.getAddressingBuilder();
         AddressingConstants ADDR = builder.newAddressingConstants();

         AddressingProperties outProps = builder.newAddressingProperties();
         outProps.setTo(builder.newURI("uri:jaxrpc-samples-wsaddressing/TestService"));
         outProps.setAction(builder.newURI("http://org.jboss.ws/addressing/stateful/action"));

         EndpointReference replyTo = builder.newEndpointReference(new URI(ADDR.getAnonymousURI()));
         outProps.setReplyTo(replyTo);
         outProps.setMessageID(builder.newURI("urn:uuid:"+ UUIDGenerator.generateRandomUUIDString()));

         // Assign a new clientid
         if (clientid == null)
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(">");

      // insert xmlns:wsa
      String wsaURI = ADDR.getNamespaceURI();
      String wsaPrefix = ADDR.getNamespacePrefix();
      String wsaDeclaration = " xmlns:" + wsaPrefix + "='" + wsaURI + "'";
      if (xmlBuffer.indexOf(wsaDeclaration) < 0)
      {
         xmlBuffer.insert(rootname.length() + 1, wsaDeclaration);
      }

      // append address
      xmlBuffer.append("<" + getPrefixedName(ADDR.getAddressQName()));
      appendAttributes(xmlBuffer, address.getAttributes());
      xmlBuffer.append(">");
      xmlBuffer.append(address.getURI() + "</" + getPrefixedName(ADDR.getAddressQName()) + ">");

      // append parameters
      if (refParams.getElements().size() > 0 || refParams.getAttributes().size() > 0)
      {
         xmlBuffer.append("<" + getPrefixedName(ADDR.getReferenceParametersQName()));
         appendAttributes(xmlBuffer, refParams.getAttributes());
         xmlBuffer.append(">");
         appendElements(xmlBuffer, refParams.getElements());
         xmlBuffer.append("</" + getPrefixedName(ADDR.getReferenceParametersQName()) + ">");
      }

      // append metadata
      if (metadata.getElements().size() > 0 || metadata.getAttributes().size() > 0)
      {
         xmlBuffer.append("<" + getPrefixedName(ADDR.getMetadataQName()));
         appendAttributes(xmlBuffer, metadata.getAttributes());
         xmlBuffer.append(">");
         appendElements(xmlBuffer, metadata.getElements());
         xmlBuffer.append("</" + getPrefixedName(ADDR.getMetadataQName()) + ">");
      }

      // append custom elements
      appendElements(xmlBuffer, getElements());
View Full Code Here

      log.info("handleRequest" + this);

      try
      {
         AddressingBuilder builder = AddressingBuilder.getAddressingBuilder();
         AddressingConstants ADDR = builder.newAddressingConstants();

         AddressingProperties outProps = builder.newAddressingProperties();
         outProps.setTo(builder.newURI("uri:jaxrpc-samples-wsaddressing/TestService"));
         outProps.setAction(builder.newURI("http://org.jboss.ws/addressing/stateful/action"));

         EndpointReference replyTo = builder.newEndpointReference(new URI(ADDR.getAnonymousURI()));
         outProps.setReplyTo(replyTo);
         outProps.setMessageID(builder.newURI("urn:uuid:"+ UUIDGenerator.generateRandomUUIDString()));

         // Assign a new clientid
         if (clientid == null)
View Full Code Here

      log.info("handleRequest" + this);

      try
      {
         AddressingBuilder builder = AddressingBuilder.getAddressingBuilder();
         AddressingConstants ADDR = builder.newAddressingConstants();

         AddressingProperties outProps = builder.newAddressingProperties();
         outProps.setTo(builder.newURI("uri:jaxrpc-samples-wsaddressing/TestService"));
         outProps.setAction(builder.newURI("http://org.jboss.ws/addressing/stateful/action"));

         EndpointReference replyTo = builder.newEndpointReference(new URI(ADDR.getAnonymousURI()));
         outProps.setReplyTo(replyTo);
         outProps.setMessageID(builder.newURI("urn:uuid:"+ UUIDGenerator.generateRandomUUIDString()));

         // Assign a new clientid
         if (clientid == null)
View Full Code Here

    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);
        setFrom(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.
            if (message.getProperty("isRequired") != null && (Boolean)message.getProperty("isRequired"))
            {
               //check the action header only if the required value is true
               String action = getRequiredHeaderContent(soapHeader, ADDR.getActionQName());
               setAction(builder.newURI(action));
            }
            else
            {
               String action = getOptionalHeaderContent(soapHeader, ADDR.getActionQName());
               if (action != null) 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);
      }
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(">");

      // insert xmlns:wsa
      String wsaURI = ADDR.getNamespaceURI();
      String wsaPrefix = ADDR.getNamespacePrefix();
      String wsaDeclaration = " xmlns:" + wsaPrefix + "='" + wsaURI + "'";
      if (xmlBuffer.indexOf(wsaDeclaration) < 0)
      {
         xmlBuffer.insert(rootname.length() + 1, wsaDeclaration);
      }

      // append address
      xmlBuffer.append("<" + getPrefixedName(ADDR.getAddressQName()));
      appendAttributes(xmlBuffer, address.getAttributes());
      xmlBuffer.append(">");
      xmlBuffer.append(address.getURI() + "</" + getPrefixedName(ADDR.getAddressQName()) + ">");

      // append parameters
      if (refParams.getElements().size() > 0 || refParams.getAttributes().size() > 0)
      {
         xmlBuffer.append("<" + getPrefixedName(ADDR.getReferenceParametersQName()));
         appendAttributes(xmlBuffer, refParams.getAttributes());
         xmlBuffer.append(">");
         appendElements(xmlBuffer, refParams.getElements());
         xmlBuffer.append("</" + getPrefixedName(ADDR.getReferenceParametersQName()) + ">");
      }

      // append metadata
      if (metadata.getElements().size() > 0 || metadata.getAttributes().size() > 0)
      {
         xmlBuffer.append("<" + getPrefixedName(ADDR.getMetadataQName()));
         appendAttributes(xmlBuffer, metadata.getAttributes());
         xmlBuffer.append(">");
         appendElements(xmlBuffer, metadata.getElements());
         xmlBuffer.append("</" + getPrefixedName(ADDR.getMetadataQName()) + ">");
      }

      // append custom elements
      appendElements(xmlBuffer, getElements());
View Full Code Here

    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);
        setFrom(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);
      }
View Full Code Here

    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);
        setFrom(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);
      }
View Full Code Here

/*     */     try
/*     */     {
/*  94 */       SOAPHeader soapHeader = message.getSOAPHeader();
/*     */
/*  96 */       SOAPAddressingBuilder builder = new SOAPAddressingBuilderImpl();
/*  97 */       AddressingConstants ADDR = builder.newAddressingConstants();
/*  98 */       registerNamespaces(ADDR, soapHeader);
/*     */
/* 104 */       String to = getOptionalHeaderContent(soapHeader, ADDR.getToQName());
/* 105 */       if (to != null) {
/* 106 */         setTo(builder.newURI(to));
/*     */       }
/*     */
/* 110 */       Element wsaFrom = DOMUtils.getFirstChildElement(soapHeader, ADDR.getFromQName());
/* 111 */       if (wsaFrom != null)
/*     */       {
/* 113 */         EndpointReferenceImpl ref = new EndpointReferenceImpl(wsaFrom);
/* 114 */         setReplyTo(ref);
/*     */       }
/*     */
/* 121 */       Element wsaReplyTo = DOMUtils.getFirstChildElement(soapHeader, ADDR.getReplyToQName());
/* 122 */       if (wsaReplyTo != null)
/*     */       {
/* 124 */         EndpointReferenceImpl ref = new EndpointReferenceImpl(wsaReplyTo);
/* 125 */         setReplyTo(ref);
/*     */       }
/*     */
/* 131 */       Element wsaFaultTo = DOMUtils.getFirstChildElement(soapHeader, ADDR.getFaultToQName());
/* 132 */       if (wsaFaultTo != null)
/*     */       {
/* 134 */         EndpointReferenceImpl ref = new EndpointReferenceImpl(wsaFaultTo);
/* 135 */         setFaultTo(ref);
/*     */       }
/*     */
/* 141 */       String action = getRequiredHeaderContent(soapHeader, ADDR.getActionQName());
/* 142 */       setAction(builder.newURI(action));
/*     */
/* 146 */       String messageID = getOptionalHeaderContent(soapHeader, ADDR.getMessageIDQName());
/* 147 */       if (messageID != null) setMessageID(builder.newURI(messageID));
/*     */
/* 152 */       Iterator itRelatesTo = DOMUtils.getChildElements(soapHeader, ADDR.getRelatesToQName());
/* 153 */       List relList = new ArrayList();
/* 154 */       while (itRelatesTo.hasNext())
/*     */       {
/* 156 */         Element wsaRelatesTo = (Element)itRelatesTo.next();
/* 157 */         QName type = DOMUtils.getAttributeValueAsQName(wsaRelatesTo, ADDR.getRelationshipTypeName());
/* 158 */         String uri = DOMUtils.getTextContent(wsaRelatesTo);
/* 159 */         Relationship rel = builder.newRelationship(new URI(uri));
/* 160 */         rel.setType(type);
/* 161 */         relList.add(rel);
/*     */       }
View Full Code Here

/* 199 */       Element epRef = toElement();
/* 200 */       return DOMWriter.printNode(epRef, true);
/*     */     }
/*     */
/* 203 */     SOAPAddressingBuilder builder = new SOAPAddressingBuilderImpl();
/* 204 */     AddressingConstants ADDR = builder.newAddressingConstants();
/*     */
/* 206 */     String rootname = getPrefixedName(this.rootQName);
/* 207 */     StringBuilder xmlBuffer = new StringBuilder("<" + rootname);
/* 208 */     appendAttributes(xmlBuffer, getAttributes());
/* 209 */     xmlBuffer.append(">");
/*     */
/* 212 */     String wsaURI = ADDR.getNamespaceURI();
/* 213 */     String wsaPrefix = ADDR.getNamespacePrefix();
/* 214 */     String wsaDeclaration = " xmlns:" + wsaPrefix + "='" + wsaURI + "'";
/* 215 */     if (xmlBuffer.indexOf(wsaDeclaration) < 0)
/*     */     {
/* 217 */       xmlBuffer.insert(rootname.length() + 1, wsaDeclaration);
/*     */     }
/*     */
/* 221 */     xmlBuffer.append("<" + getPrefixedName(ADDR.getAddressQName()));
/* 222 */     appendAttributes(xmlBuffer, this.address.getAttributes());
/* 223 */     xmlBuffer.append(">");
/* 224 */     xmlBuffer.append(this.address.getURI() + "</" + getPrefixedName(ADDR.getAddressQName()) + ">");
/*     */
/* 227 */     if ((this.refParams.getElements().size() > 0) || (this.refParams.getAttributes().size() > 0))
/*     */     {
/* 229 */       xmlBuffer.append("<" + getPrefixedName(ADDR.getReferenceParametersQName()));
/* 230 */       appendAttributes(xmlBuffer, this.refParams.getAttributes());
/* 231 */       xmlBuffer.append(">");
/* 232 */       appendElements(xmlBuffer, this.refParams.getElements());
/* 233 */       xmlBuffer.append("</" + getPrefixedName(ADDR.getReferenceParametersQName()) + ">");
/*     */     }
/*     */
/* 237 */     if ((this.metadata.getElements().size() > 0) || (this.metadata.getAttributes().size() > 0))
/*     */     {
/* 239 */       xmlBuffer.append("<" + getPrefixedName(ADDR.getMetadataQName()));
/* 240 */       appendAttributes(xmlBuffer, this.metadata.getAttributes());
/* 241 */       xmlBuffer.append(">");
/* 242 */       appendElements(xmlBuffer, this.metadata.getElements());
/* 243 */       xmlBuffer.append("</" + getPrefixedName(ADDR.getMetadataQName()) + ">");
/*     */     }
/*     */
/* 247 */     appendElements(xmlBuffer, getElements());
/*     */
/* 249 */     xmlBuffer.append("</" + rootname + ">");
View Full Code Here

TOP

Related Classes of javax.xml.ws.addressing.AddressingConstants

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.