You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ga...@apache.org on 2008/04/17 19:37:47 UTC

svn commit: r649197 - in /webservices/axis2/trunk/java/modules: jaxws-integration/ jaxws-integration/test-resources/ jaxws-integration/test/org/apache/axis2/jaxws/provider/ jaxws-integration/test/org/apache/axis2/jaxws/provider/addressing/ jaxws-integr...

Author: gawor
Date: Thu Apr 17 10:37:44 2008
New Revision: 649197

URL: http://svn.apache.org/viewvc?rev=649197&view=rev
Log:
try to find the real operation on the context when annonymous operation is used so that right wsa action (and other properties) are used (AXIS2-3742)

Added:
    webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/AddressingProviderTests.java   (with props)
    webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/addressing/
    webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/addressing/AddressingProvider.java   (with props)
    webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/addressing/META-INF/
    webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/addressing/META-INF/AddressingProvider.wsdl   (with props)
    webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/addressing/META-INF/MANIFEST.MF
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/DispatchOperationHandler.java   (with props)
Modified:
    webservices/axis2/trunk/java/modules/jaxws-integration/pom.xml
    webservices/axis2/trunk/java/modules/jaxws-integration/test-resources/axis2.xml

Modified: webservices/axis2/trunk/java/modules/jaxws-integration/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/pom.xml?rev=649197&r1=649196&r2=649197&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/pom.xml (original)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/pom.xml Thu Apr 17 10:37:44 2008
@@ -749,6 +749,20 @@
                                         />
                                 <delete dir="target/test-classes/servicejars/RPCLitSWA"/>
 
+                                <copy toDir="target/test-classes/servicejars/AddressingProvider/">
+                                    <fileset dir="target/test-classes">
+                                        <include name="org/apache/axis2/jaxws/provider/addressing/**"/>
+                                    </fileset>
+                                    <fileset dir="test/org/apache/axis2/jaxws/provider/addressing/">
+                                        <include name="META-INF/**"/>
+                                    </fileset>
+                                </copy>
+
+                                <zip destfile="target/test-classes/servicejars/AddressingProvider.jar"
+                                     basedir="${pom.basedir}/target/test-classes/servicejars/AddressingProvider"
+                                        />
+                                <delete dir="target/test-classes/servicejars/AddressingProvider"/>
+
                                 <copy toDir="target/test-classes/servicejars/SOAP12EchoService/">
                                     <fileset dir="target/test-classes">
                                         <include name="org/apache/axis2/jaxws/proxy/soap12/**"/>
@@ -1329,6 +1343,7 @@
                         <include>**/ParallelAsyncTests.java</include>
                         <include>**/SWAMTOMTests.java</include>
                         <include>**/RuntimeExceptionsAsyncMepTest.java</include>
+                        <include>**/AddressingProviderTests.java</include>
                     </includes>
                     <systemProperties>
                         <property>

Modified: webservices/axis2/trunk/java/modules/jaxws-integration/test-resources/axis2.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test-resources/axis2.xml?rev=649197&r1=649196&r2=649197&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test-resources/axis2.xml (original)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test-resources/axis2.xml Thu Apr 17 10:37:44 2008
@@ -181,6 +181,12 @@
                 <order phase="Transport"/>
             </handler>
         </phase>
+        <phase name="Addressing">
+             <handler name="AddressingBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
+                 <order phase="Addressing"/>
+            </handler>
+        </phase>
         <phase name="Security"/>
         <phase name="PreDispatch"/>
         <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
@@ -239,7 +245,12 @@
     </phaseOrder>
     <phaseOrder type="OutFlow">
         <!--      user can add his own phases to this area  -->
-        <phase name="OperationOutPhase"/>
+        <phase name="OperationOutPhase">
+            <handler name="DispatchOperationHandler"
+                     class="org.apache.axis2.jaxws.client.dispatch.DispatchOperationHandler">
+                <order phase="OperationOutPhase"/>
+            </handler>
+        </phase>
         <!--system predefined phase-->
         <!--these phase will run irrespective of the service-->
         <phase name="RMPhase"/>
@@ -248,6 +259,12 @@
         <phase name="Security"/>
     </phaseOrder>
     <phaseOrder type="InFaultFlow">
