How to use Out of Box Web Services sample codes

  • KM01174324
  • 22-Sep-2014
  • 10-Nov-2014

Summary

This documents provides the information of where to find and how to use the Out of Box Web Services sample codes

Question

Service Manager (SM) provides Out of Box (OOB) Web Services sample codes. Users could find them under SM Installation directory and use it after compiling.

Answer

OOB Web Services sample codes can be found under <SM Installation Directory>\Server\webservices\sample

There are 2 sub-directory sc6webservices and sm7webservices, which are used for different URL's access.

SM publishes two different URL for SOAP:

http://<server>:<port>/SM/7

http://<server>:<port>/sc62server/PWS

The first URL provides complete functionality as the second one, except that it uses MTOM attachments.

The second URL it is a fully implemented Service Manager7 Web Services interface using MIME attachments.

SM server includes two sample Web Services client applications for http://<server>:<port>/sc62server/PWS/service_name.wsdl

One for Apache™ Axis and another for Microsoft™ Visual Studio .NET.

<SM Installation Directory>\Server\webservices\sample\sc6webservices\AxisSample

<SM Installation Directory>\Server\webservices\sample\sc6webservices\DotNetSample

The sample for URL http://<server>:<port>/SM/7/service_name.wsdl was created for Apache™ Axis2.

The path is <SM Installation Directory>\Server\webservices\sample\sm7webservices\Axis2Sample

Above sample codes need to be complied before using. They are not for all modules. Currently SM provides those for configuration management and incident management.

Take following as example (for Apache™ Axis):

<SM Installation Directory>\Server\webservices\sample\sm7webservices\Axis2Sample

Apache Axis sample includes a library of Axis jar files as well as batch files that users could use to run each class from the Windows command prompt after compiling the sample java.

To compile user has to download Apache Ant.

The detailed steps could be found in README.txt file under above directory.

NOTE: During the compiling, SM would access external URL via proxy. SM server should have access to Internet. The proxy host and port in the following lines in the build.xml have to be set.
   
   <jvmarg value="-Dhttp.proxyHost=your-proxy-server"/>
   <jvmarg value="-Dhttp.proxyPort=your-proxy-port"/>

After compiling user would see "BUILD SUCCESSFUL" in command prompt window as well find 3 files added to directory <lib>:

sm-samples.jar

sm7cm-ws-proxy.jar

sm7im-w-proxy.jar

Now user could go to <bin> directory, type xxxSample where xxxSample is the batch file name of the sample application to run corresponding class, as well use these sample applications as examples to create own custom Web Services client applications.

For further details please refer to the Web Service guide (9.33 version).