The following example shows how you could retrieve a profile ID from the system by using the GetProfileId Web service in an Apache Axis client application. For more examples of client-side code, refer to the Web Services Guide.

For more information on using Axis tools to build client applications, visit http://ws.apache.org/axis/.

The class that builds clients is org.apache.axis.wsdl.WSDL2Java, which takes a WSDL file as one of its arguments. The Axis client generates classes that you can then use to make a call to the GetProfileId Web service. For example:

java org.apache.axis.wsdl.WSDL2Java -o c:\my\client\classes
/path/to/getProfileId.wsdl

This command creates a class called com.atg.www.webservices.GetProfileIdSEIServiceLocator. This class is responsible for locating and returning a handle to the service you want to invoke. It returns an item of type com.atg.www.GetProfileIdSEI, which is an interface that contains the single method you need. You can then call this method with the arguments that are appropriate.

The following example shows how you could use the generated classes as a standalone method within a client application:

import com.atg.www.webservices.*;

public callGetProfileId(String pProfileId) {
      // This finds our Web service
      GetProfileIdServiceLocator locator = new GetProfileIdServiceLocator();

      try {
        // This represents the Web service that we want to act on
        GetProfileIdSEI getProfileService = locator.getGetProfileIdSEIPort();

         // Now we can invoke our method on it...we know the method name
         // and args by either looking at the WSDL, or at the
         // Axis-generated code
         return getProfileService.getProfileId(pProfileId);
      }
      catch(javax.xml.rpc.ServiceException exc) {}
      catch(java.rmi.RemoteException exc) {}
      catch(com.atg.www.javax_servlet.ServletException exc) {}
      catch(com.atg.www.atg_security.SecurityException exc) {} }

Note that the last two exceptions shown are generated by Axis, but you can just catch regular exceptions if the type of exception being thrown is not important to your application.


Copyright © 1997, 2015 Oracle and/or its affiliates. All rights reserved. Legal Notices