4 Replies Latest reply on Feb 20, 2006 5:02 AM by hbraun

    Call physical targetAddress and wsa:To

    thomas.diesler

       


      /wsa:To

      This OPTIONAL element (whose content is of type xs:anyURI) 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".


      Currently CallImpl uses this logic to derrive the physical target address. Is this right?

       // Use Stub.ENDPOINT_ADDRESS_PROPERTY
       String targetAddress = getTargetEndpointAddress();
      
       // Fall back to wsa:To
       AddressingConstantsImpl ADDR = new AddressingConstantsImpl();
       AddressingProperties addrProps = (AddressingProperties)msgContext.getProperty(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND);
       if (targetAddress == null && addrProps != null && addrProps.getTo() != null)
       {
       String wsaTo = addrProps.getTo().getURI().toString();
       if (wsaTo.equals(ADDR.getAnonymousURI()) == false)
       {
       try
       {
       URL wsaToURL = new URL(wsaTo);
       log.debug("Sending request to addressing destination: " + wsaToURL);
       targetAddress = wsaToURL.toExternalForm();
       }
       catch (MalformedURLException ex)
       {
       log.debug("Not a valid URL: " + wsaTo);
       }
       }
       }
      
       // The endpoint address must be known beyond this point
       if (targetAddress == null)
       throw new WSException("Target endpoint address not set");