www.pudn.com > google_examples.zip > GoogleSearchBindingStub.java, change:2002-05-01,size:13538b


/** 
 * GoogleSearchBindingStub.java 
 * 
 * This file was auto-generated from WSDL 
 * by the Apache Axis Wsdl2java emitter. 
 */ 
 
package GoogleSearch; 
 
public class GoogleSearchBindingStub extends org.apache.axis.client.Stub implements GoogleSearch.GoogleSearchPort { 
    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 GoogleSearchBindingStub() throws org.apache.axis.AxisFault { 
         this(null); 
    } 
 
    public GoogleSearchBindingStub(java.net.URL endpointURL, javax.xml.rpc.Service service) throws org.apache.axis.AxisFault { 
         this(service); 
         super.cachedEndpoint = endpointURL; 
    } 
 
    public GoogleSearchBindingStub(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; 
            } 
            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("urn:GoogleSearch", "DirectoryCategoryArray"); 
            cachedSerQNames.add(qName); 
            cls = GoogleSearch.DirectoryCategory[].class; 
            cachedSerClasses.add(cls); 
            cachedSerFactories.add(arraysf); 
            cachedDeserFactories.add(arraydf); 
 
            qName = new javax.xml.rpc.namespace.QName("urn:GoogleSearch", "GoogleSearchResult"); 
            cachedSerQNames.add(qName); 
            cls = GoogleSearch.GoogleSearchResult.class; 
            cachedSerClasses.add(cls); 
            cachedSerFactories.add(beansf); 
            cachedDeserFactories.add(beandf); 
 
            qName = new javax.xml.rpc.namespace.QName("urn:GoogleSearch", "ResultElementArray"); 
            cachedSerQNames.add(qName); 
            cls = GoogleSearch.ResultElement[].class; 
            cachedSerClasses.add(cls); 
            cachedSerFactories.add(arraysf); 
            cachedDeserFactories.add(arraydf); 
 
            qName = new javax.xml.rpc.namespace.QName("urn:GoogleSearch", "DirectoryCategory"); 
            cachedSerQNames.add(qName); 
            cls = GoogleSearch.DirectoryCategory.class; 
            cachedSerClasses.add(cls); 
            cachedSerFactories.add(beansf); 
            cachedDeserFactories.add(beandf); 
 
            qName = new javax.xml.rpc.namespace.QName("urn:GoogleSearch", "ResultElement"); 
            cachedSerQNames.add(qName); 
            cls = GoogleSearch.ResultElement.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 byte[] doGetCachedPage(java.lang.String key, java.lang.String url) 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("", "key"); 
        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("", "url"); 
        call.addParameter(p1QName, new javax.xml.rpc.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, javax.xml.rpc.ParameterMode.IN); 
        call.setReturnType(new javax.xml.rpc.namespace.QName("http://www.w3.org/2001/XMLSchema", "base64Binary")); 
        call.setUseSOAPAction(true); 
        call.setSOAPActionURI("urn:GoogleSearchAction"); 
        call.setOperationStyle("rpc"); 
        call.setOperationName(new javax.xml.rpc.namespace.QName("urn:GoogleSearch", "doGetCachedPage")); 
 
        Object resp = call.invoke(new Object[] {key, url}); 
 
