axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ow...@apache.org
Subject cvs commit: xml-axis-wsif/java/src/org/apache/wsif/providers/soap/apachesoap WSIFOperation_ApacheSOAP.java
Date Mon, 25 Nov 2002 14:55:33 GMT
owenb       2002/11/25 06:55:33

  Modified:    java/src/org/apache/wsif/providers/soap/apachesoap Tag:
                        pre1_2_0-patches WSIFOperation_ApacheSOAP.java
  Log:
  When preparing the operation, if a type or subtype is mapped dynamically, base the mapping
on
  the input encoding style rather than always adding a mapping for SOAP-ENC style i.e. use
literal
  style and the PartSerializer when necessary.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.30.2.2  +101 -86   xml-axis-wsif/java/src/org/apache/wsif/providers/soap/apachesoap/WSIFOperation_ApacheSOAP.java
  
  Index: WSIFOperation_ApacheSOAP.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/providers/soap/apachesoap/WSIFOperation_ApacheSOAP.java,v
  retrieving revision 1.30.2.1
  retrieving revision 1.30.2.2
  diff -u -r1.30.2.1 -r1.30.2.2
  --- WSIFOperation_ApacheSOAP.java	4 Nov 2002 16:50:45 -0000	1.30.2.1
  +++ WSIFOperation_ApacheSOAP.java	25 Nov 2002 14:55:32 -0000	1.30.2.2
  @@ -218,52 +218,6 @@
           return op;
       }
   
  -    //    /**
  -    //     * Creates a new input WSIFMessage. This overrides the 
  -    //     * WSIFDefaultOperation method to enable the use of 
  -    //     * compiled WSIFMessages by using a WSIFMessageFactory
  -    //     * to create the message.
  -    //     * 
  -    //     * @param name   the name of the message
  -    //     * @return a WSIFMessage instance
  -    //     * @see WSIFOperation#createInputMessage(String)
  -    //     */
  -    // defect 131672 and disable compiled msg support for now
  -    //    public WSIFMessage createInputMessage(String name) {
  -    //        Tr.entry(this, name);
  -    //        Definition d = getDefinition();
  -    //        String ns = (d == null) ? "" : d.getTargetNamespace();
  -    //        WSIFMessageFactory mf = WSIFServiceImpl.getMessageFactory();
  -    //        WSIFMessage msg = mf.createMessage(ns, name + "Message");
  -    //        if (msg != null)
  -    //            msg.setName(name);
  -    //        Tr.exit(msg);
  -    //       return msg;
  -    //    }
  -    //
  -    //    /**
  -    //     * Creates a new input WSIFMessage. This overrides the 
  -    //     * WSIFDefaultOperation method to enable the use of 
  -    //     * compiled WSIFMessages by using a WSIFMessageFactory
  -    //     * to create the message.
  -    //     * 
  -    //     * @param name   the name of the message
  -    //     * @return a WSIFMessage instance
  -    //     * @see WSIFOperation#createInputMessage(String)
  -    //     */
  -    // defect 131672 and disable compiled msg support for now
  -    //    public WSIFMessage createOutputMessage(String name) {
  -    //        Tr.entry(this, name);
  -    //        Definition d = getDefinition();
  -    //        String ns = (d == null) ? "" : d.getTargetNamespace();
  -    //        WSIFMessageFactory mf = WSIFServiceImpl.getMessageFactory();
  -    //        WSIFMessage msg = mf.createMessage(ns, name + "Message");
  -    //        if (msg != null)
  -    //            msg.setName(name);
  -    //        Tr.exit(msg);
  -    //        return msg;
  -    //    }
  -
       /**
        * Gets the target namespace URI of this WSIFOperation 
        * 
  @@ -287,6 +241,23 @@
           HashMap mapOfUserTypes = portInstance.getLocalTypeMap();
           SOAPMappingRegistry smr = portInstance.getSOAPMappingRegistry();
   
  +        // Instantiate serializers once for the entire prepare
  +        BeanSerializer beanSer = new BeanSerializer();
  +        PartSerializer partSer = null;
  +        if (partSerializerName != null) {
  +            try {
  +                partSer =
  +                    (PartSerializer) Class
  +                        .forName(
  +                            partSerializerName,
  +                            true,
  +                            Thread.currentThread().getContextClassLoader())
  +                        .newInstance();
  +            } catch (Throwable ignored) {
  +                Trc.ignoredException(ignored);
  +            }
  +        }
  +
           // first determine list of arguments
           Input input = operation.getInput();
           if (input != null) {
  @@ -348,22 +319,39 @@
                                   String className =
                                       WSIFUtils.getJavaClassNameFromXMLName(
                                           qname.getLocalPart());
  -                                Class inputClass =
  -                                    Class.forName(
  -                                        packageName + "." + className,
  -                                        true,
  -                                        Thread
  -                                            .currentThread()
  -                                            .getContextClassLoader());
  -                                types[i] = inputClass;
  -                                BeanSerializer beanSer = new BeanSerializer();
  -                                smr.mapTypes(
  -                                    Constants.NS_URI_SOAP_ENC,
  -                                    qname,
  -                                    inputClass,
  -                                    beanSer,
  -                                    beanSer);
  -                                mapSubtypes(inputClass, beanSer, smr);
  +                                Class inputClass = null;
  +                                try {
  +                                    inputClass =
  +                                        Class.forName(
  +                                            packageName + "." + className,
  +                                            true,
  +                                            Thread
  +                                                .currentThread()
  +                                                .getContextClassLoader());
  +                                } catch (ClassNotFoundException exn5) {
  +                                    inputClass =
  +                                        Class.forName(
  +                                            packageName
  +                                                + "."
  +                                                + className
  +                                                + "Element",
  +                                            true,
  +                                            Thread
  +                                                .currentThread()
  +                                                .getContextClassLoader());
  +                                }
  +                                types[i] = inputClass;                                
                                         
  +                                if (inputEncodingStyle.equals("literal")) {
  +                                	smr.mapTypes("literal", qname, inputClass, partSer, partSer);
  +                                } else {
  +                                    smr.mapTypes(
  +                                        Constants.NS_URI_SOAP_ENC,
  +                                        qname,
  +                                        inputClass,
  +                                        beanSer,
  +                                        beanSer);
  +                                } 
  +                                mapSubtypes(inputClass, beanSer, partSer, smr);
                               } catch (ClassNotFoundException exn1) {
                               	Trc.ignoredException(exn1);
                               }
  @@ -429,21 +417,37 @@
                                   String className =
                                       WSIFUtils.getJavaClassNameFromXMLName(
                                           qname.getLocalPart());
  -                                returnType =
  -                                    Class.forName(
  -                                        packageName + "." + className,
  -                                        true,
  -                                        Thread
  -                                            .currentThread()
  -                                            .getContextClassLoader());
  -                                BeanSerializer beanSer = new BeanSerializer();
  -                                smr.mapTypes(
  -                                    Constants.NS_URI_SOAP_ENC,
  -                                    qname,
  -                                    returnType,
  -                                    beanSer,
  -                                    beanSer);
  -                                mapSubtypes(returnType, beanSer, smr);
  +                                try {
  +                                    returnType =
  +                                        Class.forName(
  +                                            packageName + "." + className,
  +                                            true,
  +                                            Thread
  +                                                .currentThread()
  +                                                .getContextClassLoader());
  +                                } catch (ClassNotFoundException exn5) {
  +                                    returnType =
  +                                        Class.forName(
  +                                            packageName
  +                                                + "."
  +                                                + className
  +                                                + "Element",
  +                                            true,
  +                                            Thread
  +                                                .currentThread()
  +                                                .getContextClassLoader());
  +                                }           
  +                                if (inputEncodingStyle.equals("literal")) {
  +                                	smr.mapTypes("literal", qname, returnType, partSer, partSer);
  +                                } else {
  +                                    smr.mapTypes(
  +                                        Constants.NS_URI_SOAP_ENC,
  +                                        qname,
  +                                        returnType,
  +                                        beanSer,
  +                                        beanSer);
  +                                }                                
  +                                mapSubtypes(returnType, beanSer, partSer, smr);       
                        
                               } catch (ClassNotFoundException exn1) {
                               	Trc.ignoredException(exn1);
                               }
  @@ -469,6 +473,7 @@
       private void mapSubtypes(
           Class javaType,
           BeanSerializer beanSer,
  +        PartSerializer partSer,
           SOAPMappingRegistry smr) {
           
           BeanInfo beanInfo = null;
  @@ -487,7 +492,7 @@
                           org.apache.soap.util.xml.QName qname =
                               smr.queryElementType(
                                   propType,
  -                                Constants.NS_URI_SOAP_ENC);
  +                                inputEncodingStyle);
                       } catch (IllegalArgumentException exn) {
                       	Trc.exception(exn);
                           // not found in the registry - complex type, not registered
  @@ -501,16 +506,26 @@
                                       fullClassName.lastIndexOf(".") + 1);
                               org.apache.soap.util.xml.QName qname =
                                   new org.apache.soap.util.xml.QName(
  -                                    WSIFUtils.getXSDNamespaceFromPackageName(packageName),
  +                                    WSIFUtils.getXSDNamespaceFromPackageName(
  +                                        packageName),
                                       className);
   
  -                            smr.mapTypes(
  -                                Constants.NS_URI_SOAP_ENC,
  -                                qname,
  -                                propType,
  -                                beanSer,
  -                                beanSer);
  -                            mapSubtypes(propType, beanSer, smr);
  +                            if (inputEncodingStyle.equals("literal")) {
  +                                smr.mapTypes(
  +                                    "literal",
  +                                    qname,
  +                                    propType,
  +                                    partSer,
  +                                    partSer);
  +                            } else {
  +                                smr.mapTypes(
  +                                    Constants.NS_URI_SOAP_ENC,
  +                                    qname,
  +                                    propType,
  +                                    beanSer,
  +                                    beanSer);
  +                            }
  +                            mapSubtypes(propType, beanSer, partSer, smr);
                           }
                       }
                   }
  
  
  

Mime
View raw message