FileDocCategorySizeDatePackage
Stub.javaAPI DocApache Axis 1.414444Sat Apr 22 18:57:26 BST 2006org.apache.axis.client

Stub

public abstract class Stub extends Object implements javax.xml.rpc.Stub
This class is the base for all generated stubs.

Fields Summary
protected javax.xml.rpc.Service
service
protected boolean
maintainSessionSet
protected boolean
maintainSession
protected Properties
cachedProperties
protected String
cachedUsername
protected String
cachedPassword
protected URL
cachedEndpoint
protected Integer
cachedTimeout
protected QName
cachedPortName
private Vector
headers
private Vector
attachments
private boolean
firstCall
protected Call
_call
Constructors Summary
Methods Summary
public Call_createCall()
Creates a call from the service.

return

        _call = (Call) service.createCall();

        // TODO: There is a lot of code in the generated stubs that
        // can be moved here.
        return _call;
    
public Call_getCall()
Returns last Call object associated with this stub.

        return _call;
    
public java.lang.Object_getProperty(java.lang.String name)
Gets the value of a named property.

param
name
return
the value of a named property.

        if (name == null) {
            throw new JAXRPCException(
                    Messages.getMessage("badProp05", name));
        }
        else {
            if (name.equals(Call.USERNAME_PROPERTY)) {
                return cachedUsername;
            }
            else if (name.equals(Call.PASSWORD_PROPERTY)) {
                return cachedPassword;
            }
            else if (name.equals(Stub.ENDPOINT_ADDRESS_PROPERTY)) {
                return cachedEndpoint.toString();
            }
            else if (name.equals(Call.SESSION_MAINTAIN_PROPERTY)) {
                return maintainSessionSet ? (maintainSession ? Boolean.TRUE : Boolean.FALSE) : null;
            }
            else if (name.startsWith("java.") || name.startsWith("javax.")) {
                throw new JAXRPCException(
                        Messages.getMessage("badProp05", name));
            }
            else {
                return cachedProperties.get(name);
            }
        }
    
public java.util.Iterator_getPropertyNames()
Return the names of configurable properties for this stub class.

        return cachedProperties.keySet().iterator();
    
public javax.xml.rpc.Service_getService()
Provide access to the service object. Not part of JAX-RPC

return
the service object for this stub

        return service;
    
public void_setProperty(java.lang.String name, java.lang.Object value)
Sets the value for a named property. JAX-RPC 1.0 specification specifies a standard set of properties that may be passed to the Stub._setProperty method. These properties include:
  • javax.xml.rpc.security.auth.username: Username for the HTTP Basic Authentication
  • javax.xml.rpc.security.auth.password: Password for the HTTP Basic Authentication
  • javax.xml.rpc.service.endpoint.address: Target service endpoint address.
  • [TBD: Additional properties]

param
name - Name of the property
param
value - Value of the property

        if (name == null || value == null) {
            throw new JAXRPCException(
                    Messages.getMessage(name == null ?
                                         "badProp03" : "badProp04"));
        }
        else if (name.equals(Call.USERNAME_PROPERTY)) {
            if (!(value instanceof String)) {
                throw new JAXRPCException(
                        Messages.getMessage("badProp00", new String[] {
                        name, "java.lang.String", value.getClass().getName()}));
            }
            cachedUsername = (String) value;
        }
        else if (name.equals(Call.PASSWORD_PROPERTY)) {
            if (!(value instanceof String)) {
                throw new JAXRPCException(
                        Messages.getMessage("badProp00", new String[] {
                        name, "java.lang.String", value.getClass().getName()}));
            }
            cachedPassword = (String) value;
        }
        else if (name.equals(Stub.ENDPOINT_ADDRESS_PROPERTY)) {
            if (!(value instanceof String)) {
                throw new JAXRPCException(
                        Messages.getMessage("badProp00", new String[] {
                        name, "java.lang.String", value.getClass().getName()}));
            }
            try {
                cachedEndpoint = new URL ((String) value);
            }
            catch (MalformedURLException mue) {
                throw new JAXRPCException(mue.getMessage());
            }
        }
        else if (name.equals(Call.SESSION_MAINTAIN_PROPERTY)) {
            if (!(value instanceof Boolean)) {
                throw new JAXRPCException(
                        Messages.getMessage("badProp00", new String[]
                        {name,
                        "java.lang.Boolean",
                        value.getClass().getName()}));
            }
            maintainSessionSet = true;
            maintainSession = ((Boolean) value).booleanValue();
        }
        else if (name.startsWith("java.") || name.startsWith("javax.")) {
            throw new JAXRPCException(
                    Messages.getMessage("badProp05", name));
        }
        else {
            cachedProperties.put(name, value);
        }
    
public voidaddAttachment(java.lang.Object handler)
Add an attachment

param
handler

        attachments.add(handler);        
    
public voidclearAttachments()
This method clears the request attachments.

        attachments.clear();
    
public voidclearHeaders()
This method clears both requestHeaders and responseHeaders hashtables.

        headers.clear();
    
public voidextractAttachments(Call call)
Extract attachments

