Thoughts and Tutorials about Continuous Integration, Application Integration, SOA, IT Architecture, WebSphere and Liferay

Mar 30, 2009

Web service cache [client sided]

To enable a client side cache for web service requests (in a WebSphere client) you need first to activate the dynamic cache service and servlet caching (see post before).
Then you need to create a cachespec.xml

<name>http://"your-url":9080/service/"your service"</name>
<component id="hash" type="SOAPEnvelope"/>

and place it into the WEB-INF-Folder of your client app.
The cachespec.xml above is configured to compare the different requests through a HASH-Value (which is calculated for every request).
This is the easiest way to implement a client web service cache.
For more infos visit this site.

Mar 20, 2009

Setup Web service cache [server sided]

In this post i will explain how to use the web service server cache in WebSphere Application Server 6.1.

1. First you need to active the dynamic cache service and servlet caching in WebSphere via the administrative console
1.1. Navigate to Servers > Application servers > "your server" > Container services > Dynamic cache service
1.2 Activate "Enable service at startup" and click "OK" and "Save" to apply this setting.
1.3 Navigate to Servers > Application serves > "your server" > Web Container Settings > Web container
1.4 Activate "Enable servlet caching" and click "OK" and "Save" to apply this setting.
1.3 Restart server

2. Deploy the dynamic cache monitor to get a view of current state of the dynamic cache service
2.1 Locate the CacheMonitor.ear under "WebSphere-System-Root"\installableApps\
2.2 Deploy the ear-File (standard context root: cachemonitor)

3. Add a cachespec.xml (and the cachespec.dtd (located at /"websphere-sys-root"/properties) to your webservice project (Folder WEB-INF/)
3.1 The cachespec.xml should look like this:
<name>"service name"</name>
<component id="Hash" type="SOAPEnvelope" />
"service name" = e.g. /services/Repository
3.2 (Re-)deploy the Web service application

A sample cachespec-file can be found at "WebSphere-System-Root"/properties

Hint 2:
To enable web service cache through a Web services gateway (WSGW) see this link.

Mar 10, 2009

Generate a .NET Web service client for a Java EE Web service

[BETA] :-)
One of the advantages of Web services is the interoperability.
Thus its possible to use a .NET-Client for a Web services written in Java.
Just the WSDL is needed.

1. Install the newest Mircosoft .NET SDK
2. Locate the wsdl.exe in the .NET SDK-Installation (e.g. C:\PROGRA~1\Microsoft.NET\SDK\v2.0\Bin)
3. Execute
"SDK-Location (bin)"\wsdl.exe "Your WSDL-File"
4. You should now see a "your service"Client.cs - File. The .cs-File is the source code for the web service client proxy. These code/methods is/are used to access the web service.
5. To access the web service you need to instantiate the proxy client in your client code
YourService proxy = new YourService ();
To call the needed methode use something like
String result = proxy.findItem("123454");

5. To compile the C-Sourcecode without your IDE locate csc.exe in of the .NET SDK-Installation (e.g. C:\PROGRA~1\Microsoft.NET\SDK\v2.0.50727)
6. Execute
"SDK-Location"\csc.exe /t:exe /r:System.Web.dll,System.XML.dll,System.Web.Services.dll "your client code file" "proxy client code file"

7. You should now have a EXE-File of the client.

8. Test IT!