Scott Kurz wrote:
Simon,
The question is do we look at the <definitions> of the WSDL document
defining the imported portType
or the <definitions> of the document defining a WSDL service in terms of the
imported portType (since the TNS
of each are different).
I haven't read all of JAX-WS either but agree that the CXF behavior makes
more sense.
If you consider the question "which <definitions>?" it seems you'd naturally
pick the one in which
the portType is actually DEFINED as opposed to merely IMPORTED>
From what I can see the WSDL spec doesn't say anything particular about the
import behavior either.
On the one hand this isn't too critical since, with either choice, we
generate a just-as-legal
@WebService(targetNamespace....)
into the Java to capture the original TNS.
Doesn't this raise the same question? The @WebService annotation
for the generated Java interface should have the targetNamespace
of the portType. It seems an extremely reasonable assumption
that this is the same targetNamespace of the portType (whatever
that means) that will be used to derive the package name.
I tried this with the Sun RI and was surprised that it took the
targetNamespace for the @WebService annotation from the portType's
<wsdl:definitions>, even though it took the targetNamespace for
the package name from the service's <wsdl:definitions>.
This inconsistency seems wrong to me. My conclusion is that
CXF has got this right.
On the other hand, JAX-WS could have been clearer on this...
I agree. And this seems like a warning that in cases where the
spec is ambiguous, we should not assume that we can use the
Sun RI's behaviour to determine which interpretation is correct.
Simon
On Mon, Jun 9, 2008 at 4:45 AM, Simon Nash <[EMAIL PROTECTED]> wrote:
Jean-Sebastien Delfino wrote:
Scott Kurz wrote:
Sebastien, I'm surprised the package names would be different. What is
the namespace you're using that isn't mapping to the same package in each
tool?
Just curious...
My app is an order processing app with the following:
WSDL service namespace:
http://sample/Order/Binding
WSDL Order portType namespace:
http://sample/Order
The CXF tool generates interface sample.order.Order
The JAXWS RI tool generates interface sample.order.binding.Order
I gave the same WSDL file (containing the WSDL service) to both tools.
One could argue that both are correct vs the JAX-WS spec as they generate
a correct package name from the namespace of 'the' WSDL definition, but the
funny thing is that they do not pick the same WSDL definition... JAXWS-RI
picks the input definition given to the tool and CXF the definition that
actually contains the portType... and the JAXWS spec doesn't seem to state
which one should be picked (at least I couldn't find it).
IMHO the CXF behavior is better, but I've not read all 150 pages of the
JAX-WS spec so I may be missing something :)
From section 2.2 of the JAX-WS spec:
A wsdl:portType element is mapped to a Java interface in the package
mapped from the wsdl:definitions element (see section 2.1 for a
description of wsdl:definitions mapping).
Section 2.1 says:
A wsdl:definitions element and its associated targetNamespace
attribute is mapped to a Java package. JAXB[10] (see appendix D)
defines a standard mapping from a namespace URI to a Java package
name. By default, this algorithm is used to map the value of a
wsdl:definitions element's targetNamespace attribute to a Java
package name.
} Conformance (Definitions mapping): In the absence of customizations,
the Java package name is mapped from the value of a wsdl:definitions
element's targetNamespace attribute using the algorithm defined by
JAXB[10].
So IMO the Java package name that's used to map the portType should
be derived from the targetNamespace of the wsdl:definitions element.
What was this targetNamespace?
Simon