Consuming SOE SOAP Web Services


Summary This topic describes how to consume a SOE SOAP Web Service. We will first discuss the basics of consuming Web Services in Java then detail some different client types. After reading this topic you will be able to implement SOE Web Services through client Stub libraries generated from SOE development workflows.

Consuming SOAP Web Services

Typically in Java there are 2 steps required to consume SOAP based Web Services with JAX-WS. 
  1. Create Proxy classes, or Web Service stubs
  2. Include the Proxy classes in your application classpath and use them
Considering that as part of the SOE SOAP Web Service development process we provide tooling to generate the Web Service stubs, or Proxy classes, client side developers do not need to consider step 1 reducing the development workflow to a single step of including the Stubs library created during development time.  The Web Service Stubs are created during development and implements the Service Endpoint Interface (SEI), a Java representation of the WSDL port type.  The advantage of this service access method is in it's simplicity.  Only two to three lines of code are required to invoke a Web Services operation: 
[Java]
String endpoint = 
    "http://server:8399/arcgis/services/SERVICENAME/MapServer/HelloWorldSoapSOE";
HelloWorldSoapSOEServiceBindingStub stub = new HelloWorldSoapSOEServiceBindingStub
    (endpoint);
// invoke service operation
System.out.println("Response from our SOE Web Service: " + stub.helloWorld());
First, you need to know the URL of the SOE Web Service endpoint.  Typically, this will follow the following pattern: 
An example URL would be: http://server1:8399/arcgis/services/USA/MapServer/HelloWorldSoapSOE
Using the following parameters:
  • <SERVER-NAME> = server1
  • <MAP-SERVICE-NAME> = USA
  • <SOE-WEB-SERVICE-NAME> = HelloWorldSoapSOE
You can either set this URL to type STRING or use it as a parameter Stub constructor.  The Stub constructor comes from the Stub library and is am implementation of the SOE Web Service that you can call the SOE methods from. 

Create web service client console application

Now that we have the basics required to invoke our Web Service from a client, let's build a simple console application to fully invoke our HelloWorldSoapSOE Web Service.   First, we need to include the following in our application classpath: 
  1. Client Stub jar generated from development, HelloWorldSoapSOE.jar
  2. ArcGIS Java Web Service (AgsJWS) Libraries
The ArcObjects Eclipse plug-in provides access to the #2 and you get #1 from your SOE Web Sevice development project. 
To add the libraries to your project in Eclipse simply right click your project and select 'Properties' to bring up your projects Properties dialog. 
Assuming the SOE Web Service development project is in your Eclipse Package Explorer you can add your SOE Web Service Stub jar by clicking the 'Add JARs…' button and navigate to the SOE Web Service development project directory where you generated your Stub Jar file.  In the screenshot below, the jar is in the 'res' folder of the appropriate project: 
Next we need to add the AgsJWS libraries.  The ArcObjects Eclipse plug-in makes this very easy to do.  While still in your projects Properties dialog, select 'Add Library…' which will bring up the following dialog:
You should see both the 'ArcGIS Web Services Library' as an option in the dialog.  Select the 'ArcGIS Web Services Library' and click 'Next' to bring up the list of libraries included with the AgsJWS:
Click 'Finish' to add the libraries to your build path.  Now that you have your project build path set up you can create a Java class under your Java package heirachry and stub out the following code to consume a HelloWorldSoapSOE:
[Java]
package soapdemo.client;

import soapdemo.HelloWorldSoapSOEServiceBindingStub;

public class HelloWorldSoapSoeTest{

    public static void main(String[] args){
        String endpoint = 
            "http://server1:8399/arcgis/services/USA/MapServer/HelloWorldSoapSOE";
        HelloWorldSoapSOEServiceBindingStub stub = new
            HelloWorldSoapSOEServiceBindingStub(endpoint);

        // invoke service operator
        String response = stub.helloWorld();
        System.out.println("Response from our SOE Web Service: " + response);
    }
}
When you run the program you should have the following output:
> Response from our SOE Web Service: Hello World from our first SOE Web Service


See Also:

Developing SOE SOAP Web Services




Development licensing Deployment licensing
Server Server