Google Apps Security and Compliance Services Web Services Application Programming Interface Guide, Early Access Version 1.5 User Manual

Page 33

Advertising
background image

Endpoint Resolver

31

Axis Example

This v.1.5 Java example is using Apache Axis 1.4. This example shows how to
create a communication endpoint before creating the port. Once the
dynamically created endpoint is assigned to the port, it can not be changed for
that endpoint instance.

try

{

// Load and instantiate an instance of our endpoint resolver.

EndpointResolverAPI.EndpointResolverServiceLocator

endpointResolverLocator = new

EndpointResolverAPI.EndpointResolverServiceLocator();

EndpointResolverAPI.EndpointResolverPort_PortType

endpointResolverPort =

endpointResolverLocator.getEndpointResolverPort();

// Create an instance of our Automated Batch auth element

AutomatedBatchAPI.AuthElem authCredentials = new

AutomatedBatchAPI.AuthElem();

//Get the email address and password entered by the user

authCredentials.setApiKey("<Software apiKey>");

authCredentials.setEmail("<Email address entered by the user>");

authCredentials.setPword("<Password entered by the user>");

// Load and instantiate an instance of our automated batch API, using

the endpoint resolver to override the endpoint.

AutomatedBatchAPI.AutomatedBatchServiceLocator

automatedBatchServiceLocator = new

AutomatedBatchAPI.AutomatedBatchServiceLocator();

String automatedBatchEndpoint =

endpointResolverPort.getServiceEndpoint(

authCredentials.getApiKey(),authCredentials.getEmail(),EndpointResol

verAPI.Service.v2AutomatedBatch);

automatedBatchServiceLocator.setAutomatedBatchPortEndpointAddress(

automatedBatchEndpoint );

AutomatedBatchAPI.AutomatedBatchPort_PortType automatedBatchPort =

automatedBatchServiceLocator.getAutomatedBatchPort();

//Create an Instance of the extra argument structure for orgs

AutomatedBatchAPI.ListorgsqueryParams qpOrgArgs = new

AutomatedBatchAPI.ListorgsqueryParams();

Advertising