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 de...@apache.org on 2006/01/30 08:06:15 UTC

svn commit: r373456 - in /webservices/axis2/trunk/java/modules: core/src/org/apache/axis2/deployment/ core/src/org/apache/axis2/description/ integration/test/org/apache/axis2/engine/ integration/test/org/apache/axis2/engine/util/ wsdl/src/org/apache/ax...

Author: deepal
Date: Sun Jan 29 23:05:43 2006
New Revision: 373456

URL: http://svn.apache.org/viewcvs?rev=373456&view=rev
Log:
-removed MyInOutMEPClient
- fix bug in AxisOperation for each operation it set MEP as inout

Removed:
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/util/MyInOutMEPClient.java
Modified:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentConstants.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ServiceBuilder.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/InOnlyAxisOperation.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutInAxisOperation.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutOnlyAxisOperation.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/RobustOutOnlyAxisOperation.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/FaultHandlingTest.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/SOAPversionTest.java
    webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/Java2WSDLBuilder.java

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentConstants.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentConstants.java?rev=373456&r1=373455&r2=373456&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentConstants.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentConstants.java Sun Jan 29 23:05:43 2006
@@ -75,8 +75,6 @@
     // for parameters
     String ATTRIBUTE_NAME = "name";
     String TARGET_NAME_SPACE = "targetNamespace";
-    String TARGET_NAME_SPACE_PREFIX = "namespacePrefix";
-    String SCHEMA_NAME_SPACE_PREFIX = "namespacePrefix";
     String SCHEMA_NAME_SPACE = "schemaNamespace";
     String SCHEMA = "schema";
 

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ServiceBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ServiceBuilder.java?rev=373456&r1=373455&r2=373456&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ServiceBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ServiceBuilder.java Sun Jan 29 23:05:43 2006
@@ -98,17 +98,6 @@
                     service.setTargetNamespace(nameSpeceVale);
                 }
             }
-
-            //Setting service tratget namespace prefix if any
-            OMAttribute targetNameSpaceprfix = service_element.
-                    getAttribute(new QName(TARGET_NAME_SPACE_PREFIX));
-            if (targetNameSpaceprfix != null) {
-                String prefix = targetNameSpace.getAttributeValue();
-                if (prefix != null && !"".equals(prefix)) {
-                    service.setTargetNamespacePrefix(prefix);
-                }
-            }
-
             //Setting schema namespece if any
             OMElement scheamElement = service_element.getFirstChildWithName(new QName(SCHEMA));
             if (scheamElement != null) {
@@ -118,15 +107,6 @@
                     String nameSpeceVale = schemaNameSpace.getAttributeValue();
                     if (nameSpeceVale != null && !"".equals(nameSpeceVale)) {
                         service.setSchematargetNamespace(nameSpeceVale);
-                    }
-                }
-
-                OMAttribute scheamNameSpaceprfix = service_element.
-                        getAttribute(new QName(SCHEMA_NAME_SPACE_PREFIX));
-                if (scheamNameSpaceprfix != null) {
-                    String prefix = scheamNameSpaceprfix.getAttributeValue();
-                    if (prefix != null && !"".equals(prefix)) {
-                        service.setSchematargetNamespacePrefix(prefix);
                     }
                 }
             }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/InOnlyAxisOperation.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/InOnlyAxisOperation.java?rev=373456&r1=373455&r2=373456&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/InOnlyAxisOperation.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/InOnlyAxisOperation.java Sun Jan 29 23:05:43 2006