+        <phase name="Addressing">
+             <handler name="AddressingBasedDispatcher"
+                     class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
+                 <order phase="Addressing"/>
+            </handler>
+        </phase>
         <phase name="PreDispatch"/>
         <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
             <handler name="RequestURIBasedDispatcher"

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/AddressingProviderTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/AddressingProviderTests.java?rev=649197&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/AddressingProviderTests.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/AddressingProviderTests.java Thu Apr 17 10:37:44 2008
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.axis2.jaxws.provider;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.net.URL;
+import java.text.MessageFormat;
+import java.util.UUID;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.Node;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Dispatch;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebServiceFeature;
+import javax.xml.ws.soap.AddressingFeature;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.axis2.jaxws.framework.AbstractTestCase;
+
+public class AddressingProviderTests extends AbstractTestCase {
+
+    private String endpointUrl = "http://localhost:6060/axis2/services/AddressingProviderService.AddressingProviderPort";    
+    private QName serviceName = new QName("http://addressing.provider.jaxws.axis2.apache.org", "AddressingProviderService");
+    private QName portName = new QName("http://addressing.provider.jaxws.axis2.apache.org", "AddressingProviderPort");
+        
+    static final String START_SOAP = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+                        "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">";
+      
+    static final String END_SOAP = "</soap:Body></soap:Envelope>";
+    
+    static final String XML_MESSAGE = "<ns2:inMessage xmlns:ns2=\"http://addressing.provider.jaxws.axis2.apache.org\">Hello</ns2:inMessage>";
+        
+    static final String SOAP_MESSAGE_1 = START_SOAP +
+                      "<soap:Body>" +
+                      XML_MESSAGE +
+                      END_SOAP;
+    
+    static final String SOAP_MESSAGE_2 = START_SOAP +  
+                      "<soap:Header xmlns:wsa=\"http://www.w3.org/2005/08/addressing\"><wsa:To>{0}</wsa:To><wsa:MessageID>{1}</wsa:MessageID><wsa:Action>{2}</wsa:Action></soap:Header>" +
+                      "<soap:Body>" +
+                      XML_MESSAGE +
+                      END_SOAP;
+                      
+    static final String ACTION = "http://addressing.provider.jaxws.axis2.apache.org/AddressingProviderInterface/In";
+    
+    public static Test suite() {
+        return getTestSetup(new TestSuite(AddressingProviderTests.class), null,
+                "test-resources/axis2_addressing.xml");
+    }
+   
+    /**
+     * Inject correct wsa header (wsa:Action must be set the the action of hello operation)
+     */
+    public void testInjectAddressingHeaders() throws Exception {
+          
+        Dispatch<SOAPMessage> dispatch = createDispatch();
+             
+        String msg = SOAP_MESSAGE_1;
+        MessageFactory factory = MessageFactory.newInstance();
+        SOAPMessage request = factory.createMessage(null, new ByteArrayInputStream(msg.getBytes()));
+                        
+        SOAPMessage response = dispatch.invoke(request);
+                     
+        assertResponseXML(response, "Hello Response");
+        
+        System.out.println(response.toString());       
+    }
+    
+    /**
+     * Message already contains wsa headers. Make sure there is no mismatch between 
+     * SOAPAction and wsa:Action. 
+     */
+    public void testWithAddressingHeaders() throws Exception {
+
+        Dispatch<SOAPMessage> dispatch = createDispatch();
+             
+        String msg = MessageFormat.format(SOAP_MESSAGE_2, 
+                                          endpointUrl,
+                                          "urn:" + UUID.randomUUID(),
+                                          ACTION);
+        
+        System.out.println(msg);
+        
+        MessageFactory factory = MessageFactory.newInstance();
+        SOAPMessage request = factory.createMessage(null, new ByteArrayInputStream(msg.getBytes()));
+                        
+        SOAPMessage response = dispatch.invoke(request);
+                     
+        assertResponseXML(response, "Hello Response");
+        
+        System.out.println(response.toString());       
+    }
+    
+    private SOAPElement assertResponseXML(SOAPMessage msg, String expectedText) throws Exception {
+        assertTrue(msg != null);
+        SOAPBody body = msg.getSOAPBody();
+        assertTrue(body != null);
+        
+        Node invokeElement = (Node) body.getFirstChild();
+        assertTrue(invokeElement instanceof SOAPElement);
+        assertEquals("outMessage", invokeElement.getLocalName());
+                
+        String text = invokeElement.getValue();
+        
+        System.out.println("Received: " + text);
+        assertEquals("Found ("+ text + ") but expected (" + expectedText + ")", expectedText, text);
+        
+        return (SOAPElement) invokeElement;
+    }
+    
+    private Dispatch<SOAPMessage> createDispatch() throws Exception {
+        URL wsdlURL = getWsdl();
+        assertNotNull(wsdlURL);
+        Service svc = Service.create(wsdlURL, serviceName);
+        
+        WebServiceFeature[] wsf = {new AddressingFeature(true)};
+        
+        Dispatch<SOAPMessage> dispatch =
+            svc.createDispatch(portName, SOAPMessage.class, Service.Mode.MESSAGE, wsf);
+        
+        BindingProvider p = (BindingProvider) dispatch;
+        p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointUrl);
+
+        return dispatch;
+    }
+    
+    private URL getWsdl() throws Exception {
+        String wsdlLocation = "/test/org/apache/axis2/jaxws/provider/addressing/META-INF/AddressingProvider.wsdl";
+        String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
+        wsdlLocation = new File(baseDir + wsdlLocation).getAbsolutePath();    
+        File file = new File(wsdlLocation);
+        return file.toURL();
+    }
+    
+}

