/**
 * ClsXMLAProxSoapBindingStub.java
 *
 * This file was auto-generated from WSDL
 * by the Apache Axis Wsdl2java emitter.
 */

package org.tempuri;

public class ClsXMLAProxSoapBindingStub extends org.apache.axis.client.Stub implements org.tempuri.ClsXMLAProxSoapPort {
    private java.util.Vector cachedSerClasses = new java.util.Vector();
    private java.util.Vector cachedSerQNames = new java.util.Vector();
    private java.util.Vector cachedSerFactories = new java.util.Vector();
    private java.util.Vector cachedDeserFactories = new java.util.Vector();

    public ClsXMLAProxSoapBindingStub() throws org.apache.axis.AxisFault {
         this(null);
    }

    public ClsXMLAProxSoapBindingStub(java.net.URL endpointURL, javax.xml.rpc.Service service) throws org.apache.axis.AxisFault {
         this(service);
         super.cachedEndpoint = endpointURL;
    }

    public ClsXMLAProxSoapBindingStub(javax.xml.rpc.Service service) throws org.apache.axis.AxisFault {
        try {
            if (service == null) {
                super.service = new org.apache.axis.client.Service();
            } else {
                super.service = service;
            }
            super.cachedEndpoint = new java.net.URL("http://localhost:8081/XMLForAnalysisProvider/msxisapi.dll");
            Class cls;
            javax.xml.rpc.namespace.QName qName;
            Class beansf = org.apache.axis.encoding.ser.BeanSerializerFactory.class;
            Class beandf = org.apache.axis.encoding.ser.BeanDeserializerFactory.class;
            Class enumsf = org.apache.axis.encoding.ser.EnumSerializerFactory.class;
            Class enumdf = org.apache.axis.encoding.ser.EnumDeserializerFactory.class;
            Class arraysf = org.apache.axis.encoding.ser.ArraySerializerFactory.class;
            Class arraydf = org.apache.axis.encoding.ser.ArrayDeserializerFactory.class;
            Class simplesf = org.apache.axis.encoding.ser.SimpleNonPrimitiveSerializerFactory.class;
            Class simpledf = org.apache.axis.encoding.ser.SimpleDeserializerFactory.class;
            qName = new javax.xml.rpc.namespace.QName("http://tempuri.org/type", "clsXMLAProx.Execute.Properties");
            cachedSerQNames.add(qName);
            cls = org.tempuri.ClsXMLAProxExecuteProperties.class;
            cachedSerClasses.add(cls);
            cachedSerFactories.add(beansf);
            cachedDeserFactories.add(beandf);

            qName = new javax.xml.rpc.namespace.QName("http://tempuri.org/type", "clsXMLAProx.Execute.Result");
            cachedSerQNames.add(qName);
            cls = org.tempuri.ClsXMLAProxExecuteResult.class;
            cachedSerClasses.add(cls);
            cachedSerFactories.add(beansf);
            cachedDeserFactories.add(beandf);

            qName = new javax.xml.rpc.namespace.QName("http://tempuri.org/type", "clsXMLAProx.Discover.Restrictions");
            cachedSerQNames.add(qName);
            cls = org.tempuri.ClsXMLAProxDiscoverRestrictions.class;
            cachedSerClasses.add(cls);
            cachedSerFactories.add(beansf);
            cachedDeserFactories.add(beandf);

            qName = new javax.xml.rpc.namespace.QName("http://tempuri.org/type", "clsXMLAProx.Discover.Properties");
            cachedSerQNames.add(qName);
            cls = org.tempuri.ClsXMLAProxDiscoverProperties.class;
            cachedSerClasses.add(cls);
            cachedSerFactories.add(beansf);
            cachedDeserFactories.add(beandf);

            qName = new javax.xml.rpc.namespace.QName("http://tempuri.org/type", "clsXMLAProx.Discover.Result");
            cachedSerQNames.add(qName);
            cls = org.tempuri.ClsXMLAProxDiscoverResult.class;
            cachedSerClasses.add(cls);
            cachedSerFactories.add(beansf);
            cachedDeserFactories.add(beandf);

            qName = new javax.xml.rpc.namespace.QName("http://tempuri.org/type", "clsXMLAProx.Execute.Command");
            cachedSerQNames.add(qName);
            cls = org.tempuri.ClsXMLAProxExecuteCommand.class;
            cachedSerClasses.add(cls);
            cachedSerFactories.add(beansf);
            cachedDeserFactories.add(beandf);


        }
        catch(java.lang.Exception t) {
            throw org.apache.axis.AxisFault.makeFault(t);
        }
    }

    private org.apache.axis.client.Call createCall() throws java.rmi.RemoteException {
        try {
            org.apache.axis.client.Call call =
                    (org.apache.axis.client.Call) super.service.createCall();
            if (super.maintainSessionSet) {
                call.setMaintainSession(super.maintainSession);
            }
            if (super.cachedUsername != null) {
                call.setUsername(super.cachedUsername);
            }
            if (super.cachedPassword != null) {
                call.setPassword(super.cachedPassword);
            }
            if (super.cachedEndpoint != null) {
                call.setTargetEndpointAddress(super.cachedEndpoint);
            }
            if (super.cachedTimeout != null) {
                call.setTimeout(super.cachedTimeout);
            }
            java.util.Enumeration keys = super.cachedProperties.keys();
            while (keys.hasMoreElements()) {
                String key = (String) keys.nextElement();
                call.setProperty(key, super.cachedProperties.get(key));
            }
            // All the type mapping information is registered
            // when the first call is made.
            // The type mapping information is actually registered in
            // the TypeMappingRegistry of the service, which
            // is the reason why registration is only needed for the first call.
            if (firstCall()) {
                // must set encoding style before registering serializers
                call.setEncodingStyle(org.apache.axis.Constants.URI_SOAP_ENC);
                for (int i = 0; i < cachedSerFactories.size(); ++i) {
                    Class cls = (Class) cachedSerClasses.get(i);
                    javax.xml.rpc.namespace.QName qName =
                            (javax.xml.rpc.namespace.QName) cachedSerQNames.get(i);
                    Class sf = (Class)
                             cachedSerFactories.get(i);
                    Class df = (Class)
                             cachedDeserFactories.get(i);
                    call.registerTypeMapping(cls, qName, sf, df,false);
                }
            }
            return call;
        }
        catch (Throwable t) {
            throw new org.apache.axis.AxisFault("Failure trying to get the Call object", t);
        }
    }

