src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ClientStubWriter.java
/**
     * Used to write out the catch blocks
     * Used by literal code too!
     */
Used to write out the catch blocks
Used by literal code too!
Used to write out the catch blocks Used by literal code too!
protected void writeCatchBlock(MethodInfo minfo) throws WrapperFault, IOException
    {
        c_writer.write ("\tcatch(AxisException& e)\n\t{\n");
        c_writer.write ("\t\tint iExceptionCode = e.getExceptionCode();\n\n");
        c_writer.write ("\t\tif(AXISC_NODE_VALUE_MISMATCH_EXCEPTION != iExceptionCode)\n");
        c_writer.write ("\t\t{\n");
        c_writer.write ("\t\t\tm_pCall->unInitialize();\n");
        c_writer.write ("\t\t\tthrow;\n");
        c_writer.write ("\t\t}\n\n");
        c_writer.write ("\t\tISoapFault* pSoapFault = (ISoapFault*)\n");
        c_writer.write ("\t\t\tm_pCall->checkFault(\"Fault\",\""
                  + wscontext.getServiceInfo().getTargetEndpointURI () + "\" );\n\n");
        c_writer.write ("\t\tif(pSoapFault)\n");
        c_writer.write ("\t\t{\n");
        Iterator paramsFault = minfo.getFaultType ().iterator ();
        String faultInfoName = null;
        boolean flag = false;
        if (!paramsFault.hasNext ())
            writeOtherFaultException("");
        else
        {
            flag = true;
            c_writer.write ("\t\t\tpcCmplxFaultName = pSoapFault->getCmplxFaultObjectName();\n");
        }
        boolean printedIF = false;
        while (paramsFault.hasNext ())
        {
            FaultInfo info = (FaultInfo) paramsFault.next ();
            faultInfoName = info.getFaultInfo ();
            Iterator infoArrayListIterator = info.getParams ().iterator ();
            while (infoArrayListIterator.hasNext ())
            {
                ParameterInfo paramInfo = (ParameterInfo) infoArrayListIterator.next ();
                if (paramInfo != null)
                    if ("error".equals (paramInfo.getParamName ()))
                    {
                        faultInfoName = paramInfo.getElementName ().getLocalPart ();
                        break;
                    }
            }                          
            ArrayList paramInfo = info.getParams ();
            for (int i = 0; i < paramInfo.size (); i++)
            {
                ParameterInfo par = (ParameterInfo) paramInfo.get (i);
                String langName   = par.getLangName ();
                String faultType  = CUtils.getClassNameFromParamInfoConsideringArrays (par,wscontext);
                String faultTypeName = faultType;
                if (faultType.lastIndexOf('*') != -1)
                    faultTypeName = faultType.substring(0, faultType.lastIndexOf('*'));
                if (CUtils.isSimpleType (faultTypeName))
                    continue;
                if (printedIF)
                    c_writer.write ("\t\t\telse if");
                else
                {
                    c_writer.write ("\t\t\tif");
                    printedIF = true;
                }
                writeExceptions (faultTypeName, faultType, faultInfoName, langName);
            }
        }
        if (flag == true)
        {
            String tab = "";
            if (printedIF)
            {
                c_writer.write ("\t\t\telse\n");
                c_writer.write ("\t\t\t{\n");
                tab = "\t";
            }
            writeOtherFaultException(tab);
            if (printedIF)
                c_writer.write ("\t\t\t}\n");
        }
        c_writer.write ("\t\t}\n");
        c_writer.write ("\t\telse\n");
        c_writer.write ("\t\t{\n");
        c_writer.write ("\t\t\tm_pCall->unInitialize();\n");
        c_writer.write ("\t\t\tdelete pSoapFault;\n");
        c_writer.write ("\t\t\tthrow;\n");
        c_writer.write ("\t\t}\n");
        c_writer.write ("\t}\n");
    }