Propchange: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/AddressingProviderTests.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/addressing/AddressingProvider.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/addressing/AddressingProvider.java?rev=649197&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/addressing/AddressingProvider.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/addressing/AddressingProvider.java Thu Apr 17 10:37:44 2008
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.axis2.jaxws.provider.addressing;
+
+import java.io.ByteArrayInputStream;
+
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.BindingType;
+import javax.xml.ws.Provider;
+import javax.xml.ws.Service;
+import javax.xml.ws.ServiceMode;
+import javax.xml.ws.WebServiceProvider;
+import javax.xml.ws.soap.Addressing;
+import javax.xml.ws.soap.SOAPBinding;
+import javax.xml.ws.soap.SOAPFaultException;
+
+@WebServiceProvider(serviceName="AddressingProviderService",
+		    targetNamespace="http://addressing.provider.jaxws.axis2.apache.org",
+		    wsdlLocation="META-INF/AddressingProvider.wsdl",
+		    portName="AddressingProviderPort")
+@BindingType(SOAPBinding.SOAP11HTTP_BINDING)
+@Addressing(enabled=true)
+@ServiceMode(value=Service.Mode.MESSAGE)
+public class AddressingProvider implements Provider<SOAPMessage> {
+      
+    String responseMsgStart = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"><soapenv:Header/><soapenv:Body>";
+    String responseMsgEnd = "</soapenv:Body></soapenv:Envelope>";   
+    String XML_RETURN = "<ns2:outMessage xmlns:ns2=\"http://addressing.provider.jaxws.axis2.apache.org\">Hello Response</ns2:outMessage>";
+     
+    public SOAPMessage invoke(SOAPMessage soapMessage) throws SOAPFaultException {
+    	try {
+            MessageFactory factory = MessageFactory.newInstance();
+            String responseXML = responseMsgStart + XML_RETURN + responseMsgEnd;
+            SOAPMessage response = factory.createMessage(null, new ByteArrayInputStream(responseXML.getBytes()));
+
+            return response;
+        } catch(Exception e){
+            e.printStackTrace();
+    	}
+    	return null;
+    }   
+}

