Wednesday 14 March 2012

An Analysis of JAX-WS usage of NetBeans2.2

Webclient Content Comparison of development phases

1. The comparison of the initial and wsimport phases. Wsimport phase includes only the creation of WSDL based connection to the webservice.

1.1 A new build folder is created at the project root although we have not done any build operation. This folder has:

webclient\build

03/11/2012 07:24 PM <DIR> .
03/11/2012 07:24 PM <DIR> ..
03/11/2012 07:24 PM <DIR> generated
03/11/2012 07:24 PM <DIR> generated-sources
0 File(s) 0 bytes

As seen above two new folders named generrated and generated-sources are created in the new build folder. These folders contain the generated java files related with the webservice. Generated and generated-sources are exactly the same.
webclient\build\generated\jax-wsCache\HelloService\webclient has:

03/11/2012 07:24 PM <DIR> .
03/11/2012 07:24 PM <DIR> ..
03/11/2012 07:22 PM 1,751 Hello.java
03/11/2012 07:22 PM 745 HelloResponse.java
03/11/2012 07:22 PM 2,957 HelloService.java
03/11/2012 07:22 PM 718 Hello_Type.java
03/11/2012 07:22 PM 3,693 ObjectFactory.java
03/11/2012 07:22 PM 103 package-info.java
03/11/2012 07:22 PM 1,347 SayHello.java
03/11/2012 07:22 PM 1,481 SayHelloResponse.java
8 File(s) 12,795 bytes

webclient\build\generated-sources\jax-ws\webclient
...
8 File(s) 12,795 bytes

1.2 The nbproject folder has changed similar to the webservice creation phase. There is a new
Jaxws-build.xml and jax-ws.xml addition. But this time wsimport facilities are used in the jaxws-build.xml.
1.2.1 Project.xml
<?xml version="1.0" encoding="UTF-8" ?>
- <project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.web.project</type>
- <configuration>
- <buildExtensions xmlns="http://www.netbeans.org/ns/ant-build-extender/1">
- <extension file="jaxws-build.xml" id="jaxws">
<dependency dependsOn="wsimport-client-generate" target="-pre-pre-compile" />
</extension>
</buildExtensions>

1.2.2 jax-ws.xml
<?xml version="1.0" encoding="UTF-8" ?>
- <jax-ws xmlns="http://www.netbeans.org/ns/jax-ws/1">
<services />
- <clients>
- <client name="HelloService">
<wsdl-url>http://ars-PC:8080/helloservice/HelloService?wsdl</wsdl-url>
<local-wsdl-file>ars-PC_8080/helloservice/HelloService.wsdl</local-wsdl-file>
<package-name forceReplace="true">webclient</package-name>
<catalog-file>catalog.xml</catalog-file>
- <wsimport-options>
- <wsimport-option>
<wsimport-option-name>extension</wsimport-option-name>
<wsimport-option-value>true</wsimport-option-value>
</wsimport-option>
- <wsimport-option>
<wsimport-option-name>verbose</wsimport-option-name>
<wsimport-option-value>true</wsimport-option-value>
</wsimport-option>
- <wsimport-option>
<wsimport-option-name>wsdlLocation</wsimport-option-name>
<wsimport-option-value>http://ars-PC:8080/helloservice/HelloService?wsdl</wsimport-option-value>
</wsimport-option>
- <wsimport-option>
<wsimport-option-name>xnocompile</wsimport-option-name>
<wsimport-option-value>true</wsimport-option-value>
</wsimport-option>
- <wsimport-option>
<wsimport-option-name>xendorsed</wsimport-option-name>
<wsimport-option-value>true</wsimport-option-value>
</wsimport-option>
- <wsimport-option>
<wsimport-option-name>package</wsimport-option-name>
<wsimport-option-value>webclient</wsimport-option-value>
</wsimport-option>
</wsimport-options>
</client>
</clients>
</jax-ws>

1.2.3 jaxws-build.xml
<?xml version="1.0" encoding="UTF-8" ?>
- <!--
*** GENERATED FROM jax-ws.xml - DO NOT EDIT ! ***
*** TO MODIFY wsimport options USE Web Service node -> Edit WS Attributes ***
*** TO CHANGE TARGETS GENERATED TO jaxws-build.xml COPY THOSE ***
*** TARGETS TO ../build.xml AND MODIFY THAT FILE INSTEAD ***


-->
- <project xmlns:xalan="http://xml.apache.org/xslt" xmlns:webproject2="http://www.netbeans.org/ns/web-project/2" xmlns:jaxws="http://www.netbeans.org/ns/jax-ws/1">
- <!--
===================
JAX-WS WSGEN SECTION
===================

-->
- <!--
===================
JAX-WS WSIMPORT SECTION
===================

