For JAX-RPC web services (J2EE 1.4 specification), the IDE uses the wscompile tool that is bundled with the Sun Java System Application Server to create the files that are needed for web service interaction. When you register the Sun Java System Application Server with the IDE, you are able to configure and run the wscompile tool from the IDE.
The IDE calls the wscompile tool when you build the web service, the web service client, or the project or enterprise application that contains them.
The wscompile tool reads a configuration file that the IDE generates when you create a web service or a web service client. The configuration file that the IDE generates for you varies depending on whether you are creating a web service from Java, a web service from an existing WSDL file, or a web service client:
The configuration file that the IDE provides for you specifies that the wscompile tool will generate a WSDL file from the service endpoint interface that is specified in the <interface> element.
<configuration xmlns='http://java.sun.com/xml/ns/jax-rpc/ri/config'> <service name='HiWS' targetNamespace='urn:HiWS/wsdl' typeNamespace='urn:HiWS/types' packageName='org.me.hi'> <interface name='org.me.hi.HiWSSEI' servantName='org.me.hi.HiWSImpl'> </interface> </service> </configuration>
The configuration file that the IDE provides for you specifies that that the wscompile tool will generate a service endpoint interface from the specified WSDL file.
<configuration xmlns="http://java.sun.com/xml/ns/jax-rpc/ri/config"> <wsdl location="C:\MyNetBeansProjects\Hi\HiWS/web/WEB-INF/wsdl/HiWS.wsdl" packageName="org.me.hi"/> </configuration>
The configuration file that the IDE provides for you specifies that the wscompile tool will generate the client-side artifacts from the specified WSDL file.
<configuration xmlns="http://java.sun.com/xml/ns/jax-rpc/ri/config"> <wsdl location="C:\MyNetBeansProjects\Hi\HiWSC1/web/WEB-INF/wsdl/HiWS.wsdl" packageName="org.me.hi"/> </configuration>
The information in these configuration files is processed by the wscompile tool together with the options and features that you have configured, as described in the following sections.
When you create a web service or a web service client, the IDE generates a compilation target in the build.xml file. The target calls the wscompile tool when you build the web service, the web service client, or the J2EE application that contains them. For web services, the target is named webservicename_wscompile. For web service clients, the target is named webclientname_client_wscompile.
The wscompile tool's options are configured in the target that calls the tool. The options applicable to their context are set by the IDE. For example, the target provided for a JSR-101 web service client includes an option (client="true") for the generation of stubs, while the target for JSR-109 web service clients does not. Instead, the target for JSR-109 web service clients includes an option (import="true") that lets the wscompile tool read a WSDL file and generate client files from it. (For information on the differences between JSR-101 and JSR-109, click here.)
The table below lists all the options supported by the wscompile tool and whether and how they are supported in the default targets provided by the IDE.
wscompile option |
Service from scratch/sources | Service from WSDL |
JSR-109 Client |
JSR-101 Client |
Description |
---|---|---|---|---|---|
-cp <path> | classpath =a |
classpath =a |
classpath =a |
classpath =a |
Specifies where to find input class files. |
-d <dir> | base =b |
base =b |
- | - | Specifies where to place generated output files. |
-define | - | - | - | - | Reads the service endpoint interface, defines a service. |
-features | featues =c |
featues =c |
featues =c |
featues =c |
Enables the specified features. You can use the IDE to select features for building a document-style web service, a RPC-style web service, a a web service from a WSDL file, or a client. |
-g | - | - | - | - | Generates debugging info. |
-gen: both |
- | - | - | - | Generates both client and server artifacts. |
-gen: client |
- | - | client= "false" |
client= "true" |
If "true", generates client artifacts (stubs, etc.). |
-gen: server |
server= "true" |
- | - | - | If "true", generates web service artifacts (ties, etc.) and the WSDL file. |
-httpproxy :<host> :<port> |
- | - | - | - | Specifies a HTTP proxy server. The default is 8080. |
-import | - | import= "true" |
import= "true" |
import= "false" |
If "true", reads a WSDL file, generates the service endpoint interface and a template of that class that implements the interface. |
-keep | keep= "true" |
keep= "true" |
keep= "true" |
keep= "true" |
If "true", keeps generated files. |
-mapping <file> | mapping=d | mapping=d | mapping=d | mapping=d | Generates a J2EE mapping.xml file. |
-model <file> | - | - | - | - | Writes the internal model to the specified file. |
-nd <dir> | nonClassDir =e |
nonClassDir =e |
- | - | Specifies where to place the WSDL file. |
-O | - | - | - | - | Optimizes generated code. |
-s <dir> | - | - | sourceBase =f |
sourceBase =f |
Specifies where to place generated source files. |
-source <version> | - | - | - | - | Generates code for the specified JAX-RPC SI version. |
-verbose | verbose= "true" |
verbose= "true" |
verbose= "false" |
verbose= "false" |
If "true", outputs messages about what the compiler is doing. |
-version | - | - | - | - | Prints version information. |
Key
a = ${wscompile.classpath}
b = ${build.generated.dir}/wssrc or ${build.classes.dir}
c = ${wscompile.service.webservicename-or-clientname.features}
d = ${build.web.dir}/WEB-INF/wsdl/${webservicename-or-clientname.mapping}
e = ${build.web.dir}/WEB-INF/wsdl
f = ${build.generated.dir}/wssrc
You can use the IDE to set features provided by the wscompile tool. For example, when you build a web service, you can specify its style. For details on the available features and instructions on how to set them, see the following topics: