src/wsdl/org/apache/axis/wsdl/wsdl2ws/WSDL2Ws.java
/**
     * Kicks of the generation of the stub code.
     * 
     * @throws WrapperFault
     */
Kicks of the generation of the stub code.


Kicks of the generation of the stub code .
public void generateWrappers() throws Exception
    {        
        Port port                 = null;
        BindingEntry bindingEntry = null;
        if (c_cmdLineArgs.isSet("b"))
        {
            bindingEntry = c_wsdlInfo.getBindEntry(c_cmdLineArgs.getBinding());
            if (bindingEntry == null)
                throw new WrapperFault("Specified binding '" + c_cmdLineArgs.getBinding() + "' not found.");
            if (!WSDLInfo.isSOAP11Binding(bindingEntry))
                throw new WrapperFault("Specified binding '" + c_cmdLineArgs.getBinding() + "' is not supported.");
            if (c_wsdlInfo.getServices().size() != 0)
                port = WSDLInfo.getPort((Service)c_wsdlInfo.getServices().get(0), bindingEntry);
        }
        else
        {
            Service service = (Service)c_wsdlInfo.getServices().get(0);
            ArrayList servicePorts = c_wsdlInfo.getPortsSOAP11Document(service);
            if (servicePorts.isEmpty())
                servicePorts = c_wsdlInfo.getPortsSOAP11RPC(service);
            if (servicePorts.isEmpty())
                throw new WrapperFault("A port with a supported binding was not found. Ensure SOAP 1.1 XML namespace is used. ");
            port            = (Port)servicePorts.get(0);
            bindingEntry    = c_symbolTable.getBindingEntry(port.getBinding().getQName());
        }
        if (bindingEntry != null)
        {
            String style = bindingEntry.getBindingStyle().getName();
            if (style == null)
                style = "document";
            if ((style.equals("document") && !bindingEntry.hasLiteral())
                    || (style.equals("rpc") && bindingEntry.hasLiteral()))
                throw new WrapperFault("Binding style not supported.  Supported binding styles: document/literal, rpc/encoded");
            if (style.equals("rpc") && c_cmdLineArgs.getTargetLanguage().equalsIgnoreCase("c"))
                throw new WrapperFault("Cannot generate C stubs for rpc/encoded.");
        }
        WrapperInfo wrapperInfo = 
            new WrapperInfo(bindingEntry.getBindingStyle().getName(), 
                            CUtils.getLanguage(), 
                            c_cmdLineArgs.getOutputDirectory(), 
                            c_cmdLineArgs.getTargetEngine(),
                            c_wsdlInfo.getTargetNameSpaceOfWSDL());
        boolean userRequestedWSDLWrappingStyle = c_cmdLineArgs.isSet("w") && c_cmdLineArgs.isWrapperStyle();
        String serviceName       = WSDLInfo.getServiceName(bindingEntry);
        ArrayList serviceMethods = c_wsdlInfo.processServiceMethods(bindingEntry, 
                                                                    c_cmdLineArgs.isWrapperStyle(), 
                                                                    userRequestedWSDLWrappingStyle);
        ServiceInfo serviceInfo  = new ServiceInfo(serviceName, serviceMethods, WSDLInfo.getTargetEndPointURI(port));
        WebServiceContext wsContext = new WebServiceContext(wrapperInfo, serviceInfo, c_wsdlInfo.getTypeMap()); 
        WebServiceGenerator wsg = WebServiceGeneratorFactory.createWebServiceGenerator(wsContext);
        exposeReferenceTypes(wsContext);
        exposeMessagePartsThatAreAnonymousTypes(wsContext);
        exposeNestedTypesThatAreAnonymousTypes(wsContext);
        if (c_veryVerbose)
            c_wsdlInfo.getTypeMap().dump();
        wsg.generate();
    }
