users@jax-ws.java.net

JAX-WS 2.1 backward compatibility (was "turning off WS-Policy (and/or WSIT)")

From: Mark Hansen <marklists_at_javector.com>
Date: Thu, 22 Mar 2007 15:13:23 -0400

This issue is interesting to me because it raises JAX-WS 2.1 backward
compatibility issues. I understand that the CTS for Java EE 5 allows
either JAX-WS 2.0 or 2.1.

The code discussed in the message below runs on GF V1 with JAX-WS 2.0.
It does not run on GF V2 with JAX-WS 2.1. The reason is that the WSIF
markup introduced into the WSDL causes the Java SE client side code to fail.

I've discovered that I can remove the WSIF markup by adding the
following annotation to the EJB:
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)

Here is the interesting question, however. Doesn't the dependence of
the WSDL on the @TransactionAttribute that is introduced by JAX-WS 2.1
create an undesirable kind of non-portability? Because, suppose I have
a Java SE client using the code below running just fine against an
@WebService EJB deployed on a JAW-WS 2.0 container, and then that
container is upgraded to JAX-WS 2.1 (which is still a Java EE 5 CTS
certified container), then my SE client will fail.

Maybe the WSIT markup in the WSDL should be optional, with the default
turned off? What do you think?

-- Mark


Mark Hansen wrote:

> I'm deploying a @WebService / @Stateless. The WSDL generated in GF V2
> B39 (built with JAX-WS 2.1) contains a bunch of WS-Policy markup (see
> below).
> When I generate a service/port from this WSDL using this code:
>
> String hostVal = System.getProperty("glassfish.host");
> String portVal = System.getProperty("glassfish.deploy.port");
> URL wsdlURL =
> new URL("http://"+hostVal+":"+portVal+"/HelloService/Hello?wsdl");
> printWSDL(wsdlURL);
> QName serviceQName = new QName("http://samples/", "HelloService");
> QName portQName = new QName("http://samples/", "HelloPort");
> Service service = Service.create(wsdlURL, serviceQName);
> Hello port = (Hello) service.getPort(portQName, Hello.class);
> String result = port.sayHello("Java Programmer");
>
> (Hello.class is the SEI generated from the Hello class below by wsgen)
>
> then, I get this error:
>
> java.lang.NoClassDefFoundError"
> message="com/sun/enterprise/transaction/TransactionImport">java.lang.NoClassDefFoundError:
> com/sun/enterprise/transaction/TransactionImport
>
> Why am I getting this error? And how can I turn off the WS-Policy
> markups in the WSDL?
>
> -- Mark
>
>
> @STATELESS POJO
> ======================
> @WebService
> @Stateless
> public class Hello {
>
> @WebServiceRef(value = MyWebService.class,
> wsdlLocation="http://someplace/myService?wsdl")
> MyWeb port;
>
> @EJB
> Goodbye goodbye;
> @Resource(name="myString")
> String injectedString = "undefined";
>
> public String sayHello(String s) {
> String webServiceString = port.saySomething(s);
> String goodbyeString = goodbye.sayGoodbye(s);
> return "Hello: " + s + "[injectedString: " + injectedString + "]" +
> System.getProperty("line.separator") + webServiceString +
> System.getProperty("line.separator") + goodbyeString;
> }
>
> }
>
> Resulting WSDL
> ===============
> <definitions
> xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
> xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> xmlns:tns="http://samples/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns="http://schemas.xmlsoap.org/wsdl/"
> targetNamespace="http://samples/" name="HelloService">
> <wsp:UsingPolicy/>
> <wsp:Policy wsu:Id="HelloPortBinding_sayHello_WSAT_Policy">
> <wsp:ExactlyOne>
> <wsp:All>
> <ns1:ATAlwaysCapability
> xmlns:ns1="http://schemas.xmlsoap.org/ws/2004/10/wsat"
> wsp:Optional="false"/>
> <ns2:ATAssertion
> xmlns:ns3="http://schemas.xmlsoap.org/ws/2002/12/policy"
> xmlns:ns2="http://schemas.xmlsoap.org/ws/2004/10/wsat"
> ns3:Optional="true" wsp:Optional="true"/>
> </wsp:All>
> </wsp:ExactlyOne>
> </wsp:Policy>
> <types>
> <xsd:schema>
> <xsd:import namespace="http://samples/"
> schemaLocation="http://localhost:8080/HelloService/Hello?xsd=1"/>
> </xsd:schema>
> </types>
> <message name="sayHello">
> <part name="parameters" element="tns:sayHello"/>
> </message>
> <message name="sayHelloResponse">
> <part name="parameters" element="tns:sayHelloResponse"/>
> </message>
> <portType name="Hello">
> <operation name="sayHello">
> <input message="tns:sayHello"/>
> <output message="tns:sayHelloResponse"/>
> </operation>
> </portType>
> <binding name="HelloPortBinding" type="tns:Hello">
> <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
> style="document"/>
> <operation name="sayHello">
> <wsp:PolicyReference URI="#HelloPortBinding_sayHello_WSAT_Policy"/>
> <soap:operation soapAction=""/>
> <input>
> <soap:body use="literal"/>
> </input>
> <output>
> <soap:body use="literal"/>
> </output>
> </operation>
> </binding>
> <service name="HelloService">
> <port name="HelloPort" binding="tns:HelloPortBinding">
> <soap:address location="http://localhost:8080/HelloService/Hello"/>
> </port>
> </service>
> </definitions>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jax-ws.dev.java.net
> For additional commands, e-mail: users-help_at_jax-ws.dev.java.net
>