FileDocCategorySizeDatePackage
HostedClient.javaAPI DocExample5184Tue May 29 16:57:56 BST 2007simple.hostedclient

HostedClient

public class HostedClient extends Object

Fields Summary
private static final String
PARAM_STSAddress
private static final String
PARAM_ServiceAddress
private static final String
PARAM_ConfigName
private static final String
featureName
private static final String
SCENARIO_2
Constructors Summary
Methods Summary
public static HostedClientSoapcreateProxy()

        HostedClientSoapImpl hostclisvc = new HostedClientSoapImpl();
        return hostclisvc.getBasicHttpBindingHostedClientSoap();        
    
public static voidmain(java.lang.String[] args)

    
           
        
        String serviceUrl = System.getProperty("service.url");
        String sts = System.getProperty("sts");
        String stsUrl = System.getProperty("msclient."+sts+"sts.url");
        if(InetAddress.getByName(URI.create(serviceUrl).getHost()).isLoopbackAddress()){
            serviceUrl = serviceUrl.replaceFirst("localhost",InetAddress.getLocalHost().getHostAddress());
        }
        if(InetAddress.getByName(URI.create(stsUrl).getHost()).isLoopbackAddress()){
            stsUrl = stsUrl.replaceFirst("localhost",InetAddress.getLocalHost().getHostAddress());
        }
        
        
        HostedClientSoap proxy = createProxy();
             
        ArrayOfHostedClientParameter paramArray = new ArrayOfHostedClientParameter();
        List<HostedClientParameter> list = paramArray.getHostedClientParameter();
        
        HostedClientParameter stsParameter = readParameter(stsUrl, PARAM_STSAddress);
        list.add(stsParameter);
        HostedClientParameter serviceParameter = readParameter(serviceUrl, PARAM_ServiceAddress);
        list.add(serviceParameter);
        HostedClientParameter configParameter = readParameter(SCENARIO_2, PARAM_ConfigName);
        list.add(configParameter);
        runScenario(SCENARIO_2,paramArray,proxy);
    
public static HostedClientParameterreadParameter(java.lang.String endpoint, java.lang.String parameterName)

        HostedClientParameter parameter = new HostedClientParameter();
        parameter.setKey(parameterName);
        parameter.setValue(endpoint);
        return parameter;
    
public static voidrunScenario(java.lang.String scenarioName, ArrayOfHostedClientParameter paramArray, HostedClientSoap proxy)

        System.out.println("Run Scenario: " + scenarioName);
        List<HostedClientParameter> list = paramArray.getHostedClientParameter();
        for(int i = 0; i<list.size();i++) {
            System.out.println(list.get(i).getKey() + ":" + list.get(i).getValue());
        }
        
        HostedClientResult result = proxy.run(featureName, scenarioName,  paramArray);
        System.out.println("Result: " + (result.isSuccess() ? "PASS" : "FAIL"));
        System.out.println("Debuglog: " + result.getDebugLog());