WSDL Customization Issues and Workarounds in Java EE 6 Applications in NetBeans

  • submit to reddit
I've found a couple issues when using NetBeans to generate a WSDL file for an EE 6 web service, and then customizing that WSDL file. Some other users have reported them as well, so I thought I'd share them with the community.

  • When I set a new wsdlLocation attribute in the web service class, this is ignored and the default, autogenerated WSDL is used instead. It appears that GlassFish v3 doesn't recognize the wsdlLocation attribute. A bug against GlassFish has been reported (11437), there's a fix in the nightly GF builds, and the fix will be there in 3.0.1. In the meantime, it's probably worth downloading and installing the nightly GF build and registering this server in the IDE.

  • When you use NetBeans to generate the WSDL for an EE 6 JAX-WS service, generation fails because wsgen "Could not create declaration for annotation type javax.ejb.Stateless" or javax.ejb.EJB. Workaround is simply to comment out those annotations, generate WSDL, then uncomment them. Alternatively, add the javax.ejb.jar file from GlassFish /modules to your project classpath. Problem is reported as NetBeans bug 181867.
0
Your rating: None

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Tezzer Tez replied on Thu, 2010/03/25 - 1:53pm

Yup GlassFish v3 WSDL customization bug is a nuisance! A Netbeans alternative to the nightly build is :   // Comment: this is a convoluted way to create the proper xsd etc. namely -

    1. Create wsdl & xsd as required (possibly a modification to an auto generated set).  
    2. In a client generate the classes from the created wsdl/xsd files, that is
        use the new "Web Service Client" wizard - note this is just the ant
        wsimport (so you could try the generation manually just using wsimport?).  
    3. Include the generated package in the web service sources & set the parameters
        (see below), recompile & deploy! Phew!
        Note:  The <serviceName>.java file, in this case "YourServiceName.java", is NOT needed
        and can be deleted, as this is the client Service class that's used to connect the client to the
        service.
 

Also with use of the endpointInterface, the @WebMethod annotations are no longer valid so just comment them out until the fix!


@WebService(serviceName = "YourServiceName",
        targetNamespace="http://yourns/", // taken from the wsdl
        portName="YourServicePort", // taken from the wsdl
        endpointInterface="yourclientpackage...YourServiceInterface") // taken from the generated package

Matt Coleman replied on Mon, 2011/11/21 - 1:22am

thank you for fixing the glitches..it work fine now buffalo website design

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.