param
call

        attachments.clear();
        if(call.getResponseMessage() != null) {
            Iterator iterator = call.getResponseMessage().getAttachments();
            while(iterator.hasNext()){
                attachments.add(iterator.next());
            }
        }
    
protected booleanfirstCall()
Is this the first time the type mappings are being registered?


                    
       
        boolean ret = firstCall;
        firstCall = false;
        return ret;
    
public java.lang.Object[]getAttachments()
Get the array of attachments The attachment array is cleared after this, so it is a destructive operation.

return
the array of attachments that was in the message, or an empty array if there were none

        Object[] array = new Object[attachments.size()];
        attachments.copyInto(array);
        attachments.clear();
        return array;
    
public org.apache.axis.message.SOAPHeaderElementgetHeader(java.lang.String namespace, java.lang.String partName)
Get the header element

        for(int i=0;i<headers.size();i++) {
            SOAPHeaderElement header = (SOAPHeaderElement)headers.get(i);
            if(header.getNamespaceURI().equals(namespace) &&
               header.getName().equals(partName))
                return header;
        }
        return null;
    
public org.apache.axis.message.SOAPHeaderElement[]getHeaders()
Get the array of header elements

        SOAPHeaderElement[] array = new SOAPHeaderElement[headers.size()];
        headers.copyInto(array);
        return array;
    
public java.lang.StringgetPassword()
Get the password

        return cachedPassword;
    
public javax.xml.namespace.QNamegetPortName()
Get the port name.

        return cachedPortName;
    
public org.apache.axis.message.SOAPHeaderElementgetResponseHeader(java.lang.String namespace, java.lang.String partName)
Get a response header element

        try
        {
            if (_call == null)
                return null;
            return _call.getResponseMessage().getSOAPEnvelope().getHeaderByName(namespace, partName);
        }
        catch (Exception e)
        {
            return null;
        }
    
public org.apache.axis.message.SOAPHeaderElement[]getResponseHeaders()
Get the array of response header elements

        SOAPHeaderElement[] array = new SOAPHeaderElement[0];
        try
        {
            if (_call == null)
                return array;
            Vector h = _call.getResponseMessage().getSOAPEnvelope().getHeaders();
            array = new SOAPHeaderElement[h.size()];
            h.copyInto(array);
            return array;
        }
        catch (Exception e)
        {
            return array;
        }
    
protected voidgetResponseHeaders(org.apache.axis.client.Call call)
Helper method for updating headers from the response. Deprecated, since response headers should not be automatically reflected back into the stub list.

deprecated
This method has been changed to a no-op but remains in the code to keep compatibility with pre-1.1 generated stubs.

     
public intgetTimeout()
Get the timeout value in milliseconds. 0 means no timeout.

        return cachedTimeout == null ? 0 : cachedTimeout.intValue();
    
public java.lang.StringgetUsername()
Get the user name

        return cachedUsername;
    
public java.lang.ObjectremoveProperty(java.lang.String name)
Remove a property from this instance of the Stub NOTE: This is NOT part of JAX-RPC and is an Axis extension.

param
name the name of the property to remove
return
the value to which the key had been mapped, or null if the key did not have a mapping.

        return cachedProperties.remove(name);
    
protected voidsetAttachments(org.apache.axis.client.Call call)
copy the attachments from the stub to the call object. After doing so, the local set of attachments are cleared.

param
call call object to configure
throws
AxisFault

        // Set the attachments.
        Object[] attachments = getAttachments();
        for(int i=0;i<attachments.length;i++){
            call.addAttachmentPart(attachments[i]);
        }
        clearAttachments();
    
public voidsetHeader(java.lang.String namespace, java.lang.String partName, java.lang.Object headerValue)
Set the header

param
namespace
param
partName that uniquely identify a header object.
param
headerValue Object that is sent in the request as a SOAPHeader

        headers.add(new SOAPHeaderElement(namespace, partName, headerValue));
    
public voidsetHeader(org.apache.axis.message.SOAPHeaderElement header)
Set the header

        headers.add(header);
    
public voidsetMaintainSession(boolean session)
If set to true, session is maintained; if false, it is not.

        maintainSessionSet = true;
        maintainSession = session;
        cachedProperties.put(Call.SESSION_MAINTAIN_PROPERTY, session ? Boolean.TRUE : Boolean.FALSE);
    
public voidsetPassword(java.lang.String password)
Set the password.

        cachedPassword = password;
    
public voidsetPortName(javax.xml.namespace.QName portName)
Set the port QName.

        cachedPortName = portName;
    
public voidsetPortName(java.lang.String portName)
Set the port name.

        setPortName(new QName(portName));
    
protected voidsetRequestHeaders(org.apache.axis.client.Call call)

        
        // Set the call headers.
        SOAPHeaderElement[] headers = getHeaders();
        for(int i=0;i<headers.length;i++){
            call.addHeader(headers[i]);
        }
    
public voidsetTimeout(int timeout)
Set the timeout in milliseconds.

        cachedTimeout = new Integer(timeout);
    
public voidsetUsername(java.lang.String username)
Set the username.

        cachedUsername = username;