        if (resp instanceof java.rmi.RemoteException) { 
            throw (java.rmi.RemoteException)resp; 
        } 
        else { 
            try { 
                return (byte[]) resp; 
            } catch (java.lang.Exception e) { 
                return (byte[]) org.apache.axis.utils.JavaUtils.convert(resp, byte[].class); 
            } 
        } 
    } 
 
    public java.lang.String doSpellingSuggestion(java.lang.String key, java.lang.String phrase) 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("", "key"); 
        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("", "phrase"); 
        call.addParameter(p1QName, new javax.xml.rpc.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, javax.xml.rpc.ParameterMode.IN); 
        call.setReturnType(new javax.xml.rpc.namespace.QName("http://www.w3.org/2001/XMLSchema", "string")); 
        call.setUseSOAPAction(true); 
        call.setSOAPActionURI("urn:GoogleSearchAction"); 
        call.setOperationStyle("rpc"); 
        call.setOperationName(new javax.xml.rpc.namespace.QName("urn:GoogleSearch", "doSpellingSuggestion")); 
 
        Object resp = call.invoke(new Object[] {key, phrase}); 
 
        if (resp instanceof java.rmi.RemoteException) { 
            throw (java.rmi.RemoteException)resp; 
        } 
        else { 
            try { 
                return (java.lang.String) resp; 
            } catch (java.lang.Exception e) { 
                return (java.lang.String) org.apache.axis.utils.JavaUtils.convert(resp, java.lang.String.class); 
            } 
        } 
    } 
 
    public GoogleSearch.GoogleSearchResult doGoogleSearch(java.lang.String key, java.lang.String q, int start, int maxResults, boolean filter, java.lang.String restrict, boolean safeSearch, java.lang.String lr, java.lang.String ie, java.lang.String oe) 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("", "key"); 
        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("", "q"); 
        call.addParameter(p1QName, 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 p2QName = new javax.xml.rpc.namespace.QName("", "start"); 
        call.addParameter(p2QName, new javax.xml.rpc.namespace.QName("http://www.w3.org/2001/XMLSchema", "int"), int.class, javax.xml.rpc.ParameterMode.IN); 
        javax.xml.rpc.namespace.QName p3QName = new javax.xml.rpc.namespace.QName("", "maxResults"); 
        call.addParameter(p3QName, new javax.xml.rpc.namespace.QName("http://www.w3.org/2001/XMLSchema", "int"), int.class, javax.xml.rpc.ParameterMode.IN); 
        javax.xml.rpc.namespace.QName p4QName = new javax.xml.rpc.namespace.QName("", "filter"); 
        call.addParameter(p4QName, new javax.xml.rpc.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"), boolean.class, javax.xml.rpc.ParameterMode.IN); 
        javax.xml.rpc.namespace.QName p5QName = new javax.xml.rpc.namespace.QName("", "restrict"); 
        call.addParameter(p5QName, 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 p6QName = new javax.xml.rpc.namespace.QName("", "safeSearch"); 
        call.addParameter(p6QName, new javax.xml.rpc.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"), boolean.class, javax.xml.rpc.ParameterMode.IN); 
        javax.xml.rpc.namespace.QName p7QName = new javax.xml.rpc.namespace.QName("", "lr"); 
        call.addParameter(p7QName, 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 p8QName = new javax.xml.rpc.namespace.QName("", "ie"); 
        call.addParameter(p8QName, 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 p9QName = new javax.xml.rpc.namespace.QName("", "oe"); 
        call.addParameter(p9QName, new javax.xml.rpc.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, javax.xml.rpc.ParameterMode.IN); 
        call.setReturnType(new javax.xml.rpc.namespace.QName("urn:GoogleSearch", "GoogleSearchResult")); 
        call.setUseSOAPAction(true); 
        call.setSOAPActionURI("urn:GoogleSearchAction"); 
        call.setOperationStyle("rpc"); 
        call.setOperationName(new javax.xml.rpc.namespace.QName("urn:GoogleSearch", "doGoogleSearch")); 
 
        Object resp = call.invoke(new Object[] {key, q, new Integer(start), new Integer(maxResults), new Boolean(filter), restrict, new Boolean(safeSearch), lr, ie, oe}); 
 
        if (resp instanceof java.rmi.RemoteException) { 
            throw (java.rmi.RemoteException)resp; 
        } 
        else { 
            try { 
                return (GoogleSearch.GoogleSearchResult) resp; 
            } catch (java.lang.Exception e) { 
                return (GoogleSearch.GoogleSearchResult) org.apache.axis.utils.JavaUtils.convert(resp, GoogleSearch.GoogleSearchResult.class); 
            } 
        } 
    } 
 
}