    public org.tempuri.ClsXMLAProxDiscoverResult discover(java.lang.String requestType, org.tempuri.ClsXMLAProxDiscoverRestrictions restrictions, org.tempuri.ClsXMLAProxDiscoverProperties properties) throws java.rmi.RemoteException{
        if (super.cachedEndpoint == null) {
            throw new org.apache.axis.NoEndPointException();
        }
        org.apache.axis.client.Call call = createCall();
        javax.xml.rpc.namespace.QName p0QName = new javax.xml.rpc.namespace.QName("", "RequestType");
        call.addParameter(p0QName, new javax.xml.rpc.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, javax.xml.rpc.ParameterMode.IN);
        javax.xml.rpc.namespace.QName p1QName = new javax.xml.rpc.namespace.QName("", "Restrictions");
        call.addParameter(p1QName, new javax.xml.rpc.namespace.QName("http://tempuri.org/type", "clsXMLAProx.Discover.Restrictions"), org.tempuri.ClsXMLAProxDiscoverRestrictions.class, javax.xml.rpc.ParameterMode.IN);
        javax.xml.rpc.namespace.QName p2QName = new javax.xml.rpc.namespace.QName("", "Properties");
        call.addParameter(p2QName, new javax.xml.rpc.namespace.QName("http://tempuri.org/type", "clsXMLAProx.Discover.Properties"), org.tempuri.ClsXMLAProxDiscoverProperties.class, javax.xml.rpc.ParameterMode.IN);
        try
        {
            call.setReturnType(new javax.xml.rpc.namespace.QName("http://tempuri.org/type", "clsXMLAProx.Discover.Result"),org.tempuri.ClsXMLAProxDiscoverResult.class);
        }
        catch (javax.xml.rpc.JAXRPCException e)
        {
            System.out.println("JAXRPCException");
        }
        call.setUseSOAPAction(true);
        call.setSOAPActionURI("urn:schemas-microsoft-com:xml-analysis:Discover");
        call.setOperationStyle("rpc");
        call.setOperationName(new javax.xml.rpc.namespace.QName("urn:schemas-microsoft-com:xml-analysis", "Discover"));

        System.out.println("before invoke");
        Object resp = call.invoke(new Object[] {requestType, restrictions, properties});
        System.out.println("after invoke:");
        if (resp instanceof java.rmi.RemoteException) {
            throw (java.rmi.RemoteException)resp;
        }
        else {
            try {
                return (org.tempuri.ClsXMLAProxDiscoverResult) resp;
            } catch (java.lang.Exception e) {
                return (org.tempuri.ClsXMLAProxDiscoverResult) org.apache.axis.utils.JavaUtils.convert(resp, org.tempuri.ClsXMLAProxDiscoverResult.class);
            }
        }
    }

    public org.tempuri.ClsXMLAProxExecuteResult execute(org.tempuri.ClsXMLAProxExecuteCommand command, org.tempuri.ClsXMLAProxExecuteProperties properties) throws java.rmi.RemoteException{
        if (super.cachedEndpoint == null) {
            throw new org.apache.axis.NoEndPointException();
        }
        org.apache.axis.client.Call call = createCall();
        javax.xml.rpc.namespace.QName p0QName = new javax.xml.rpc.namespace.QName("", "Command");
        call.addParameter(p0QName, new javax.xml.rpc.namespace.QName("http://tempuri.org/type", "clsXMLAProx.Execute.Command"), org.tempuri.ClsXMLAProxExecuteCommand.class, javax.xml.rpc.ParameterMode.IN);
        javax.xml.rpc.namespace.QName p1QName = new javax.xml.rpc.namespace.QName("", "Properties");
        call.addParameter(p1QName, new javax.xml.rpc.namespace.QName("http://tempuri.org/type", "clsXMLAProx.Execute.Properties"), org.tempuri.ClsXMLAProxExecuteProperties.class, javax.xml.rpc.ParameterMode.IN);
        call.setReturnType(new javax.xml.rpc.namespace.QName("http://tempuri.org/type", "clsXMLAProx.Execute.Result"));
        call.setUseSOAPAction(true);
        call.setSOAPActionURI("urn:schemas-microsoft-com:xml-analysis:Execute");
        call.setOperationStyle("rpc");
        call.setOperationName(new javax.xml.rpc.namespace.QName("urn:schemas-microsoft-com:xml-analysis", "Execute"));

        Object resp = call.invoke(new Object[] {command, properties});

        if (resp instanceof java.rmi.RemoteException) {
            throw (java.rmi.RemoteException)resp;
        }
        else {
            try {
                return (org.tempuri.ClsXMLAProxExecuteResult) resp;
            } catch (java.lang.Exception e) {
                return (org.tempuri.ClsXMLAProxExecuteResult) org.apache.axis.utils.JavaUtils.convert(resp, org.tempuri.ClsXMLAProxExecuteResult.class);
            }
        }
    }

}
