Using Netbeans 5.0 Web Service Clients in Java Studio Creator 2

I've recently had a Java Studio Creator 2 user come to me trying to consume a web service but the WSDL for the web service was not exactly WS-I compliant.  In particular, this the WSDL had a problem with the "-f:searchschema" option of the "wscompile" command.  For those of you using Creator for web services, you may or may not know that Creator uses the JAX-RPC toolkit.  The current version of the toolkit is called JAX-WS.  There is a tool called "wscompile" that generates web service client code from a WSDL.  In Creator, I had a difficult time deciding which wscompile options would work best in all cases.  Up until this latest problem, the options worked for most cases.  I did externalize the "WS-I" compliance and "Generate SOAP Headers" options at one point.  Apparently I need to externalize more options, in fact maybe all of them.  I really wanted to isolate the Creator user from the details of wscompile to help with the ease-of-use story.  In any case, if you have a WSDL that won't compile correctly in Creator, you can use NetBeans 5.0 to generate the web service client and use the client in Creator.

Creating the NetBeans 5.0 Web Service Client

The following steps are the easiest way I found to generate a web service client in NetBeans 5.0.

1. Create a new "General->Java Class Library" project.

NetBeans Web Service Client Project

2. Right-click on the new project and select "new->web service client".

3. Browse the the WSDL you want to use and enter a package name.

Looking for WSDL

4. Build the project to create the Jar file under the "dist" directory.

5. If you have problems compiling the WSDL, look at the Project properties "Web Service Clients" node.  You'll see the features for the wscompile command.

wscompile args

Here's the list of what these features do.


Feature

Description

datahandleronly

always map attachments to the DataHandler type

donotoverride

do not regenerate classes that already exist in the classpath

donotunwrap

disable unwrapping of document/literal wrapper elements in WSI mode (default)

explicitcontext

turn on explicit service context mapping ( generates SOAP headers)
jaxbenumtype
Map anonymous enumeration to its base type

nodatabinding

turn off data binding for literal encoding

norpcstructures

do not generate RPC structures (-import only)

novalidation

turn off full validation of imported WSDL documents

resolveidref

resolve xsd:IDREF

searchschema

search schema aggressively for types

strict

generate code strictly compliant with JAXRPC spec

unwrap

enable unwrapping of document/literal wrapper elements in WSI mode

wsi

enable WSI-Basic Profile features, to be used for document/literal and rpc/literal

Using the NetBeans 5.0 Web Service Client in Creator

1. Create a web or portlet project  in Creator 2.

2. Right-click on the project node and select properties.

3. In the properties dialog,  select "Libraries" from the "Categories:" and do "Add JAR/Folder".

Project properties

4. Now you have access to the web service client code from the Creator backing bean actions.  Here's an example with the TravelWS.wsdl shipped with Creator.

Backing Code
Cheers!
-David
Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

David Botterill

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today