You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-commits@ws.apache.org by da...@apache.org on 2007/03/09 00:46:46 UTC

svn commit: r516230 - /webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/proxy/ReflectionProxyHandler.java

Author: danj
Date: Thu Mar  8 15:46:45 2007
New Revision: 516230

URL: http://svn.apache.org/viewvc?view=rev&rev=516230
Log:
Finally removing an old hack that does not appear to be necessary any longer. The way the proxy handler works, 
neither complex type objects nor arrays need to have their root element wrapper removed - the response message 
name is used in the case of message handlers that create SOAP responses, but it doesn't happen when the *Client 
classes send a message.

Still need to retest all of the samples with tonight's build before declaring this check-in 'permanent'.

Modified:
    webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/proxy/ReflectionProxyHandler.java

Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/proxy/ReflectionProxyHandler.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/proxy/ReflectionProxyHandler.java?view=diff&rev=516230&r1=516229&r2=516230
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/proxy/ReflectionProxyHandler.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/proxy/ReflectionProxyHandler.java Thu Mar  8 15:46:45 2007
@@ -80,31 +80,6 @@
         return deser.fromXML(xml);
     }
     
-    /**
-     * 
-     * HACK: This method simply removes the layer in between the parent of 
-     * the given Element and its children. More generally, it deletes a node 
-     * in an n-ary tree. It is used to get around the fact that the same 
-     * serializers are used for both request processing and request creation, 
-     * and the two have different requirements for the way XML fragments are 
-     * wrapped. See the implementation of serialize(Object, QName) for more 
-     * details on this problem.
-     *
-     */
-    private void fixComplexType(Element levelToRemove)
-    {
-        Element parent = (Element)levelToRemove.getParentNode();
-        parent.removeChild(levelToRemove);
-        
-        Element[] subchildren = XmlUtils.getAllElements(levelToRemove);
-        
-        for (int n = 0; n < subchildren.length; ++n)
-        {
-            levelToRemove.removeChild(subchildren[n]);
-            parent.appendChild(subchildren[n]);
-        }
-    }
-    
     public Object fromXML(Element xml) 
         throws SoapFault
     {
@@ -171,52 +146,7 @@
         
         SerializerRegistry registry = SerializerRegistry.getInstance();
         Serializer ser = registry.getSerializer(theClass);
-        Element xml = ser.toXML(obj, qname);
-        
-        //
-        // HACK: Workaround to reuse serializers intended for MessageHandlers
-        //
-        //       Instances of the Serializer interface are written so that 
-        //       objects are serialized to XML and then wrapped in another 
-        //       parent element; this wrapper element has the QName provided 
-        //       in the call to Serializer.toXML(Object, QName). This works 
-        //       great for serializing return values for web service methods, 
-        //       but not so great for serializing parameters for proxy calls.
-        //
-        //       If we get a complex type back from the Serializer, we want 
-        //       to move one level of XML so that the Element is a valid 
-        //       instance of the parameter XML, not a valid instance in a 
-        //       wrapper. For example,
-        //
-        //       <my:ManagerReferenceType>
-        //          <wsa:EndpointReference>
-        //             <wsa:Address>http://www.example.com</wsa:Address>
-        //          </wsa:EndpointReference>
-        //       </my:ManagerReferenceType>
-        //
-        //       should become:
-        //
-        //       <my:ManagerReferenceType>
-        //          <wsa:Address>http://www.example.com</wsa:Address>
-        //       </my:ManagerReferenceType>
-        //
-        //       because my:ManagerReferenceType is a sub-type of WS-A EPR. 
-        //       This gives us the proper XML that can be bundled in a web 
-        //       service request with other parameters.
-        //
-        //       See ProxyHandler for more info about the differences in 
-        //       serialization for message handling and message sending.
-        //
-        Element child = XmlUtils.getFirstElement(xml);
-        
-        //
-        // make sure we do NOT do this for arrays - in that case, we 
-        // WANT the wrapper element (to act as an array enclosure)
-        //
-        if (child != null && !theClass.isArray())
-            fixComplexType(child);
-        
-        return xml;
+        return ser.toXML(obj, qname);
     }
     
     public Element toXML(Object[] parameters)



---------------------------------------------------------------------
To unsubscribe, e-mail: muse-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-commits-help@ws.apache.org