Propchange: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/addressing/AddressingProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/addressing/META-INF/AddressingProvider.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/addressing/META-INF/AddressingProvider.wsdl?rev=649197&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/addressing/META-INF/AddressingProvider.wsdl (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/addressing/META-INF/AddressingProvider.wsdl Thu Apr 17 10:37:44 2008
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements. See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership. The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License. You may obtain a copy of the License at
+  ~
+  ~ http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied. See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<!--
+-->
+
+<definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" 
+    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
+    xmlns:s="http://www.w3.org/2001/XMLSchema" 
+    xmlns:tns="http://addressing.provider.jaxws.axis2.apache.org"
+    targetNamespace="http://addressing.provider.jaxws.axis2.apache.org"
+    xmlns="http://schemas.xmlsoap.org/wsdl/">
+  <types>
+     	<xsd:schema
+			targetNamespace="http://addressing.provider.jaxws.axis2.apache.org"
+			xmlns:tns="http://addressing.provider.jaxws.axis2.apache.org"
+			xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+			<xsd:element name="inMessage" type="xsd:string" />
+			<xsd:element name="outMessage" type="xsd:string" />
+	</xsd:schema>
+    
+
+  </types>
+   
+  <message name="inMessage">
+    <part name="parameters" element="tns:inMessage" />
+  </message>
+  <message name="outMessage">
+    <part name="parameters" element="tns:outMessage" />
+  </message>
+
+  <portType name="AddressingProviderInterface">
+    <operation name="hello">
+      <input message="tns:inMessage" name="In" />
+      <output message="tns:outMessage" name="Out" />
+    </operation>  
+  </portType>
+
+  <binding name="AddressingProviderBinding" type="tns:AddressingProviderInterface">
+    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
+    <operation name="hello">
+      <soap:operation soapAction="" style="document" />
+      <input>
+        <soap:body use="literal" />
+      </input>
+      <output>
+        <soap:body use="literal" />
+      </output>
+    </operation>
+  </binding>
+
+  <service name="AddressingProviderService">
+    <port name="AddressingProviderPort" binding="tns:AddressingProviderBinding">
+      <soap:address location="http://localhost:6060/axis2/services/AddressingProviderService" />
+    </port>
+  </service>
+
+</definitions>

Propchange: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/addressing/META-INF/AddressingProvider.wsdl
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/addressing/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/addressing/META-INF/MANIFEST.MF?rev=649197&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/addressing/META-INF/MANIFEST.MF (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/addressing/META-INF/MANIFEST.MF Thu Apr 17 10:37:44 2008
@@ -0,0 +1 @@
+Manifest-Version: 1.0
\ No newline at end of file

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/DispatchOperationHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/DispatchOperationHandler.java?rev=649197&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/DispatchOperationHandler.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/DispatchOperationHandler.java Thu Apr 17 10:37:44 2008
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.axis2.jaxws.client.dispatch;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.soap.SOAPBody;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.AxisService;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/*
+ * In JAX-WS Dispatch clients we don't know what actual operation we are calling
+ * until the message is converted to a SOAP envelope. So let's try to find the real
+ * operation based on the first element in the body in order to send the right WSA
+ * action.
+ * 
+ * This handler should be installed in OutFlow chain.
+ */
+public class DispatchOperationHandler extends org.apache.axis2.handlers.AbstractHandler {
+    
+    private static final Log LOG = LogFactory.getLog(DispatchOperationHandler.class);
+
+    private boolean isAnonymousOperation(AxisOperation op) {
+        return (ServiceClient.ANON_OUT_IN_OP.equals(op.getName()) ||
+                ServiceClient.ANON_OUT_ONLY_OP.equals(op.getName()));
+    }
+    
+    private QName getFirstBodyElement(SOAPEnvelope envelope) {
+        SOAPBody body = envelope.getBody();
+        if (body != null) {
+            OMElement firstElement = body.getFirstElement();
+            if (firstElement != null) {
+                return firstElement.getQName();
+            }
+        }
+        return null;
+    }
+    
+    private AxisOperation findRealOperationAction(MessageContext msgContext) {
+        AxisOperation axisOperation = null;
+        QName firstBodyElement = getFirstBodyElement(msgContext.getEnvelope());
+        if (firstBodyElement != null) {
+            AxisService service = msgContext.getAxisService();
+            axisOperation = service.getOperationByMessageElementQName(firstBodyElement);
+        }
+        return axisOperation;            
+    }
+    
+    public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {
+        AxisOperation op = msgContext.getAxisOperation();       
+        if (!msgContext.isServerSide() && op != null && isAnonymousOperation(op)) {
+            op = findRealOperationAction(msgContext);         
+            if (op != null) {
+                msgContext.setAxisOperation(op);
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("Anonymous operation detected. Replaced with real operation: " + op);
+                }
+            }
+        }                
+        return InvocationResponse.CONTINUE;
+    }
+}

Propchange: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/DispatchOperationHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native



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