
        /**
        * UpdateMemberStub.java
        *
        * This file was auto-generated from WSDL
        * by the Apache Axis2 version: #axisVersion# #today#
        */
        package com.enpresence.cis;

        

        /*
        *  UpdateMemberStub java implementation
        */

        
        public class UpdateMemberStub extends org.apache.axis2.client.Stub
        {
        //default axis home being null forces the system to pick up the mars from the axis2 library
        public static final java.lang.String AXIS2_HOME = null;
        protected static org.apache.axis2.description.AxisOperation[] _operations;

        //hashmaps to keep the fault mapping
        private java.util.HashMap faultExeptionNameMap = new java.util.HashMap();
        private java.util.HashMap faultExeptionClassNameMap = new java.util.HashMap();
        private java.util.HashMap faultMessageMap = new java.util.HashMap();

	
    private void populateAxisService(){

        //creating the Service
        _service = new org.apache.axis2.description.AxisService("UpdateMember");
	

        //creating the operations
        org.apache.axis2.description.AxisOperation __operation;
	


        _operations = new org.apache.axis2.description.AxisOperation[1];
        
                   __operation = new org.apache.axis2.description.OutInAxisOperation();
                

            __operation.setName(new javax.xml.namespace.QName("", "updateMember"));

	    

            _operations[0]=__operation;
            _service.addOperation(__operation);
        
        }

    //populates the faults
    private void populateFaults(){
         
              faultExeptionNameMap.put( new javax.xml.namespace.QName(
                 "http://cis.example.com/2006/schemas/cis/",
                 "ErrorElement"),
                 "com.enpresence.cis.UpdateMemberStub.InvalidMemberIdFaultException"
               );
              faultExeptionClassNameMap.put(new javax.xml.namespace.QName(
                "http://cis.example.com/2006/schemas/cis/",
                "ErrorElement"),
                "com.enpresence.cis.UpdateMemberStub$InvalidMemberIdFaultException");
               faultMessageMap.put( new javax.xml.namespace.QName(
                 "http://cis.example.com/2006/schemas/cis/",
                 "ErrorElement"),
                 "com.example.cis._2006.schemas.cis.ErrorElement"
               );
           
              faultExeptionNameMap.put( new javax.xml.namespace.QName(
                 "http://cis.example.com/2006/schemas/cis/",
                 "ErrorElement"),
                 "com.enpresence.cis.UpdateMemberStub.InvalidMemberIdFaultException"
               );
              faultExeptionClassNameMap.put(new javax.xml.namespace.QName(
                "http://cis.example.com/2006/schemas/cis/",
                "ErrorElement"),
                "com.enpresence.cis.UpdateMemberStub$InvalidMemberIdFaultException");
               faultMessageMap.put( new javax.xml.namespace.QName(
                 "http://cis.example.com/2006/schemas/cis/",
                 "ErrorElement"),
                 "com.example.cis._2006.schemas.cis.ErrorElement"
               );
           
              faultExeptionNameMap.put( new javax.xml.namespace.QName(
                 "http://cis.example.com/2006/schemas/cis/",
                 "ErrorElement"),
                 "com.enpresence.cis.UpdateMemberStub.InvalidMemberIdFaultException"
               );
              faultExeptionClassNameMap.put(new javax.xml.namespace.QName(
                "http://cis.example.com/2006/schemas/cis/",
                "ErrorElement"),
                "com.enpresence.cis.UpdateMemberStub$InvalidMemberIdFaultException");
               faultMessageMap.put( new javax.xml.namespace.QName(
                 "http://cis.example.com/2006/schemas/cis/",
                 "ErrorElement"),
                 "com.example.cis._2006.schemas.cis.ErrorElement"
               );
           


    }

     public UpdateMemberStub(org.apache.axis2.context.ConfigurationContext configurationContext,
        java.lang.String targetEndpoint)
        throws java.lang.Exception {
         //To populate AxisService
         populateAxisService();
         populateFaults();
	
	
        _serviceClient = new org.apache.axis2.client.ServiceClient(configurationContext,_service);
        _serviceClient.getOptions().setTo(new org.apache.axis2.addressing.EndpointReference(
                targetEndpoint));
        
    }

    /**
     * Default Constructor
     */
    public UpdateMemberStub() throws java.lang.Exception {
        
                    this("http://localhost:8080/axis2/services/updateMember" );
                
    }

    /**
     * Constructor taking the target endpoint
     */
    public UpdateMemberStub(java.lang.String targetEndpoint) throws java.lang.Exception {
        this(org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContextFromFileSystem(AXIS2_HOME,null),
                targetEndpoint);
    }



        
                    /**
                    * Auto generated method signature
                    * @see com.enpresence.cis.UpdateMember#updateMember
                        * @param param12
                    
                    */
                    public com.example.cis._2006.schemas.cis.UpdateMemberResponseMsg updateMember(
                    com.example.cis._2006.schemas.cis.UpdateMemberRequestMsg param12)
                    throws java.rmi.RemoteException
                    
                    
                        ,com.enpresence.cis.UpdateMemberStub.InvalidMemberIdFaultException
                        ,com.enpresence.cis.UpdateMemberStub.InvalidMemberIdFaultException
                        ,com.enpresence.cis.UpdateMemberStub.InvalidMemberIdFaultException{
              try{
               org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[0].getName());
              _operationClient.getOptions().setAction("urn:updateMember");
              _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);

              

              // create SOAP envelope with that payload
              org.apache.axiom.soap.SOAPEnvelope env = null;
                    
                                    //Style is Doc.
                                    
                                    
                                                 env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()),
                                                param12,
                                                optimizeContent(new javax.xml.namespace.QName("",
                                                "updateMember")));
                                            

        // create message context with that soap envelope
        org.apache.axis2.context.MessageContext _messageContext = new org.apache.axis2.context.MessageContext() ;
        _messageContext.setEnvelope(env);

        // add the message contxt to the operation client
        _operationClient.addMessageContext(_messageContext);

        //execute the operation client
        _operationClient.execute(true);

         
               org.apache.axis2.context.MessageContext _returnMessageContext = _operationClient.getMessageContext(
                                           org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE);
                org.apache.axiom.soap.SOAPEnvelope _returnEnv = _returnMessageContext.getEnvelope();
                
                
                           java.lang.Object object = fromOM(
                                        getElement(_returnEnv,"document"),
                                        com.example.cis._2006.schemas.cis.UpdateMemberResponseMsg.class,
                                         getEnvelopeNamespaces(_returnEnv));
                           _messageContext.getTransportOut().getSender().cleanup(_messageContext);
                           return (com.example.cis._2006.schemas.cis.UpdateMemberResponseMsg)object;
                    
         }catch(org.apache.axis2.AxisFault f){
            org.apache.axiom.om.OMElement faultElt = f.getDetail();
            if (faultElt!=null){
                if (faultExeptionNameMap.containsKey(faultElt.getQName())){
                    //make the fault by reflection
                    try{
                        java.lang.String exceptionClassName = (java.lang.String)faultExeptionClassNameMap.get(faultElt.getQName());
                        java.lang.Class exceptionClass = java.lang.Class.forName(exceptionClassName);
                        java.rmi.RemoteException ex=
                                (java.rmi.RemoteException)exceptionClass.newInstance();
                        //message class
                        java.lang.String messageClassName = (java.lang.String)faultMessageMap.get(faultElt.getQName());
                        java.lang.Class messageClass = java.lang.Class.forName(messageClassName);
                        java.lang.Object messageObject = fromOM(faultElt,messageClass,null);
                        java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage",
                                   new java.lang.Class[]{messageClass});
                        m.invoke(ex,new java.lang.Object[]{messageObject});
                        
                        if (ex instanceof com.enpresence.cis.UpdateMemberStub.InvalidMemberIdFaultException){
                          throw (com.enpresence.cis.UpdateMemberStub.InvalidMemberIdFaultException)ex;
                        }
                        
                        if (ex instanceof com.enpresence.cis.UpdateMemberStub.InvalidMemberIdFaultException){
                          throw (com.enpresence.cis.UpdateMemberStub.InvalidMemberIdFaultException)ex;
                        }
                        
                        if (ex instanceof com.enpresence.cis.UpdateMemberStub.InvalidMemberIdFaultException){
                          throw (com.enpresence.cis.UpdateMemberStub.InvalidMemberIdFaultException)ex;
                        }
                        

                        throw ex;
                    }catch(java.lang.ClassCastException e){
                       // we cannot intantiate the class - throw the original Axis fault
                        throw f;
                    } catch (java.lang.ClassNotFoundException e) {
                        // we cannot intantiate the class - throw the original Axis fault
                        throw f;
                    }catch (java.lang.NoSuchMethodException e) {
                        // we cannot intantiate the class - throw the original Axis fault
                        throw f;
                    } catch (java.lang.reflect.InvocationTargetException e) {
                        // we cannot intantiate the class - throw the original Axis fault
                        throw f;
                    }  catch (java.lang.IllegalAccessException e) {
                        // we cannot intantiate the class - throw the original Axis fault
                        throw f;
                    }   catch (java.lang.InstantiationException e) {
                        // we cannot intantiate the class - throw the original Axis fault
                        throw f;
                    }
                }else{
                    throw f;
                }
            }else{
                throw f;
            }
        }
        }
            
                /**
                * Auto generated method signature for Asynchronous Invocations
                * @see com.enpresence.cis.UpdateMember#startupdateMember
                    * @param param12
                
                */
                public  void startupdateMember(
                com.example.cis._2006.schemas.cis.UpdateMemberRequestMsg param12,final com.enpresence.cis.UpdateMemberCallbackHandler callback)

                throws java.rmi.RemoteException{

              org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[0].getName());
             _operationClient.getOptions().setAction("urn:updateMember");
             _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);

          

              // create SOAP envelope with that payload
              org.apache.axiom.soap.SOAPEnvelope env=null;
                    
                                    //Style is Doc.
                                    
                                                 env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()), param12, optimizeContent(new javax.xml.namespace.QName("", "updateMember")));
                                            

        // create message context with that soap envelope
        org.apache.axis2.context.MessageContext _messageContext = new org.apache.axis2.context.MessageContext() ;
        _messageContext.setEnvelope(env);

        // add the message contxt to the operation client
        _operationClient.addMessageContext(_messageContext);


                    
                           _operationClient.setCallback(new org.apache.axis2.client.async.Callback() {
                    public void onComplete(
                            org.apache.axis2.client.async.AsyncResult result) {
                        java.lang.Object object = fromOM(getElement(
                                result.getResponseEnvelope(), "document"),
                               com.example.cis._2006.schemas.cis.UpdateMemberResponseMsg.class,
                               getEnvelopeNamespaces(result.getResponseEnvelope())
                            );
                        callback.receiveResultupdateMember((com.example.cis._2006.schemas.cis.UpdateMemberResponseMsg) object);
                    }

                    public void onError(java.lang.Exception e) {
                        callback.receiveErrorupdateMember(e);
                    }
                });
                        

          org.apache.axis2.util.CallbackReceiver _callbackReceiver = null;
        if ( _operations[0].getMessageReceiver()==null &&  _operationClient.getOptions().isUseSeparateListener()) {
           _callbackReceiver = new org.apache.axis2.util.CallbackReceiver();
          _operations[0].setMessageReceiver(
                    _callbackReceiver);
        }

           //execute the operation client
           _operationClient.execute(false);

                    }
                

       /**
        *  A utility method that copies the namepaces from the SOAPEnvelope
        */
       private java.util.Map getEnvelopeNamespaces(org.apache.axiom.soap.SOAPEnvelope env){
        java.util.Map returnMap = new java.util.HashMap();
        java.util.Iterator namespaceIterator = env.getAllDeclaredNamespaces();
        while (namespaceIterator.hasNext()) {
            org.apache.axiom.om.OMNamespace ns = (org.apache.axiom.om.OMNamespace) namespaceIterator.next();
            returnMap.put(ns.getPrefix(),ns.getName());
        }
       return returnMap;
    }

    
	
    private javax.xml.namespace.QName[] opNameArray = null;
	private boolean optimizeContent(javax.xml.namespace.QName opName) {
        

        if (opNameArray == null) {
			return false;
		}
		for (int i = 0; i < opNameArray.length; i++) {
			if (opName.equals(opNameArray[i])) {
				return true;   
			}
		}
		return false;
	}


     
   
         public static class InvalidMemberIdFaultException extends java.rmi.RemoteException{

            private com.example.cis._2006.schemas.cis.ErrorElement faultMessage;

            public void setFaultMessage(com.example.cis._2006.schemas.cis.ErrorElement msg){
               faultMessage = msg;
            }

            public com.example.cis._2006.schemas.cis.ErrorElement getFaultMessage(){
               return faultMessage;
            }
         }
   

    //http://localhost:8080/axis2/services/updateMember
                    private  org.apache.axiom.om.OMElement  toOM(com.example.cis._2006.schemas.cis.ErrorElement param, boolean optimizeContent){
                        if (param instanceof org.apache.axis2.databinding.ADBBean){
                            org.apache.axiom.om.impl.builder.StAXOMBuilder builder
                                       = new org.apache.axiom.om.impl.builder.StAXOMBuilder
                            (org.apache.axiom.om.OMAbstractFactory.getOMFactory(),
                               new org.apache.axis2.util.StreamWrapper(param.getPullParser(com.example.cis._2006.schemas.cis.ErrorElement.MY_QNAME)));
                            org.apache.axiom.om.OMElement documentElement = builder.getDocumentElement();
                            ((org.apache.axiom.om.impl.OMNodeEx) documentElement).setParent(null); // remove the parent link
                            return documentElement;
                        }else{
                           
                           //todo finish this onece the bean serializer has the necessary methods
                            return null;
                        }
                    }

                    private  org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory, com.example.cis._2006.schemas.cis.ErrorElement param, boolean optimizeContent){
                        if (param instanceof org.apache.axis2.databinding.ADBBean){
                            org.apache.axis2.databinding.ADBSOAPModelBuilder builder = new
                                    org.apache.axis2.databinding.ADBSOAPModelBuilder(param.getPullParser(com.example.cis._2006.schemas.cis.ErrorElement.MY_QNAME),
                                                                                     factory);
                            return builder.getEnvelope();
                        }else{
                           
                           //todo finish this onece the bean serializer has the necessary methods
                            return null;
                        }
                    }
                
                    private  org.apache.axiom.om.OMElement  toOM(com.example.cis._2006.schemas.cis.UpdateMemberResponseMsg param, boolean optimizeContent){
                        if (param instanceof org.apache.axis2.databinding.ADBBean){
                            org.apache.axiom.om.impl.builder.StAXOMBuilder builder
                                       = new org.apache.axiom.om.impl.builder.StAXOMBuilder
                            (org.apache.axiom.om.OMAbstractFactory.getOMFactory(),
                               new org.apache.axis2.util.StreamWrapper(param.getPullParser(com.example.cis._2006.schemas.cis.UpdateMemberResponseMsg.MY_QNAME)));
                            org.apache.axiom.om.OMElement documentElement = builder.getDocumentElement();
                            ((org.apache.axiom.om.impl.OMNodeEx) documentElement).setParent(null); // remove the parent link
                            return documentElement;
                        }else{
                           
                           //todo finish this onece the bean serializer has the necessary methods
                            return null;
                        }
                    }

                    private  org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory, com.example.cis._2006.schemas.cis.UpdateMemberResponseMsg param, boolean optimizeContent){
                        if (param instanceof org.apache.axis2.databinding.ADBBean){
                            org.apache.axis2.databinding.ADBSOAPModelBuilder builder = new
                                    org.apache.axis2.databinding.ADBSOAPModelBuilder(param.getPullParser(com.example.cis._2006.schemas.cis.UpdateMemberResponseMsg.MY_QNAME),
                                                                                     factory);
                            return builder.getEnvelope();
                        }else{
                           
                           //todo finish this onece the bean serializer has the necessary methods
                            return null;
                        }
                    }
                
                    private  org.apache.axiom.om.OMElement  toOM(com.example.cis._2006.schemas.cis.UpdateMemberRequestMsg param, boolean optimizeContent){
                        if (param instanceof org.apache.axis2.databinding.ADBBean){
                            org.apache.axiom.om.impl.builder.StAXOMBuilder builder
                                       = new org.apache.axiom.om.impl.builder.StAXOMBuilder
                            (org.apache.axiom.om.OMAbstractFactory.getOMFactory(),
                               new org.apache.axis2.util.StreamWrapper(param.getPullParser(com.example.cis._2006.schemas.cis.UpdateMemberRequestMsg.MY_QNAME)));
                            org.apache.axiom.om.OMElement documentElement = builder.getDocumentElement();
                            ((org.apache.axiom.om.impl.OMNodeEx) documentElement).setParent(null); // remove the parent link
                            return documentElement;
                        }else{
                           
                           //todo finish this onece the bean serializer has the necessary methods
                            return null;
                        }
                    }

                    private  org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory, com.example.cis._2006.schemas.cis.UpdateMemberRequestMsg param, boolean optimizeContent){
                        if (param instanceof org.apache.axis2.databinding.ADBBean){
                            org.apache.axis2.databinding.ADBSOAPModelBuilder builder = new
                                    org.apache.axis2.databinding.ADBSOAPModelBuilder(param.getPullParser(com.example.cis._2006.schemas.cis.UpdateMemberRequestMsg.MY_QNAME),
                                                                                     factory);
                            return builder.getEnvelope();
                        }else{
                           
                           //todo finish this onece the bean serializer has the necessary methods
                            return null;
                        }
                    }
                

           /**
           *  get the default envelope
           */
           private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory){
                return factory.getDefaultEnvelope();
           }


            private  java.lang.Object fromOM(
            org.apache.axiom.om.OMElement param,
            java.lang.Class type,
            java.util.Map extraNamespaces){

                try {
                       
                      if (com.example.cis._2006.schemas.cis.ErrorElement.class.equals(type)){
                           return com.example.cis._2006.schemas.cis.ErrorElement.Factory.parse(param.getXMLStreamReaderWithoutCaching());
                      }
                              
                      if (com.example.cis._2006.schemas.cis.UpdateMemberResponseMsg.class.equals(type)){
                           return com.example.cis._2006.schemas.cis.UpdateMemberResponseMsg.Factory.parse(param.getXMLStreamReaderWithoutCaching());
                      }
                              
                      if (com.example.cis._2006.schemas.cis.UpdateMemberRequestMsg.class.equals(type)){
                           return com.example.cis._2006.schemas.cis.UpdateMemberRequestMsg.Factory.parse(param.getXMLStreamReaderWithoutCaching());
                      }
                              
                } catch (Exception e) {
                     throw new RuntimeException(e);
                }

                return null;
            }

        
   }
   