-->
- <target name="wsimport-init" depends="init">
<mkdir dir="${build.generated.sources.dir}/jax-ws" />
<property name="j2ee.platform.wsimport.classpath" value="${libs.jaxws21.classpath}" />
- <taskdef name="wsimport" classname="com.sun.tools.ws.ant.WsImport">
<classpath path="${java.home}/../lib/tools.jar:${j2ee.platform.wsimport.classpath}" />
</taskdef>
- <condition property="conf-dir" value="${conf.dir}/" else="">
<isset property="conf.dir" />
</condition>
</target>
- <target name="wsimport-client-HelloService" depends="wsimport-init">
<mkdir dir="${build.generated.dir}/jax-wsCache/HelloService" />
- <wsimport sourcedestdir="${build.generated.dir}/jax-wsCache/HelloService" destdir="${build.generated.dir}/jax-wsCache/HelloService" wsdl="${basedir}/${conf-dir}xml-resources/web-service-references/HelloService/wsdl/ars-PC_8080/helloservice/HelloService.wsdl" catalog="catalog.xml" extension="true" verbose="true" wsdlLocation="http://ars-PC:8080/helloservice/HelloService?wsdl" xnocompile="true" xendorsed="true" package="webclient">
<depends file="${basedir}/${conf-dir}xml-resources/web-service-references/HelloService/wsdl/ars-PC_8080/helloservice/HelloService.wsdl" />
<produces dir="${build.generated.dir}/jax-wsCache/HelloService" />
</wsimport>
- <copy todir="${build.generated.sources.dir}/jax-ws">
- <fileset dir="${build.generated.dir}/jax-wsCache/HelloService">
<include name="**/*.java" />
</fileset>
</copy>
</target>
- <target name="wsimport-client-clean-HelloService" depends="-init-project">
<delete dir="${build.generated.sources.dir}/jax-ws/webclient" />
<delete dir="${build.generated.dir}/jax-wsCache/HelloService" />
</target>
<target name="wsimport-client-generate" depends="wsimport-client-HelloService" />
</project>

1.3 The last change is the xml-resources folder created newly in the /src/conf/ folder as seen below:
Directory of C:\Users\ars\Desktop\webclientARS\src\conf\xml-resources\web-service-references\HelloService\wsdl\ars-PC_8080\helloservice

03/11/2012 07:24 PM <DIR> .
03/11/2012 07:24 PM <DIR> ..
03/11/2012 07:22 PM 2,593 HelloService.wsdl
03/11/2012 07:22 PM 1,024 HelloService.xsd_1.xsd
2 File(s) 3,617 bytes

The folder above contains the WSDL files.

1.4 webclient\web\WEB-INF\wsdl\ars-PC_8080\helloservice folder also has the wsdl files:
HelloService.wsdl and HelloService.xsd_1.xsd


2. The comparison of the output of the build phase to the WS-IMPORT phase.

2.1 As expected the build phase creates the dist folder which contains the distribution WAR. It also creates the web folder in the build folder.

Directory of C:\Users\ars\Desktop\webclientARS\build\web\WEB-INF

03/11/2012 08:18 PM <DIR> .
03/11/2012 08:18 PM <DIR> ..
03/11/2012 08:18 PM <DIR> classes
03/11/2012 08:18 PM 521 glassfish-web.xml
03/11/2012 08:18 PM 411 jax-ws-catalog.xml
03/11/2012 08:18 PM <DIR> wsdl
2 File(s) 932 bytes

...

webclient\build\web\WEB-INF\classes\webclient

03/11/2012 08:18 PM <DIR> .
03/11/2012 08:18 PM <DIR> ..
03/11/2012 08:18 PM 1,183 Hello.class
03/11/2012 08:18 PM 507 HelloResponse.class
03/11/2012 08:18 PM 2,691 HelloService.class
03/11/2012 08:18 PM 2,611 HelloServlet.class
03/11/2012 08:18 PM 490 Hello_Type.class
03/11/2012 08:18 PM 2,778 ObjectFactory.class
03/11/2012 08:18 PM 244 package-info.class
03/11/2012 08:18 PM 757 SayHello.class
03/11/2012 08:18 PM 863 SayHelloResponse.class
9 File(s) 12,124 bytes


...
webclient\build\web\WEB-INF\wsdl\ars-PC_8080\helloservice

03/11/2012 08:18 PM <DIR> .
03/11/2012 08:18 PM <DIR> ..
03/11/2012 08:18 PM 2,593 HelloService.wsdl
03/11/2012 08:18 PM 1,024 HelloService.xsd_1.xsd
2 File(s) 3,617 bytes

Nbproject folder shows some changes at genfiles.properties, which may be trivial.

2.2 It creates an empty ap-source-output folder in the build/generated-sources folder.

3. The comparison of the outcome of the execution phase to the build phase in terms of the files’ and folders’ of the project follows: Please notice the lengths of Hello.class and HelloServlet.class which reside at webclient\build\web\WEB-INF\classes\webclient
have increased after running the client.