james-
that is correct, this has not been done yet-
Thanks for the ping...
jastrachan_at_mac.com wrote:
>
> On 1 Sep 2005, at 11:27, 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....
>
>
> [snip]
>
> My patch never made it into CVS :(.
>
> Though things have moved about quite a bit since then. So I've
> recreated my patch again using the latest CVS HEAD...
>
>------------------------------------------------------------------------
>
>Index: WSServiceDelegate.java
>===================================================================
>RCS file: /cvs/jax-ws-sources/jaxws-ri/rt/src/com/sun/xml/ws/client/WSServiceDelegate.java,v
>retrieving revision 1.8
>diff -u -r1.8 WSServiceDelegate.java
>--- WSServiceDelegate.java 14 Sep 2005 20:15:50 -0000 1.8
>+++ WSServiceDelegate.java 22 Sep 2005 09:29:38 -0000
>@@ -37,6 +37,7 @@
> import java.lang.reflect.AnnotatedElement;
> import java.lang.reflect.Proxy;
> import java.net.URI;
>+import java.net.URISyntaxException;
> import java.net.URL;
> import java.rmi.Remote;
> import java.util.*;
>@@ -306,7 +307,7 @@
>
>
> private Dispatch createDispatchClazz(QName port, Class clazz, Service.Mode mode) throws WebServiceException {
>- PortInfoBase dispatchPort = dispatchPorts.get(port);
>+ PortInfoBase dispatchPort = getDispatchPort(port);
> if (dispatchPort != null) {
> DispatchBase dBase = new DispatchBase((PortInfoBase) dispatchPort, clazz, (Service.Mode) mode, this);
> setBindingOnProvider(dBase, port, dBase._getBindingId());
>@@ -317,7 +318,7 @@
> }
>
> private Dispatch createDispatchJAXB(QName port, JAXBContext jaxbContext, Service.Mode mode) throws WebServiceException {
>- PortInfoBase dispatchPort = dispatchPorts.get(port);
>+ PortInfoBase dispatchPort = getDispatchPort(port);
> if (dispatchPort != null) {
> DispatchBase dBase = new DispatchBase((PortInfoBase) dispatchPort, jaxbContext, mode, this);
> setBindingOnProvider(dBase, port, dBase._getBindingId());
>@@ -327,6 +328,31 @@
> }
> }
>
>+ /**
>+ * 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;
>+ }
>+
> private URL getWsdlLocation() {
> return serviceContext.getWsdlContext().getWsdlLocation();
> }
>
>
>
> ------------------------------------------------------------------------
>
>
>
>
> If its easier I've attached the full modified version of the file...
>
>
> Its a pretty trivial patch; if you try to dispatch to a dispatchPort
> that's not been added/used before it double checks in the WSDL
> context to see if its a known port and adds it for you - since it
> knows all of the information required to add the port.
>
> I'm assuming this is still a valid approach right? It seems silly for
> the Service to parse the WSDL & know the bindingId and
> endpointAddress of all the ports - then for a user to be able to
> dispatch to a port, they have to re-parse the WSDL themselves to find
> the bindingID and endpointAddress to then call addPort() so that the
> createDispatch() method will actually work.
>
> If so I'm quietly hopeful it can be committed soon so I don't have to
> depend on a patched version of JAX-WS RI :)
>
> 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
>
>