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

Endpoint Resolver
33
JAX WS Example
This v.1.5 Java example was created using JAX.WS 2.0.
try {
// Load and instantiate an instance of our endpoint resolver.
EndpointResolverAPI.EndpointResolverService
endpointResolverService = new
EndpointResolverAPI.EndpointResolverService();
EndpointResolverAPI.EndpointResolverPort endpointResolverPort =
endpointResolverService.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>");
// Okay, now lets create our user sync port, attempting to
override the endpoint URL.
AutomatedBatchAPI.AutomatedBatchPort automatedBatchPort = null;
String automatedBatchEndpoint =
endpointResolverPort.getServiceEndpoint(
authCredentials.getApiKey(),
authCredentials.getEmail(),
EndpointResolverAPI.Service.V_2_AUTOMATED_BATCH
);
// Derive our cluster WSDL location from the Endpoint.
java.net.URL endptURL = new java.net.URL(automatedBatchEndpoint);
java.net.URL clusterWSDL = new java.net.URL(endptURL.getProtocol() +
"://" + endptURL.getHost() + "/dl/api/automatedbatch.wsdl");
javax.xml.namespace.QName serviceName = new
javax.xml.namespace.QName("http://postini.com/PSTN/SOAPAPI/v2/
automatedbatch","AutomatedBatchService");
AutomatedBatchAPI.AutomatedBatchService service = new
AutomatedBatchAPI.AutomatedBatchService(clusterWSDL,serviceName);