Raritan Computer CC-WSAPI-0B-v5.1.0-E Marine Radio User Manual


 
Appendix B: Web Services Development in Java
32
Call the method from your application for each service object. This
example uses AuthenticationAndAuthorizationService:
CCSGAuthenticationAndAuthorizationService service =
new CCSGAuthenticationAndAuthorizationService();
AuthenticationAndAuthorizationService service_port =
service.getAuthenticationAndAuthorizationServicePort(
);
set_service_end_point( service,
(BindingProvider)service_port );
This procedure must be done for each service, like
NodeManagementService, to connect to the intended CC-SG.
Calling a Web Service
JAX-WS requires an instance of the service class for the desired service
generated by wsimport. The service object contains a port object that
one can use to call the service methods as shown below:
CCSGAuthenticationAndAuthorizationService service = new
CCSGAuthenticationAndAuthorizationService();
AuthenticationAndAuthorizationService service_port =
service.getAuthenticationAndAuthorizationServicePort();
try
{
String sessionID = port.signOn( user, password );
} catch ( security.service.webservice.bl.cc.raritan.com
AuthenticationAndAuthorizationException ex )
{
System.out.println( "AuthenticationAndAuthorizationException: " +
ex.getFaultInfo().getMessage() );
System.out.println( "\t" + ex.getFaultInfo().getCode() );
System.out.println( "signOn() for user " + user + " failed." );
}
Sample Application for Java