You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sa...@apache.org on 2003/12/16 11:35:26 UTC

cvs commit: ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws WSDL2Ws.java WrapperUtils.java

sanjaya     2003/12/16 02:35:26

  Modified:    c/src/wsdl/org/apache/axis/wsdl/wsdl2ws Tag: CWrapperSupport
                        WSDL2Ws.java WrapperUtils.java
  Log:
  restructered coding
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.7.4.2   +258 -215  ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WSDL2Ws.java
  
  Index: WSDL2Ws.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WSDL2Ws.java,v
  retrieving revision 1.7.4.1
  retrieving revision 1.7.4.2
  diff -u -r1.7.4.1 -r1.7.4.2
  --- WSDL2Ws.java	14 Nov 2003 12:04:23 -0000	1.7.4.1
  +++ WSDL2Ws.java	16 Dec 2003 10:35:26 -0000	1.7.4.2
  @@ -57,10 +57,11 @@
   import java.util.ArrayList;
   import java.util.Iterator;
   import java.util.List;
  +import java.util.Map;
   import java.util.Vector;
   
   import javax.wsdl.Binding;
  -import javax.wsdl.BindingInput;
  +import javax.wsdl.Fault;
   import javax.wsdl.Operation;
   import javax.wsdl.Part;
   import javax.wsdl.Port;
  @@ -68,15 +69,10 @@
   import javax.xml.namespace.QName;
   import javax.xml.rpc.holders.IntHolder;
   
  -import org.apache.axis.wsdl.wsdl2ws.info.MethodInfo;
  -import org.apache.axis.wsdl.wsdl2ws.info.ParameterInfo;
  -import org.apache.axis.wsdl.wsdl2ws.info.ServiceInfo;
  -import org.apache.axis.wsdl.wsdl2ws.info.Type;
  -import org.apache.axis.wsdl.wsdl2ws.info.TypeMap;
  -import org.apache.axis.wsdl.wsdl2ws.info.WebServiceContext;
  -import org.apache.axis.wsdl.wsdl2ws.info.WrapperInfo;
  -
   import org.apache.axis.wsdl.gen.Parser;
  +import org.apache.axis.wsdl.symbolTable.BindingEntry;
  +import org.apache.axis.wsdl.symbolTable.CollectionType;
  +import org.apache.axis.wsdl.symbolTable.Element;
   import org.apache.axis.wsdl.symbolTable.ElementDecl;
   import org.apache.axis.wsdl.symbolTable.PortTypeEntry;
   import org.apache.axis.wsdl.symbolTable.SchemaUtils;
  @@ -84,6 +80,16 @@
   import org.apache.axis.wsdl.symbolTable.SymTabEntry;
   import org.apache.axis.wsdl.symbolTable.SymbolTable;
   import org.apache.axis.wsdl.symbolTable.TypeEntry;
  +import org.apache.axis.wsdl.toJava.Utils;
  +import org.apache.axis.wsdl.wsdl2ws.info.ElementInfo;
  +import org.apache.axis.wsdl.wsdl2ws.info.FaultInfo;
  +import org.apache.axis.wsdl.wsdl2ws.info.MethodInfo;
  +import org.apache.axis.wsdl.wsdl2ws.info.ParameterInfo;
  +import org.apache.axis.wsdl.wsdl2ws.info.ServiceInfo;
  +import org.apache.axis.wsdl.wsdl2ws.info.Type;
  +import org.apache.axis.wsdl.wsdl2ws.info.TypeMap;
  +import org.apache.axis.wsdl.wsdl2ws.info.WebServiceContext;
  +import org.apache.axis.wsdl.wsdl2ws.info.WrapperInfo;
   import org.w3c.dom.Node;
   
   /**
  @@ -99,7 +105,8 @@
    * @author hemapani@opensource.lk
    */
   public class WSDL2Ws {
  -    private PortType porttype;
  +
  +    private String language;
   
       private String qualifiedServiceName;
       private SymbolTable symbolTable;
  @@ -107,144 +114,102 @@
       private String typeval;
   
       private String serviceStyle = null;
  -    private String encodingStyle = null;
  +
  +    private boolean verbose = true;
       private String targetEndpointURI = null;
       private String transportURI = null;
       private String targetNameSpaceOfWSDL = null;
       private TypeMap typeMap;
  +    
  +    private ServiceEntry serviceentry;
  +    private BindingEntry bindingEntry;
  +    private PortTypeEntry portTypeEntry;
  +	private ArrayList methods;	
   
       public WSDL2Ws(CLArgParser cmdLineArgs) throws WrapperFault {
           try {
  -            typeMap = new TypeMap();
               Parser wsdlParser = new Parser();
               //get the commandline arguments
               String wsdlfile = cmdLineArgs.getArgument(0);
               wsdlParser.run(wsdlfile);
   
               symbolTable = wsdlParser.getSymbolTable();
  -            // symbolTable.dump(System.out);
               
               //get the target namespace
   			targetNameSpaceOfWSDL = symbolTable.getDefinition().getTargetNamespace();
  -            porttype = this.getWebServiceInfo();
           } catch (Exception e) {
               e.printStackTrace();
               throw new WrapperFault(e);
           }
       }
  +    
  +    /** 
  +     * this method initailize the serviceEntry portEntry and bindingEntry   
  +     * @throws WrapperFault
  +     */
  +    
  +    public void perprocess()throws WrapperFault{
  +		typeMap = new TypeMap(language);
  +		this.serviceentry = getServiceEntry();
  +		Iterator ports = this.serviceentry.getService().getPorts().values().iterator();
  +		
  +//TODO  resolve this
  +//		this code support only the service with onebindings it will not care about the
  +//		second binding if exists.. if the NO binding specified it will failed
  +//		this should be resolved by let user specify which binding to use.
  +
  +		Binding binding = null;
  +		if (ports.hasNext())
  +			binding = ((Port) ports.next()).getBinding();
  +		if (binding == null)
  +			throw new WrapperFault("No binding specified");
  +		this.bindingEntry = symbolTable.getBindingEntry(binding.getQName());
  +		
  +		this.portTypeEntry = symbolTable.getPortTypeEntry(binding.getPortType().getQName());
  +		if (portTypeEntry == null)
  +			throw new WrapperFault("Service not found");
  +		this.targetEndpointURI = SymbolTableParsingUtils.getTargetEndPointURI(ports);			
  +    }
  +    
  +    
   
       /**
        * This method exteact the service,binding,encoding information and return a PortType of the
        * webservice to publish.
        * @return port type the webservice based on
        */
  -    private PortType getWebServiceInfo()
  +    private void getWebServiceInfo()
           throws WrapperFault {
  -		//get the service 
  -		//there seem to be a neater way to get the service,
  -		// use this instead of follows       	
  -		ServiceEntry sentry = getServiceEntry();	 	   
  -        //ServiceEntry sentry = symbolTable.getServiceEntry(new QName(serviceuri, servicelocalpart));
  -        Iterator ports = sentry.getService().getPorts().values().iterator();
  -        //if the targetEndPointURI not specifed we continue having it null
  -        //The WrapperInfo will set a default value for the targetEndPointURI
  -        if (ports.hasNext()) {
  -            Port port = (Port) ports.next();
  -            List adresslist = port.getExtensibilityElements();
  -            if (adresslist != null
  -                && adresslist.size() != 0
  -                && (adresslist.get(0)
  -                    instanceof com.ibm.wsdl.extensions.soap.SOAPAddressImpl))
  -                this.targetEndpointURI =
  -                    ((com.ibm.wsdl.extensions.soap.SOAPAddressImpl) adresslist.get(0))
  -                        .getLocationURI();
  -        }
  -
  -        //get the binding
  -        Iterator portmap = sentry.getService().getPorts().values().iterator();
  -        //TODO resolve this
  -        /*
  -            this code support only the service with onebindings it will not care about the
  -            second binding if exists.. if the NO binding specified it will failed
  -         */
  -        Binding binding = null;
  -        if (portmap.hasNext())
  -            binding = ((Port) portmap.next()).getBinding();
  -
  -        if (binding == null)
  -            throw new WrapperFault("No binding specified");
  -
  -        //the service style (rpc|doc|msg)
  -        this.serviceStyle =
  -            symbolTable.getBindingEntry(binding.getQName()).getBindingStyle().getName();
  -
  -        //extract the trasport type as a uri
  -        List soapbinding = binding.getExtensibilityElements();
  -        if (soapbinding != null
  -            && soapbinding.size() > 0
  -            && (soapbinding.get(0) instanceof com.ibm.wsdl.extensions.soap.SOAPBindingImpl))
  -            this.transportURI =
  -                ((com.ibm.wsdl.extensions.soap.SOAPBindingImpl) soapbinding.get(0))
  -                    .getTransportURI();
  -
  -        /**
  -         * --- Get the encoding style ---
  -         * The WSDL file specified the encoding for the each operation in the binding.
  -         * but tool can not genarate the stub/skeltons/types which each has different 
  -         * encoding styles. So the encoding style given in the FIRST OPERATION will be used 
  -         * as THE ENCODED style for all the operations.
  -         * # if the more than one encoding style define for the first operation the 
  -         * # first among them will be used.   
  -         */
  -
  -        List operations = binding.getBindingOperations();
  +		this.qualifiedServiceName = portTypeEntry.getName();
  +		if (this.qualifiedServiceName == null) {
  +			qualifiedServiceName = portTypeEntry.getQName().getNamespaceURI();
  +			qualifiedServiceName =
  +				WrapperUtils.firstCharacterToLowercase(
  +					WrapperUtils.nsURI2packageName(qualifiedServiceName))
  +					+ "."
  +					+ portTypeEntry.getQName().getLocalPart();
  +		}
  +		
  +		//the service style (rpc|doc|msg)
  +		this.serviceStyle = bindingEntry.getBindingStyle().getName();
  +		//extract the trasport type as a uri
  +		this.transportURI = SymbolTableParsingUtils.getTransportType(bindingEntry.getBinding());
  +		
  +        List operations = bindingEntry.getBinding().getBindingOperations();
           if (operations != null) {
   
               for (int i = 0; i < operations.size(); i++) {
  -                //for the first binding operation found
  -                if (operations.get(i) instanceof com.ibm.wsdl.BindingOperationImpl) {
  -                    BindingInput input;
  -
  -                    if ((input =
  -                        ((com.ibm.wsdl.BindingOperationImpl) operations.get(i))
  -                            .getBindingInput())
  -                        == null)
  -                        break;
  -                    List soapbodies = input.getExtensibilityElements();
  -
  -                    if (soapbodies != null) {
  -                        for (int j = 0; j < operations.size(); j++) {
  -                            if (soapbodies.get(i)
  -                                instanceof com.ibm.wsdl.extensions.soap.SOAPBodyImpl) {
  -                                List encodings =
  -                                    ((com.ibm.wsdl.extensions.soap.SOAPBodyImpl) soapbodies
  -                                        .get(j))
  -                                        .getEncodingStyles();
  -                                if (encodings != null && encodings.size() > 0)
  -                                    this.encodingStyle = (String) encodings.get(0);
  -                                break;
  -                            }
  -                        }
  -                    }
  -                    break;
  +                //for the each binding operation found
  +                if (operations.get(i) instanceof javax.wsdl.BindingOperation) {
  +                	
  +					javax.wsdl.BindingOperation bindinop = (javax.wsdl.BindingOperation) operations.get(i);
  +					MethodInfo method = getMethodInfoByName(bindinop.getName());
  +					method.setSoapAction(SymbolTableParsingUtils.getSoapAction(bindinop));
  +					SymbolTableParsingUtils.getInputInfo(bindinop.getBindingInput(),method);
  +                    SymbolTableParsingUtils.getOutputInfo(bindinop.getBindingOutput(),method);
                   }
               }
           }
  -
  -        PortTypeEntry classinfo = symbolTable.getPortTypeEntry(binding.getPortType().getQName());
  -        if (classinfo == null)
  -            throw new WrapperFault("Service not found");
  -        this.qualifiedServiceName = classinfo.getName();
  -        if (this.qualifiedServiceName == null) {
  -            qualifiedServiceName = classinfo.getQName().getNamespaceURI();
  -            qualifiedServiceName =
  -                WrapperUtils.firstCharacterToLowercase(
  -                    WrapperUtils.nsURI2packageName(qualifiedServiceName))
  -                    + "."
  -                    + classinfo.getQName().getLocalPart();
  -        }
  -        return classinfo.getPortType();
  -
       }
   
       /**
  @@ -252,7 +217,7 @@
        * When possible the user can have the schema QName if he like
        */
   
  -    private ArrayList getServiceInfo(PortType porttype, String language) {
  +    private ArrayList getServiceInfo(PortType porttype)throws WrapperFault {
           //get opeation list
           Iterator oplist = porttype.getOperations().iterator();
           ArrayList methods = new ArrayList();
  @@ -268,26 +233,18 @@
               //add operation to operation List
               Operation op = (Operation) oplist.next();
               minfo.setMethodname(op.getName());
  +            
  +            //setting the faults
  +            Map faults = op.getFaults();
  +			addFaultInfo(faults,minfo);
  +            
   
               Iterator paramlist =
                   op.getInput().getMessage().getParts().values().iterator();
               //add each parameter to parameter list
               while (paramlist.hasNext()) {
                   Part p = (Part) paramlist.next();
  -
  -                //TODO some types type name is null we neglect them is that right??
  -                if (p.getTypeName() == null) {
  -                    continue;
  -                }
  -
  -                ptype = symbolTable.getType(p.getTypeName());
  -                pinfo =
  -                    new ParameterInfo(
  -                        ptype.getName(),
  -                        ptype.getQName(),
  -                        p.getName(),
  -                        language);
  -
  +                pinfo = createParameterInfo(p);
                   minfo.addParameter(pinfo);
               }
   
  @@ -296,14 +253,7 @@
                   op.getOutput().getMessage().getParts().values().iterator();
               if (returnlist.hasNext()) {
                   Part p = ((Part) returnlist.next());
  -
  -                //TODO some types type name is null we neglect them is that right??
  -                if (p.getTypeName() == null)
  -                    continue;
  -
  -                ptype = symbolTable.getType(p.getTypeName());
  -                minfo.setReturnType(
  -                    new ParameterInfo(ptype.getName(), ptype.getQName(), null, language));
  +   		        minfo.setReturnType(createParameterInfo(p));
               }
           }
           return methods;
  @@ -313,7 +263,7 @@
        * This method extract the custom complex type info fom the symbol table
        * @return the type map with type info
        */
  -    private TypeMap getTypeInfo(String targetLanguage) {
  +    private TypeMap getTypeInfo(String targetLanguage)throws WrapperFault {
           Iterator it = symbolTable.getTypeIndex().values().iterator();
           TypeEntry type;
           Iterator elements;
  @@ -324,10 +274,8 @@
               type = (TypeEntry) it.next();
               Node node = type.getNode();
               if (node != null) {
  -					typedata = getTypeInfo(type,targetLanguage);
  -	                System.out.println(
  -                        "############## the type found =" + type.getQName());
  -                    typeMap.addType(type.getQName(), typedata);
  +					createTypeInfo(type,targetLanguage);
  +
               }
           } //end of type while
           return typeMap;
  @@ -340,14 +288,20 @@
           String targetImplementationStyle,
           String targetEngine)
           throws WrapperFault {
  -
  +        	
  +		this.language = targetLanguage;
   		if (targetLanguage == null) targetLanguage = "c++";
   		if (targetEngine == null) targetEngine = "server";
   		if (targetoutputLocation == null) targetoutputLocation = "./";
  -		QName serviceqname = getServiceEntry().getService().getQName();
  +		
  +		perprocess();
  +		
  +		QName serviceqname = serviceentry.getService().getQName();
   		servicename = serviceqname.getLocalPart();
  -        ArrayList methods = this.getServiceInfo(this.porttype, targetLanguage);
  -        TypeMap typeMap = this.getTypeInfo(targetLanguage);
  +		typeMap = this.getTypeInfo(targetLanguage);
  +        methods = this.getServiceInfo(this.portTypeEntry.getPortType());
  +        this.getWebServiceInfo();
  +        
           //TODO	chaeck weather the name at the WrapperConstant Doclit is right "doc"
   
           WebServiceGenarator wsg =
  @@ -356,7 +310,6 @@
                       new WrapperInfo(
                           serviceStyle,
                           targetLanguage,
  -                        encodingStyle,
                           targetoutputLocation,
                           targetImplementationStyle,
                           targetEngine,
  @@ -367,8 +320,13 @@
                       typeMap));
           if (wsg == null)
               throw new WrapperFault("does not support the option combination");
  -        wsg.genarate();
  -
  +        if(verbose){
  +        	Iterator it = typeMap.getTypes().iterator();
  +        	while(it.hasNext()){
  +        		System.out.println(it.next());
  +        	}
  +        }    
  + 		wsg.genarate();
       }
       
       /**
  @@ -393,6 +351,21 @@
   		 throw new WrapperFault("the service does not exists");
       }
       
  +	public Type createTypeInfo(QName typename,String targetLanguage)throws WrapperFault{
  +		TypeEntry type = symbolTable.getType(typename);	
  +		if(type == null){
  +			type = symbolTable.getElement(typename);
  +			if(type == null){
  +				throw new WrapperFault("["+typename+"]unexpected condition occured " +
  +					".. please inform the axis-dev@apache.org mailing list ASAP");
  +				
  +			}
  +			type.getRefType();
  +		}
  +	
  +		return createTypeInfo(type,targetLanguage);
  +	}
  +    
       /**
        * This code is borrowd from the JavaBeanWriter#writeFullConstructor().
        * @param type
  @@ -400,83 +373,153 @@
        * @return
        */
   
  -	public Type getTypeInfo(TypeEntry type,String targetLanguage){
  -		if(type == null)
  -			return null;
  +	public Type createTypeInfo(TypeEntry type,String targetLanguage)throws WrapperFault{
  +		Type typedata = typeMap.getType(type.getQName());
  +		
  +		if(typedata!= null){
  +			//type is a inbild type or a already created type
  +			return typedata;  
  +		}
  +
  +					
  +		System.out.println(
  +			"############## the type found =" + type.getQName());
  +		typedata =
  +			new Type(type.getQName(), type.getName(), true, targetLanguage);
  +		typeMap.addType(type.getQName(), typedata);
   			
   		Node node = type.getNode();
  -		Type typedata =
  -			new Type(type.getQName(), type.getName(), true, targetLanguage);
   
  -		//is this a SOAPEnc array type	
  -		QName arrayType =
  -			SchemaUtils.getArrayComponentQName(node, new IntHolder(0));
  -		if (arrayType != null) {
  -			typedata.setTypeNameForAttribName("item", arrayType);
  +		Vector enumdata = null;
  +		if(type.isSimpleType())
  +			enumdata = Utils.getEnumerationBaseAndValues(node,symbolTable);
  +		if(enumdata != null){
  +			typedata.setEnumerationdata(enumdata);
  +		}else if(type instanceof CollectionType){
  +			typedata.setTypeNameForElementName(new ElementInfo(type.getQName(),
  +					createTypeInfo(type.getRefType().getQName(),targetLanguage)));
   			typedata.setArray(true);
  -		} else if (
  -			(arrayType = SchemaUtils.getCollectionComponentQName(node))
  -				!= null) {
  -			typedata.setTypeNameForAttribName("item", arrayType);
  -			typedata.setArray(true);
  -		} 
  -		//Note in a array the parameter type is stored as under the name item all the time  
  -		else {
  -			// get all extended types
  -			Vector extendList = new Vector();
  -			extendList.add(type);
  -			TypeEntry parent = SchemaUtils.getComplexElementExtensionBase(
  -													type.getNode(),symbolTable);
  -			while(parent != null) {
  -				extendList.add(parent);
  -				parent = SchemaUtils.getComplexElementExtensionBase(
  -											parent.getNode(),symbolTable);
  -			}
  -	
  -			// Now generate a list of names and types starting with
  -			// the oldest parent.  (Attrs are considered before elements).
  -			for (int i=extendList.size()-1; i >= 0; i--) {
  -				TypeEntry te = (TypeEntry) extendList.elementAt(i);
  -	
  -				
  -				//TODO the code require the attributes name at extension base types
  -				//different, the WSDL2Ws do not support it having same name at up and below.
  -				
  -				// The names of the inherited parms are mangled
  -				// in case they interfere with local parms.
  -				String mangle = "";
  -				//if (i > 0) {
  -				//	mangle = "_" +
  -				//		Utils.xmlNameToJava(te.getQName().getLocalPart()) +
  -				//		"_";
  -				//}
  -				
  -				// Process the attributes
  -				Vector attributes = SchemaUtils.getContainedAttributeTypes(
  -					te.getNode(), symbolTable);
  -				if (attributes != null) {
  -					for (int j=0; j<attributes.size(); j+=2) {
  -						typedata.setTypeNameForAttribName(
  -							((QName)attributes.get(j + 1)).getLocalPart(),
  -							((TypeEntry) attributes.get(j)).getQName());
  -					}
  +			typedata.setCanThisOccuredmoreThanOnceAllTheTime(true);		
  +		}else{
  +			//is this a SOAPEnc array type	
  +			QName arrayType =
  +				SchemaUtils.getArrayComponentQName(node, new IntHolder(0));
  +			if (arrayType != null) {
  +				typedata.setTypeNameForElementName(new ElementInfo(new QName("item"),
  +						createTypeInfo(arrayType,targetLanguage)));
  +				typedata.setArray(true);
  +			} else if (
  +				(arrayType = SchemaUtils.getCollectionComponentQName(node))
  +					!= null) {
  +				typedata.setTypeNameForElementName(new ElementInfo(new QName("item"),
  +						createTypeInfo(arrayType,targetLanguage)));
  +				typedata.setArray(true);
  +			} 
  +			//Note in a array the parameter type is stored as under the name item all the time  
  +			else {
  +				// get all extended types
  +				Vector extendList = new Vector();
  +				extendList.add(type);
  +				TypeEntry parent = SchemaUtils.getComplexElementExtensionBase(
  +														type.getNode(),symbolTable);
  +				while(parent != null) {
  +					extendList.add(parent);
  +					parent = SchemaUtils.getComplexElementExtensionBase(
  +												parent.getNode(),symbolTable);
   				}
  -				// Process the elements
  -				Vector elements = SchemaUtils.getContainedElementDeclarations(
  -										te.getNode(), symbolTable);
  -				if (elements != null) {
  -					for (int j=0; j<elements.size(); j++) {
  -						ElementDecl elem = (ElementDecl)elements.get(j);
  -						typedata.setTypeNameForAttribName(
  -								elem.getName().getLocalPart(),
  -								elem.getType().getQName());
  -					}			
  +		
  +				// Now generate a list of names and types starting with
  +				// the oldest parent.  (Attrs are considered before elements).
  +				for (int i=extendList.size()-1; i >= 0; i--) {
  +					TypeEntry te = (TypeEntry) extendList.elementAt(i);
  +		
  +					
  +					//TODO the code require the attributes name at extension base types
  +					//different, the WSDL2Ws do not support it having same name at up and below.
  +					
  +					// The names of the inherited parms are mangled
  +					// in case they interfere with local parms.
  +					String mangle = "";
  +					//if (i > 0) {
  +					//	mangle = "_" +
  +					//		Utils.xmlNameToJava(te.getQName().getLocalPart()) +
  +					//		"_";
  +					//}
  +					
  +					// Process the attributes
  +					Vector attributes = SchemaUtils.getContainedAttributeTypes(
  +						te.getNode(), symbolTable);
  +					if (attributes != null) {
  +						for (int j=0; j<attributes.size(); j+=2) {
  +							typedata.setTypeForAttributeName(
  +								((QName)attributes.get(j + 1)).getLocalPart(),
  +							createTypeInfo(((TypeEntry) attributes.get(j)).getQName(),targetLanguage));
  +						}
  +					}
  +					// Process the elements
  +					Vector elements = SchemaUtils.getContainedElementDeclarations(
  +											te.getNode(), symbolTable);
  +					if (elements != null) {
  +						for (int j=0; j<elements.size(); j++) {
  +							ElementDecl elem = (ElementDecl)elements.get(j);
  +							QName typeName = elem.getType().getQName();
  +							if(typeName.getLocalPart().indexOf('[')>0){
  +								String localpart = typeName.getLocalPart().substring(0,typeName.getLocalPart().indexOf('['));
  +								typeName = new QName(typeName.getNamespaceURI(),localpart);
  +							}
  +								
  +							ElementInfo eleinfo = new ElementInfo(elem.getName(),createTypeInfo(typeName,targetLanguage));
  +							eleinfo.setMinOccurs(elem.getMaxOccurs());
  +							typedata.setTypeNameForElementName(eleinfo);
  +						}			
  +					}
   				}
   			}
   		}	
   		return typedata;
   	}
   
  +	private void addFaultInfo(Map faults,MethodInfo methodinfo)throws WrapperFault{
  +		if(faults == null)
  +			return;
  +		Iterator faultIt = faults.values().iterator();
  +		while(faultIt.hasNext()){
  +			Fault fault = (Fault)faultIt.next();
  +			FaultInfo faultinfo = new FaultInfo(fault.getName());
  +			Map parts = fault.getMessage().getParts();
  +			Iterator partIt = parts.values().iterator();
  +			while(partIt.hasNext()){
  +				faultinfo.addParam(createParameterInfo((Part)partIt.next()));
  +			}			  
  +		}	 
  +	
  +	}
  +	
  +	private ParameterInfo createParameterInfo(Part part)throws WrapperFault{
  +		QName qname = part.getTypeName();
  +		if(qname == null){
  +			Element element = symbolTable.getElement(part.getElementName());
  +			qname = element.getRefType().getQName();
  +		}
  +		TypeEntry tentry = symbolTable.getType(qname);
  +		
  +		Type type = this.typeMap.getType(qname);
  +		if(type == null)
  +			throw new WrapperFault("unregisterd type "+qname+" refered");
  +			
  +		ParameterInfo parainfo = 
  +			new ParameterInfo(type,part.getName());
  +		parainfo.setElementName(part.getElementName());
  +		return parainfo;
  +	}
  +
  +	private MethodInfo getMethodInfoByName(String name)throws WrapperFault{
  +		for(int i = 0; i < methods.size();i++){
  +			if(((MethodInfo)methods.get(i)).getMethodname().equals(name))
  +				return (MethodInfo)methods.get(i);
  +		}
  +		throw new WrapperFault("binding and the port type do not match");
  +	}
   
       /**
        * Usage
  
  
  
  1.3.4.1   +12 -0     ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WrapperUtils.java
  
  Index: WrapperUtils.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WrapperUtils.java,v
  retrieving revision 1.3
  retrieving revision 1.3.4.1
  diff -u -r1.3 -r1.3.4.1
  --- WrapperUtils.java	13 Oct 2003 11:09:13 -0000	1.3
  +++ WrapperUtils.java	16 Dec 2003 10:35:26 -0000	1.3.4.1
  @@ -59,6 +59,7 @@
    */
   package org.apache.axis.wsdl.wsdl2ws;
   
  +import java.util.Enumeration;
   import java.util.Stack;
   import java.util.StringTokenizer;
   
  @@ -221,6 +222,17 @@
   			}
   		}else
   			return param.getLangName();			
  +	}
  +	
  +	public static Type getArrayType(Type type)throws WrapperFault{
  +		if(!type.isArray())
  +			return null;
  +		Enumeration elements = type.getElementnames();
  +		if(elements.hasMoreElements()){
  +			return type.getElementForElementName(
  +				(String)elements.nextElement()).getType();
  +		}
  +		throw new WrapperFault("Array type do not have any attibutes");
   	}
   }