users@jax-rpc.java.net

Re: [PATCH] Service.createDispatch(QName, *) doesn't know about the ports available

From: Kathy Walsh <Kathleen.Walsh_at_Sun.COM>
Date: Thu, 01 Sep 2005 08:44:42 -0400

james-
Thanks- yes this is a known bug-
By coincidence, I was just looking at this last night and this
will be fixed shortly.

Thanks for using JAX-WS 2.0 EA.
Kathy

jastrachan_at_mac.com wrote:

> I've been trying to use the createDispatch(QName, ...) method for a
> service I've created from a WSDL. Unfortunately the WebService
> implementation does not use the WSDL information to know about the
> available ports and their binding detals so it throws an exception if
> I try to create a Dispatcher for a known port.
>
> The work around is to explicitly call addPort() first before using it
> - but given that the WebService has parsed the WSDL and knows what
> all the ports are it seems silly to force the user to add all the
> ports that WebService already knows about right?
>
> I'm assuming this is just an oversight/bug and that I'm the first to
> hit this - please forgive me if I've misunderstood. As an experiment
> I thought I'd try patch WebService to actually find the available
> ports from the WSDL and use those by default which seems much nicer
> and less surprising from an end users perspective. It turns out it
> was very simple to do - I just added this new method to the
> WebService class....
>
>
> /**
> * Looks up the dispatch port. If the port has not been added,
> then try look in the WSDL to find it.
> */
> protected PortInfoBase getDispatchPort(QName port) {
> PortInfoBase answer = dispatchPorts.get(port);
> if (answer == null) {
> // lets try find it in the WSDL
> WSDLContext wsdlContext = serviceContext.getWsdlContext();
> QName serviceName = serviceContext.getServiceName();
> Binding binding = wsdlContext.getWsdlBinding (serviceName,
> port);
> if (binding != null) {
> try {
> URI bindingId = new URI(binding.getBindingId());
> String endpointAddress = wsdlContext.getEndpoint
> (serviceName);
> addPort(port, bindingId, endpointAddress );
> answer = dispatchPorts.get(port);
> }
> catch (URISyntaxException e) {
> throw new WebServiceException(e);
> }
> }
> }
> return answer;
> }
>
> then replaced the 2 uses of dispatchPorts.get(port) with a call to
> this method. I've attached my amended file too if that makes it
> easier to apply the patch.
>
> This change works great for me - does this sound a reasonable patch
> to apply?
>
>
> James
> -------
> http://radio.weblogs.com/0112098/
>
>
>------------------------------------------------------------------------
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
>For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net
>
>