users@jax-ws.java.net

turning off WS-Policy (and/or WSIT)

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

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>