# Registering a Web Service

## Contents
Overview Accessing the Axis Web Services Registering the Example Web Service Accessing the Protected Web Service Testing the Protected Web Service Monitoring the Web Service

## Overview
This topic explains how to register a simple Apache Axis Web Service using Oracle Service Manager. It uses the example `SimpleAxisServer`, which is installed with the Enterprise Gateway. This example server is provided for illustration only, and is not intended for production use. For more details, see the `samples/stock` directory in an Apache Axis 1.4 installation. This topic assumes that you have already performed the steps described in Starting the Enterprise Gateway.
## Accessing the Axis Web Services
The `SimpleAxisServer` installed with the Enterprise Gateway provides access to the example Axis Web Services. To access these Web services, perform the following steps: In your `INSTALL_DIR\ext\lib` directory, create a `wsdl4j` directory. Download the following file: http://sourceforge.net/projects/wsdl4j/files/WSDL4J/1.6.2/wsdl4j-bin-1.6.2.zip Unzip and place the `wsdl4j.jar` and `qname.jar` files into the `ext\lib\wsdl4j` directory. In your Enterprise Gateway `bin` directory, enter the `axissimpleserver` command. By default, this server runs on port `7070`. You can specify a different port number by changing the value of the `-p` option in `INSTALL_DIR/system/conf/axissimpleserver.xml`. Enter the following URL in your browser to view the example Web Services:
    http://localhost:7070/
Click a wsdl link on this web page to access the WSDL for an example Web Service. This tutorial uses the WSDL for the `ComInfoService`, which is available from the first link on this page. Testing the ComInfoService You can test the `ComInfoService` using a simple test client provided with the Enterprise Gateway. In your Enterprise Gateway `bin` directory, enter the `axisstockclient` command. This simple client uses the `ComInfoService` to retrieve the address details of Cisco Systems Inc. When you run the `axistestclient`, you should see the following output: `CSCO: San Jose, CA`
## Registering the Example Web Service
2. To register the `ComInfoService` example Web Service using Service Manager, perform the following steps: In the Web Services window on the left, right-click the Web Services group, and select Register Web Service. In the Register Web Service dialog, specify the following URL for the `ComInfoService` Web Service in the WSDL URL field:
       http://localhost:7070/axis/services/urn:cominfo?wsdl
Click the Register button. Click the Deploy icon at the top right of the screen to deploy the Web Service to the Enterprise Gateway. In the Deploy dialog, click Yes. The newly registered Web Service is displayed in the Web Services tree. For more information, see Managing Web Services.
Registered Web Service
Web Services registered using Service Manager and deployed to the Enterprise Gateway can also be viewed in the Policy Studio in the Policies view. Similarly, Web Services imported using the Policy Studio and deployed to the Enterprise Gateway can be viewed in Service Manager in the Web Services window. For details on using Policy Studio to import Web Services, see Web Service Repository.
## Accessing the Protected Web Service
When you register a Web Service with the default settings, and deploy it to the Enterprise Gateway, the Enterprise Gateway protects the Web Service. This means that instead of connecting to the Web service directly, clients connect through the Enterprise Gateway. The Enterprise Gateway can then apply policies to messages sent to the destination Web Service (for example, to enable security, monitoring, and acceleration). To view the WSDL for the protected Web Service, click the link in the WSDL column on the right of the Web Services window. The published WSDL now uses the host and port of the Enterprise Gateway in its URL. For example, in the case of the example `ComInfoService`, the new URL on which the Web service is available to clients is as follows:
    http://HOST:8080/axis/services/urn:cominfo?WSDL
where `HOST` is the machine on which the Enterprise Gateway is running.
## Testing the Protected Web Service
If you have Service Explorer installed, you can test the protected Web Service by sending a message through the Enterprise Gateway (this step is optional). To do this, perform the following steps: In your Service Explorer installation directory, run the `serviceexplorer` command. Click the Import WSDL button in the Service Explorer toolbar. In the Load WSDL screen, select WSDL URL, and paste in the URL for the protected WSDL (in this case, `http://HOST:8080/axis/services/urn:cominfo?WSDL`). Click Next. In the WSDL Operations screen, select the `getInfo` operation. Click Finish. In the Request tab on the left, paste in the following message:
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <soap:Body>
         <ns1:getInfo xmlns:ns1="http://stock.samples">
            <symbol xsi:type="xsd:string">CSCO</symbol>
            <info xsi:type="xsd:string">address</info>
         </ns1:getInfo>
       </soap:Body>
    </soap:Envelope>
8. Click the triangular green send button in the toolbar to send the message to the protected Web Service through the Enterprise Gateway. The following message should be displayed in the Response tab on the right:
       <?xml version="1.0" encoding="UTF-8"?>
       <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
         xmlns:xsd="http://www.w3.org/2001/XMLSchema"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
         <soapenv:Body>
            <ns1:getInfoResponse
               soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
               xmlns:ns1="http://stock.samples">
               <getInfoReturn xsi:type="xsd:string">San Jose, CA </getInfoReturn>
            </ns1:getInfoResponse>
         </soapenv:Body>
       </soapenv:Envelope>
To format the message, right-click the Request pane, and select Format. The following example shows the Request displayed in Service Explorer:
Request Message
## Monitoring the Web Service
When you have registered the example Web Service, the next step is to monitor the Web Service using the real-time monitoring tools provided with the Enterprise Gateway. For details, see Monitoring a Web Service.