// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
import javax.xml.rpc.encoding.XMLType;

public class VideoServiceClient {
    public static boolean test(String clientName) {
        String endpoint = "http://localhost:80/VideoService.asmx";
        try {
            javax.xml.rpc.ServiceFactory servfact = javax.xml.rpc.ServiceFactory.newInstance();
            javax.xml.rpc.Service serv = servfact.createService(new QName("localhost"));
           
            javax.xml.rpc.Call cal = serv.createCall();
            cal.setTargetEndpointAddress(endpoint);
            cal.setOperationName(new QName("http://tempuri.org/", "SaveVideo"));
            cal.setProperty(javax.xml.rpc.Call.SOAPACTION_USE_PROPERTY, true);
            cal.setProperty(javax.xml.rpc.Call.SOAPACTION_URI_PROPERTY, "http://tempuri.org/SaveVideo");
            cal.setProperty(javax.xml.rpc.Call.ENCODINGSTYLE_URI_PROPERTY , "literal");
            ((org.apache.axis.client.Call)cal).addParameter(new QName("http://tempuri.org/", "videoName"), XMLType.XSD_STRING, String.class, ParameterMode.IN);
            cal.setReturnType(XMLType.XSD_STRING);
            Object[] arg = new Object[1];
            arg[0] = (String)clientName;
            cal.invoke(arg);
            return true;
        } catch (Exception se) {
            se.printStackTrace();
            return false;
        }
        
    }
    public static void main(String[] args) {
        System.setProperty(javax.xml.rpc.ServiceFactory.SERVICEFACTORY_PROPERTY, "org.apache.axis.client.ServiceFactory");
        test("noget");
    }
}
