The supplied example demonstrates the use of HTTP over SSL ( or https ) for communication between two Web Service end points on HP-WSP. Use of https protects the content exchanged and can also be used by one end point to authenticate the other.
The example consists of a simple Java class Hello
with method
String greet(String anme)
and a client class client.Client
. Class
Hello
is deployed as a Web Service and the client invokes the method
greet()
with the string specified in the command line parameter.
Note: The convention used in this readme file for pathnames, environment variables and script files is for Windows OS.
Configuration for https communication is a fairly involved process. Please refer to Web Services Over SSL - HOW TO guide for an overview and details of specific setup steps.
Run the ExampleTo run this example, perform following steps:
setHPWSEnv.bat
to reflect your setup. Here you need
to specify following environment variables:HPWS_CONTEXT_URL
: the context url for the HP-WSP servlet
( http://localhost:9443
if you are using HP-AS and followed
the configuration steps ),HPWS_HOME
: HP-WSP installation directory ( c:\hpmw\wsp by default ),HPWS_SERVLET_DIR
: HP-WSP Servlet directory ( should be
%HPWS_HOME%\WebApps\hpws unless you are using a WAR deployment and copying the WAR file
to the webapps directory of the Servlet container ),JAVA_OPTS
: options for JVM. Setting System property
java.protocol.handler.pkgs
is required if you have installed JSSE but is optional
for JDK1.4 onwards. Specifying System property javax.net.ssl.trustStore
is required
so that the client can verify the certificate presented by the server. Similarly, System
properties javax.net.ssl.keyStore
and javax.net.ssl.keyStorePassword
are
required so that the client can present its certificate to the server.deploy.bat
in the current directory.compile-client.bat
.run.bat
with
a string as argument. A sample session is shown below:
>run "Pankaj Kumar" .. skipped output .. greet() returned: Hello, Pankaj Kumar!! >
>run "Pankaj Kumar" 100 .. skipped output .. greet() returned: Hello, Pankaj Kumar!! [0] Avg. response time = 31 ms. [1] Avg. response time = 29 ms. [2] Avg. response time = 28 ms. [3] Avg. response time = 25 ms. >Note that the average response times are reported for four rounds of execution. This is to smooth out JIT compilation warm up overheads in initial cycles.
HPWS_CONTEXT_URL
in file setHPWSEnv.bat
to the http url,
restart the container, and then
go through the deploy
, compile-client
and run
sequence.deploy
and
compile-client
multiple times then you should keep in mind that the Servlet
container loads the service class and the WSDL file only once. It is a good idea to restart
the container for every cycle of deploy
and compile-client
invocation.hpas-deploy.xml
for HP-AS 8.0
and server.xml
for Tomcat 4.0.1 ) to become effective, you must restart the container.