HP Matrix Operating Environment Software manual Sample Code

Models: Matrix Operating Environment Software

1 111
Download 111 pages 21.04 Kb
Page 77
Image 77

package com.hp.io.soap.v5;

import com.hp.io.soap.v1.*;

import java.util.EnumSet; import java.util.HashMap; import java.util.Map; import java.util.Set;

import javax.net.ssl.TrustManager; import javax.xml.namespace.QName;

import org.apache.cxf.configuration.jsse.TLSClientParameters; import org.apache.cxf.endpoint.Client;

import org.apache.cxf.endpoint.Endpoint; import org.apache.cxf.frontend.ClientProxy; import org.apache.cxf.transport.http.HTTPConduit;

import org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor; import org.apache.ws.security.WSConstants;

import org.apache.ws.security.handler.WSHandlerConstants; public final class IO_IOSoapServicePort_Client {

private static final QName SERVICE_NAME =

new QName("http://v5.soap.io.hp.com/", "IO");

private static final Set<RequestStatusEnum> TERMINAL_STATUSES = EnumSet.of(

RequestStatusEnum.COMPLETE,

RequestStatusEnum.CANCELED,

RequestStatusEnum.REJECTED,

RequestStatusEnum.FAILED,

RequestStatusEnum.TERMINATED);

private IO_IOSoapServicePort_Client() {

}

public static void main(String args[]) throws Exception { IO_Service ss =

new IO_Service(IO_Service.WSDL_LOCATION, SERVICE_NAME); IO port = ss.getIOSoapServicePort();

setupConnection(port);

System.out.println("Invoking listTemplates..."); try {

java.util.List<TemplateInfo> templateList = port.listTemplates();

System.out.println(

"Operation completed with these templates returned:"); for (TemplateInfo template : templateList) {

System.out.println(template.getName());

}

} catch (Exception e) { System.out.println("Operation failed with exception: " +

e.getMessage());

}

final String infServiceName = "MyServiceName";

System.out.println("Invoking createService..."); try {

String requestId = port.createService(

infServiceName,

// Name of service to create

"MyTemplateName",

// Name of template for new service

new LeasePeriod(),

// Start now and never expire

"hostx",

// Hostname completion text

null,

// Use all available server pools

null,

// Do not set user's email address

"Service Purpose",

// Annotation for the new service

Sample Code 77

Page 77
Image 77
HP Matrix Operating Environment Software manual Sample Code