public void generateWrappers ( ) throws Exception { Port port = null ; BindingEntry bindingEntry = null ; if ( c_cmdLineArgs . isSet ( "b" ) ) { bindingEntry = c_wsdlInfo . getBindEntry ( c_cmdLineArgs . getBinding ( ) ) ; if ( bindingEntry == null ) throw new WrapperFault ( "Specified binding '" + c_cmdLineArgs . getBinding ( ) + "' not found." ) ; if ( ! WSDLInfo . isSOAP11Binding ( bindingEntry ) ) throw new WrapperFault ( "Specified binding '" + c_cmdLineArgs . getBinding ( ) + "' is not supported." ) ; if ( c_wsdlInfo . getServices ( ) . size ( ) != 0 ) port = WSDLInfo . getPort ( ( Service ) c_wsdlInfo . getServices ( ) . get ( 0 ) , bindingEntry ) ; } else { Service service = ( Service ) c_wsdlInfo . getServices ( ) . get ( 0 ) ; ArrayList servicePorts = c_wsdlInfo . getPortsSOAP11Document ( service ) ; if ( servicePorts . isEmpty ( ) ) servicePorts = c_wsdlInfo . getPortsSOAP11RPC ( service ) ; if ( servicePorts . isEmpty ( ) ) throw new WrapperFault ( "A port with a supported binding was not found. Ensure SOAP 1.1 XML namespace is used. " ) ; port = ( Port ) servicePorts . get ( 0 ) ; bindingEntry = c_symbolTable . getBindingEntry ( port . getBinding ( ) . getQName ( ) ) ; } if ( bindingEntry != null ) { String style = bindingEntry . getBindingStyle ( ) . getName ( ) ; if ( style == null ) style = "document" ; if ( ( style . equals ( "document" ) && ! bindingEntry . hasLiteral ( ) ) || ( style . equals ( "rpc" ) && bindingEntry . hasLiteral ( ) ) ) throw new WrapperFault ( "Binding style not supported.  Supported binding styles: document/literal, rpc/encoded" ) ; if ( style . equals ( "rpc" ) && c_cmdLineArgs . getTargetLanguage ( ) . equalsIgnoreCase ( "c" ) ) throw new WrapperFault ( "Cannot generate C stubs for rpc/encoded." ) ; } WrapperInfo wrapperInfo = new WrapperInfo ( bindingEntry . getBindingStyle ( ) . getName ( ) , CUtils . getLanguage ( ) , c_cmdLineArgs . getOutputDirectory ( ) , c_cmdLineArgs . getTargetEngine ( ) , c_wsdlInfo . getTargetNameSpaceOfWSDL ( ) ) ; boolean userRequestedWSDLWrappingStyle = c_cmdLineArgs . isSet ( "w" ) && c_cmdLineArgs . isWrapperStyle ( ) ; String serviceName = WSDLInfo . getServiceName ( bindingEntry ) ; ArrayList serviceMethods = c_wsdlInfo . processServiceMethods ( bindingEntry , c_cmdLineArgs . isWrapperStyle ( ) , userRequestedWSDLWrappingStyle ) ; ServiceInfo serviceInfo = new ServiceInfo ( serviceName , serviceMethods , WSDLInfo . getTargetEndPointURI ( port ) ) ; WebServiceContext wsContext = new WebServiceContext ( wrapperInfo , serviceInfo , c_wsdlInfo . getTypeMap ( ) ) ; WebServiceGenerator wsg = WebServiceGeneratorFactory . createWebServiceGenerator ( wsContext ) ; exposeReferenceTypes ( wsContext ) ; exposeMessagePartsThatAreAnonymousTypes ( wsContext ) ; exposeNestedTypesThatAreAnonymousTypes ( wsContext ) ; if ( c_veryVerbose ) c_wsdlInfo . getTypeMap ( ) . dump ( ) ; wsg . generate ( ) ; }
Kicks of the generation of the stub code.
Kicks of the generation of the stub code .
// ================================================== // Get service, ports, binding, and port type // ==================================================    //TODO  resolve this //  this code will generate one stub corresponding to a port.  Other ports //  are ignored. Should really generate one service stub per port. // If binding is specified, ensure binding is supported and see if there is a port that uses  // it in order to get end point. If not specified, then use the service definition to  // obtain the information we need. // Validate binding // Get port in order to obtain end point. Not having a port is OK. // We first ask for SOAP 1.1 ports that have a binding style of document....if  // there is none, then we ask for SOAP 1.1 ports that have a binding style of rpc. // Ensure that binding entry is document/literal or RPC encoded since that is all that is supported. // If C-stubs currently supports document/literal only // ================================================== // Build the context that is needed by the code generators. // ==================================================             // Wrapper info // Service info // Context // Generator // ================================================== // Determine which types to externalize. // ==================================================     // There must be a better way to do this // This call must be last one called of the exposexxx methods! // Dump the map if requested. // ================================================== // Generate the artifacts // ==================================================  // Generate code