Skip to main content

How To Refresh Web Services in Creator 2

Posted by ddevore on January 26, 2006 at 6:14 AM PST

If you are developing a front end for Web Services in Creator 2 and need to make a change to the Web Service currently there is no automatic way to tell Creator to refresh the Web Service and regenerate the libs for the service. This document will walk you through refreshing the web service so that you can see the changes made to the Web Service.

Remove the Web Service from the Project
First you must remove all references to the Web Service from the pages which currently use it. To do this you must remove the references to the service from each page which uses it. First select the page and select the Outline tab on the lower half of the left side of the screen. Find the reference to the service and delete it. Then select the Java button to open the Java source for the page. Since the reference for the service has been deleted the references to the service should show as an error, comment out all references to the service. Once you have done this for allpages which reference the service click on the Servers and select the Web Services section and delete the reference to the service from the list of services. Once all references to the service are removed clean the project and shut down Creator.

Remove the libs
Next you must remove the libs from the lib directory. To do this go to the project directory and expand the lib/webservice_clients directory, this is where all generated Web Service libs are held. The libs for the Web Service will begin with the service name for the service I am working with it is ChangeofAddress so my files are named like this:

ChangeofAddress-1133983181995.jar
ChangeofAddress-1133983181995DesignTime.jar

Remove these files.

Remove references from project properties
Next we must remove the references from the projects properties. Go to the project directory and expand the nbproject directory. Edit the project.properties file and search for the lines with the service name. You will find 3 references to the libs. The first is easy simply remove the lines. The second and third you must modify the line above it for the project to properly open. The following is a list of the references and how to modify them to remove them from the project properly.

1. Remove these lines

file.reference.ChangeofAddress-1133983181995.jar
=lib/webservice_clients/ChangeofAddress-1133983181995.jar
file.reference. ChangeofAddress-1133983181995DesignTime.jar
=lib/webservice_clients/ChangeofAddress-1133983181995DesignTime.jar

2. Modify as follows

&nbsp&nbsp&nbsp&nbsp${libs.WEBSVC_SUPPORT_LIB.classpath}:\
&nbsp&nbsp&nbsp&nbsp${file.reference.ChangeofAddress-1133983181995.jar}:\
&nbsp&nbsp&nbsp&nbsp${file.reference.ChangeofAddress-1133983181995DesignTime.jar}
# Space-separated list of extra javac options

Modify like this

&nbsp&nbsp&nbsp&nbsp${libs.WEBSVC_SUPPORT_LIB.classpath}
# Space-separated list of extra javac options

Keep in mind that if there are more services being referenced there may be more jar files listed. The important thing to remember is that if this is the last in the list REMOVE the :\ at the end before the # Space-separated list of extra javac options line.

3. Modify as follows

&nbsp&nbsp&nbsp&nbsp${libs.WEBSVC_SUPPORT_LIB.classpath}:\
&nbsp&nbsp&nbsp&nbsp${file.reference.ChangeofAddress-1133983181995.jar}:\
war.ear.name=LibTest.war

Modify like this

&nbsp&nbsp&nbsp&nbsp${libs.WEBSVC_SUPPORT_LIB.classpath}
war.ear.name=LibTest.war

Once again keep in mind that if there are more services being referenced there may be more jar files listed. The important thing to remember is that if this is the last in the list REMOVE the :\ at the end before the war.ear.name=LibTest.war line.

Next edit the project.xml file and remove the references to the libs there. There are 2 references in this file and can be simply removed. The following is the example for the service I am removing.

The first is a reference to both jar files, remove them with the library files begin and end tags.

&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<library files="1">
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<file>${file.reference.ChangeofAddress-1133983181995.jar}</file>
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</library>
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<library files="1">
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<file>${file.reference.ChangeofAddress-1133983181995DesignTime.jar}</file>
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</library>

The second is a reference to the actual service client jar file, remove it with the library files begin and end tags.

&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<library files="1">
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<file>${file.reference.ChangeofAddress-1133983181995.jar}</file>
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<path-in-war>WEB-INF/lib</path-in-war>
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</library>

Resume Development
Once those are removed youcan continue development. Start Creator, add the service back to the Servers | Web Services, add it back to the pages which need it and uncomment the code commented out while removing it from the project. Once this is done you will see the changes. Please note that when you add a service to a page a second time it may change the object reference like this changeofAddressClient2 instead of changeofAddressClient1 so you may need to modify some of the code you commented out to reflect this change.

Notes
I have been told that they are working on this problem but since I have run into it I figured that some other prople would have also and they might want to know how to insure they were working on the latest version.

Related Topics >>