protected void writeCatchBlock ( MethodInfo minfo ) throws WrapperFault , IOException { c_writer . write ( "\tcatch(AxisException& e)\n\t{\n" ) ; c_writer . write ( "\t\tint iExceptionCode = e.getExceptionCode();\n\n" ) ; c_writer . write ( "\t\tif(AXISC_NODE_VALUE_MISMATCH_EXCEPTION != iExceptionCode)\n" ) ; c_writer . write ( "\t\t{\n" ) ; c_writer . write ( "\t\t\tm_pCall->unInitialize();\n" ) ; c_writer . write ( "\t\t\tthrow;\n" ) ; c_writer . write ( "\t\t}\n\n" ) ; c_writer . write ( "\t\tISoapFault* pSoapFault = (ISoapFault*)\n" ) ; c_writer . write ( "\t\t\tm_pCall->checkFault(\"Fault\",\"" + wscontext . getServiceInfo ( ) . getTargetEndpointURI ( ) + "\" );\n\n" ) ; c_writer . write ( "\t\tif(pSoapFault)\n" ) ; c_writer . write ( "\t\t{\n" ) ; Iterator paramsFault = minfo . getFaultType ( ) . iterator ( ) ; String faultInfoName = null ; boolean flag = false ; if ( ! paramsFault . hasNext ( ) ) writeOtherFaultException ( "" ) ; else { flag = true ; c_writer . write ( "\t\t\tpcCmplxFaultName = pSoapFault->getCmplxFaultObjectName();\n" ) ; } boolean printedIF = false ; while ( paramsFault . hasNext ( ) ) { FaultInfo info = ( FaultInfo ) paramsFault . next ( ) ; faultInfoName = info . getFaultInfo ( ) ; Iterator infoArrayListIterator = info . getParams ( ) . iterator ( ) ; while ( infoArrayListIterator . hasNext ( ) ) { ParameterInfo paramInfo = ( ParameterInfo ) infoArrayListIterator . next ( ) ; if ( paramInfo != null ) if ( "error" . equals ( paramInfo . getParamName ( ) ) ) { faultInfoName = paramInfo . getElementName ( ) . getLocalPart ( ) ; break ; } } ArrayList paramInfo = info . getParams ( ) ; for ( int i = 0 ; i < paramInfo . size ( ) ; i ++ ) { ParameterInfo par = ( ParameterInfo ) paramInfo . get ( i ) ; String langName = par . getLangName ( ) ; String faultType = CUtils . getClassNameFromParamInfoConsideringArrays ( par , wscontext ) ; String faultTypeName = faultType ; if ( faultType . lastIndexOf ( '*' ) != - 1 ) faultTypeName = faultType . substring ( 0 , faultType . lastIndexOf ( '*' ) ) ; if ( CUtils . isSimpleType ( faultTypeName ) ) continue ; if ( printedIF ) c_writer . write ( "\t\t\telse if" ) ; else { c_writer . write ( "\t\t\tif" ) ; printedIF = true ; } writeExceptions ( faultTypeName , faultType , faultInfoName , langName ) ; } } if ( flag == true ) { String tab = "" ; if ( printedIF ) { c_writer . write ( "\t\t\telse\n" ) ; c_writer . write ( "\t\t\t{\n" ) ; tab = "\t" ; } writeOtherFaultException ( tab ) ; if ( printedIF ) c_writer . write ( "\t\t\t}\n" ) ; } c_writer . write ( "\t\t}\n" ) ; c_writer . write ( "\t\telse\n" ) ; c_writer . write ( "\t\t{\n" ) ; c_writer . write ( "\t\t\tm_pCall->unInitialize();\n" ) ; c_writer . write ( "\t\t\tdelete pSoapFault;\n" ) ; c_writer . write ( "\t\t\tthrow;\n" ) ; c_writer . write ( "\t\t}\n" ) ; c_writer . write ( "\t}\n" ) ; }
Used to write out the catch blocks
 Used by literal code too!
Used to write out the catch blocks Used by literal code too!
//to get fault info              // Looking through the list of attributes for the 'error' part of // the fault message.  If found, update the faultInfoName with the // 'localname' of the qname of the attribute.                          // TODO Currently we do not create exception classes for simple types!