@@ -25,11 +25,13 @@
     public InOnlyAxisOperation() {
         super();
         createMessage();
+        setMessageExchangePattern(WSDLConstants.MEP_URI_IN_ONLY);
     }
 
     public InOnlyAxisOperation(QName name) {
         super(name);
         createMessage();
+        setMessageExchangePattern(WSDLConstants.MEP_URI_IN_ONLY);
     }
 
     public void addMessage(AxisMessage message, String label) {

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutInAxisOperation.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutInAxisOperation.java?rev=373456&r1=373455&r2=373456&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutInAxisOperation.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutInAxisOperation.java Sun Jan 29 23:05:43 2006
@@ -35,10 +35,12 @@
 public class OutInAxisOperation extends InOutAxisOperation {
     public OutInAxisOperation() {
         super();
+        setMessageExchangePattern(WSDLConstants.MEP_URI_OUT_IN);
     }
 
     public OutInAxisOperation(QName name) {
         super(name);
+        setMessageExchangePattern(WSDLConstants.MEP_URI_OUT_IN);
     }
 
     public void addMessageContext(MessageContext msgContext,

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutOnlyAxisOperation.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutOnlyAxisOperation.java?rev=373456&r1=373455&r2=373456&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutOnlyAxisOperation.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutOnlyAxisOperation.java Sun Jan 29 23:05:43 2006
@@ -1,9 +1,6 @@
 package org.apache.axis2.description;
 
 import org.apache.axis2.AxisFault;
-import org.apache.axis2.om.OMElement;
-import org.apache.axis2.soap.SOAPEnvelope;
-import org.apache.axis2.soap.SOAPHeader;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.client.ListenerManager;
 import org.apache.axis2.client.OperationClient;
@@ -14,13 +11,16 @@
 import org.apache.axis2.context.OperationContext;
 import org.apache.axis2.context.ServiceContext;
 import org.apache.axis2.engine.AxisEngine;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.axis2.soap.SOAPHeader;
 import org.apache.axis2.util.UUIDGenerator;
 import org.apache.wsdl.WSDLConstants;
 
 import javax.xml.namespace.QName;
 import java.util.ArrayList;
-import java.util.Map;
 import java.util.Iterator;
+import java.util.Map;
 
 public class OutOnlyAxisOperation extends AxisOperation {
     private AxisMessage inFaultMessage;
@@ -35,11 +35,13 @@
     public OutOnlyAxisOperation() {
         super();
         createMessage();
+        setMessageExchangePattern(WSDLConstants.MEP_URI_OUT_ONLY);
     }
 
     public OutOnlyAxisOperation(QName name) {
         super(name);
         createMessage();
+        setMessageExchangePattern(WSDLConstants.MEP_URI_OUT_ONLY);
     }
 
     public void addMessage(AxisMessage message, String label) {

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/RobustOutOnlyAxisOperation.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/RobustOutOnlyAxisOperation.java?rev=373456&r1=373455&r2=373456&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/RobustOutOnlyAxisOperation.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/RobustOutOnlyAxisOperation.java Sun Jan 29 23:05:43 2006
@@ -1,13 +1,17 @@
 package org.apache.axis2.description;
 
+import org.apache.wsdl.WSDLConstants;
+
 import javax.xml.namespace.QName;
 
 public class RobustOutOnlyAxisOperation extends OutInAxisOperation {
     public RobustOutOnlyAxisOperation() {
         super();
+        setMessageExchangePattern(WSDLConstants.MEP_URI_ROBUST_OUT_ONLY);
     }
 
     public RobustOutOnlyAxisOperation(QName name) {
         super(name);
+        setMessageExchangePattern(WSDLConstants.MEP_URI_ROBUST_OUT_ONLY);
     }
 }

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/FaultHandlingTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/FaultHandlingTest.java?rev=373456&r1=373455&r2=373456&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/FaultHandlingTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/FaultHandlingTest.java Sun Jan 29 23:05:43 2006
@@ -19,16 +19,17 @@
 import junit.framework.TestCase;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
+import org.apache.axis2.client.OperationClient;
 import org.apache.axis2.client.Options;
-import org.apache.axis2.engine.util.MyInOutMEPClient;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.engine.util.TestConstants;
 import org.apache.axis2.integration.UtilServer;
 import org.apache.axis2.om.OMAbstractFactory;
-import org.apache.axis2.soap.SOAP11Constants;
-import org.apache.axis2.soap.SOAP12Constants;
-import org.apache.axis2.soap.SOAPEnvelope;
-import org.apache.axis2.soap.SOAPFactory;
-import org.apache.axis2.soap.SOAPFault;
+import org.apache.axis2.soap.*;
+import org.apache.wsdl.WSDLConstants;
 
 import javax.xml.stream.XMLStreamException;
 import java.io.File;
@@ -36,11 +37,9 @@
 public class FaultHandlingTest extends TestCase implements TestConstants {
 
     protected String testResourceDir = "test-resources";
-    private MyInOutMEPClient inOutMEPClient;
 
     protected void setUp() throws Exception {
         UtilServer.start();
-        inOutMEPClient = getMyInOutMEPClient();
     }
 
     public void testTwoHeadersSOAPMessage() throws AxisFault, XMLStreamException {
@@ -82,8 +81,21 @@
     }
 
     private SOAPEnvelope getResponse(SOAPEnvelope inEnvelope) throws AxisFault {
-        inOutMEPClient.getClientOptions().setExceptionToBeThrownOnSOAPFault(false);
-        return inOutMEPClient.invokeBlockingWithEnvelopeOut(operationName.getLocalPart(), inEnvelope);
+        ConfigurationContext confctx = ConfigurationContextFactory.
+                createConfigurationContextFromFileSystem("target/test-resources/integrationRepo", null);
+        ServiceClient client = new ServiceClient(confctx, null);
+        Options options = new Options();
+        client.setOptions(options);
+        options.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+        options.setTo(targetEPR);
+        options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
+        options.setExceptionToBeThrownOnSOAPFault(false);
+        MessageContext msgctx = new MessageContext();
+        msgctx.setEnvelope(inEnvelope);
+        OperationClient opClient = client.createClient(ServiceClient.ANON_OUT_IN_OP);
+        opClient.addMessageContext(msgctx);
+        opClient.execute(true);
+        return opClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE).getEnvelope();
     }
 
     private SOAPEnvelope getTwoHeadersSOAPEnvelope(SOAPFactory fac) {
@@ -94,23 +106,12 @@
         return soapEnvelope;
     }
 
-    private MyInOutMEPClient getMyInOutMEPClient() throws AxisFault {
-        MyInOutMEPClient inOutMEPClient = new MyInOutMEPClient("target/test-resources/integrationRepo");
-        Options options = new Options();
-        inOutMEPClient.setClientOptions(options);
-        options.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
-        options.setTo(targetEPR);
-        options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
-        return inOutMEPClient;
-    }
-
     public File getTestResourceFile(String relativePath) {
         return new File(testResourceDir, relativePath);
     }
 
     protected void tearDown() throws Exception {
         UtilServer.stop();
-        inOutMEPClient.close();
     }
 
 }

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/SOAPversionTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/SOAPversionTest.java?rev=373456&r1=373455&r2=373456&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/SOAPversionTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/SOAPversionTest.java Sun Jan 29 23:05:43 2006
@@ -19,9 +19,13 @@
 import junit.framework.TestCase;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
+import org.apache.axis2.client.OperationClient;
 import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.description.AxisService;
-import org.apache.axis2.engine.util.MyInOutMEPClient;
 import org.apache.axis2.engine.util.TestConstants;
 import org.apache.axis2.integration.UtilServer;
 import org.apache.axis2.om.OMAbstractFactory;
@@ -31,7 +35,9 @@
 import org.apache.axis2.soap.SOAP11Constants;
 import org.apache.axis2.soap.SOAP12Constants;
 import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.axis2.soap.SOAPFactory;
 import org.apache.axis2.util.Utils;
+import org.apache.wsdl.WSDLConstants;
 
 import javax.xml.namespace.QName;
 
@@ -61,59 +67,90 @@
 
     public void testSOAP11() throws AxisFault {
         OMElement payload = createEnvelope();
-        MyInOutMEPClient inOutMEPClient = new MyInOutMEPClient("target/test-resources/integrationRepo");
+        ConfigurationContext configCtx = ConfigurationContextFactory.
+                createConfigurationContextFromFileSystem("target/test-resources/integrationRepo", null);
+        ServiceClient client = new ServiceClient(configCtx, null);
+
+
         Options options = new Options();
-        inOutMEPClient.setClientOptions(options);
+        client.setOptions(options);
         options.setSoapVersionURI(
                 SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
         options.setTo(targetEPR);
         options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
 
-        SOAPEnvelope result =
-                inOutMEPClient.invokeBlockingWithEnvelopeOut(
-                        operationName.getLocalPart(), payload);
+        OperationClient opClinet = client.createClient(ServiceClient.ANON_OUT_IN_OP);
+        opClinet.addMessageContext(prepareTheSOAPEnvelope(payload, options));
+        opClinet.execute(true);
+
+        SOAPEnvelope result = opClinet.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE).getEnvelope();
         assertEquals("SOAP Version received is not compatible",
                 SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI,
                 result.getNamespace().getName());
-        inOutMEPClient.close();
     }
 
     public void testSOAP12() throws AxisFault {
         OMElement payload = createEnvelope();
-        MyInOutMEPClient inOutMEPClient = new MyInOutMEPClient("target/test-resources/integrationRepo");
+        ConfigurationContext configCtx = ConfigurationContextFactory.
+                createConfigurationContextFromFileSystem("target/test-resources/integrationRepo", null);
+        ServiceClient client = new ServiceClient(configCtx, null);
         Options options = new Options();
-        inOutMEPClient.setClientOptions(options);
         options.setSoapVersionURI(
                 SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
         options.setTo(targetEPR);
         options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
+        client.setOptions(options);
+
+        OperationClient opClinet = client.createClient(ServiceClient.ANON_OUT_IN_OP);
+        opClinet.addMessageContext(prepareTheSOAPEnvelope(payload, options));
+        opClinet.execute(true);
 
-        SOAPEnvelope result =
-                inOutMEPClient.invokeBlockingWithEnvelopeOut(
-                        operationName.getLocalPart(), payload);
+        SOAPEnvelope result = opClinet.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE).getEnvelope();
         assertEquals("SOAP Version received is not compatible",
                 SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI,
                 result.getNamespace().getName());
+    }
 
+    private MessageContext prepareTheSOAPEnvelope(OMElement toSend, Options options) throws AxisFault {
+        MessageContext msgctx = new MessageContext();
+        SOAPFactory sf = getSOAPFactory(options);
+        SOAPEnvelope se = sf.getDefaultEnvelope();
+        if (toSend != null) {
+            se.getBody().addChild(toSend);
+        }
+        msgctx.setEnvelope(se);
+        return msgctx;
+    }
 
-        inOutMEPClient.close();
+    private SOAPFactory getSOAPFactory(Options options) {
+        String soapVersionURI = options.getSoapVersionURI();
+        if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(soapVersionURI)) {
+            return OMAbstractFactory.getSOAP12Factory();
+        } else {
+            // if its not SOAP 1.2 just assume SOAP 1.1
+            return OMAbstractFactory.getSOAP11Factory();
+        }
     }
 
     public void testSOAPfault() throws AxisFault {
         OMElement payload = createEnvelope();
-        MyInOutMEPClient inOutMEPClient = new MyInOutMEPClient("target/test-resources/integrationRepo");
+        ConfigurationContext configCtx = ConfigurationContextFactory.
+                createConfigurationContextFromFileSystem("target/test-resources/integrationRepo", null);
+        ServiceClient client = new ServiceClient(configCtx, null);
         Options options = new Options();
-        inOutMEPClient.setClientOptions(options);
+        client.setOptions(options);
         options.setSoapVersionURI(
                 SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
 
         options.setTo(targetEPR);
         options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
-        inOutMEPClient.invokeBlockingWithEnvelopeOut(
-                operationName.getLocalPart(), payload);
+        OperationClient opClinet = client.createClient(ServiceClient.ANON_OUT_IN_OP);
+        opClinet.addMessageContext(prepareTheSOAPEnvelope(payload, options));
+        opClinet.execute(true);
+
+        opClinet.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE).getEnvelope();
 //        assertEquals("SOAP Version received is not compatible", SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI, result.getNamespace().getName());
 
-        inOutMEPClient.close();
     }
 
     private OMElement createEnvelope() {

Modified: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/Java2WSDLBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/Java2WSDLBuilder.java?rev=373456&r1=373455&r2=373456&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/Java2WSDLBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/Java2WSDLBuilder.java Sun Jan 29 23:05:43 2006
@@ -110,7 +110,8 @@
      * @throws Exception
      */
     public void generateWSDL() throws Exception {
-        SchemaGenerator sg = new SchemaGenerator(classLoader, className, schemaTargetNamespace, schemaTargetNamespacePrefix);
+        SchemaGenerator sg = new SchemaGenerator(classLoader, className,
+                schemaTargetNamespace, schemaTargetNamespacePrefix);
         XmlSchema schema = sg.generateSchema();
         WSDLDescription wommodel = new Java2WOMBuilder(
                 sg.getTypeTable(),