Daniel Kulp <[EMAIL PROTECTED]> writes:

> Technically, with JAX-WS, you don't need the wsdl.  However, the
> spec does say that if it's available/specified, we're supposed to
> use it.

Use it to supply default values? It seems like a large run time tax
that the WSDL2Java tool -- or something like it -- should be fixing
into code.

> For the most part, if you remove the wsdlLocation attribute, it
> should work.

Yes, I figured out somewhat after writing yesterday. It's annoying
that there's a no-arg constructor that supplies the WSDL location and
the service name, and there's a two-arg constructor requiring WSDL
location and service name. What I really want is a one-arg constructor
asking for the WSDL location -- which I could designate as null -- but
that uses the known service name. The code generator puts this service
name in the class as a manifest constant ("SERVICE"), but it's
private, so I can't even reuse the string when calling the two-arg
constructor myself. Oh, and I'm pretty sure the service name is
required, though I'm not sure why if the WSDL isn't provided.

I then saw that I could call addPort() to define a target, but then I
ran into this problem:

  Service.addPort(QName, String, String) does not accept binding ID
  javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING
  http://issues.apache.org/jira/browse/CXF-628

> The client side ends up being a bit different.   You don't really use the 
> generated service class.   Instead, you can do something like:
>
> PortClass port = Service.create(serviceName).getPort(PortClass.class);
> ((BindingProvider)port).getRequestContext().put(
>     BindingProvider.ENDPOINT_ADDRESS_PROPERY,
>     "http://foo.com/blah";);

Oh, that's different. What's the purpose of the serviceName attribute
passed to Service.create()?

> You MAY be able to pass null into the generated service for the
> wsdlLocation.  I'm not sure if that works or not.

Yes, it sort of works, but I'll need to get past the JIRA issue above
to know for sure.

> You would still need to set the endpoint address though.  That
> doesn't get recorded anywhere.

Oh, as that normally gets read from the WSDL at run time, not from an
annotation on the Service-derived class, right?

-- 
Steven E. Harris

Reply via email to