axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chinth...@apache.org
Subject svn commit: r332432 - in /webservices/axis2/trunk/java/modules: core/src/org/apache/axis2/clientapi/InOutMEPClient.java core/src/org/apache/axis2/clientapi/MEPClient.java integration/test/org/apache/axis2/engine/util/TestConstants.java
Date Fri, 11 Nov 2005 03:16:14 GMT
Author: chinthaka
Date: Thu Nov 10 19:15:59 2005
New Revision: 332432

URL: http://svn.apache.org/viewcvs?rev=332432&view=rev
Log:
- Fixing a bug in setting a message id to the message context. (thx Chamikara for pointing
out)
- Adding a convenience method for user to add an OMElement to the SOAP header.
- Adding a class to remove the duplication of various constants among test classes in the
integration package. Yet to fill it.

Added:
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/util/TestConstants.java
Modified:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/InOutMEPClient.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/MEPClient.java

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/InOutMEPClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/InOutMEPClient.java?rev=332432&r1=332431&r2=332432&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/InOutMEPClient.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/InOutMEPClient.java
Thu Nov 10 19:15:59 2005
@@ -123,7 +123,7 @@
 
         // The message ID is sent all the time
         String messageID = String.valueOf("uuid:" + UUIDGenerator.getUUID());
-        msgctx.setMessageID(messageID);
+        this.messageInformationHeaders.setMessageId(messageID);
         //
         if (useSeparateListener) {
             //This mean doing a Request-Response invocation using two channel. If the
@@ -161,16 +161,11 @@
             }
         } else {
             //This is the Usual Request-Response Sync implemetation
-//            msgctx.setTo(to);
             msgctx.setServiceContext(serviceContext);
             ConfigurationContext syscontext = serviceContext.getConfigurationContext();
             msgctx.setConfigurationContext(syscontext);
 
             checkTransport(msgctx);
-            //find and set the Operation Context
-//            OperationContext operationContext = OperationContextFactory.createOperationContext(WSDLConstants.MEP_CONSTANT_IN_OUT,
-//                    axisop,
-//                    serviceContext);
 
             OperationContext operationContext = new OperationContext(axisop, serviceContext);
             axisop.registerOperationContext(msgctx, operationContext);
@@ -221,7 +216,7 @@
             checkTransport(msgctx);
             //Use message id all the time!
             String messageID = String.valueOf("uuid:" + UUIDGenerator.getUUID());
-            msgctx.setMessageID(messageID);
+            this.messageInformationHeaders.setMessageId(messageID);
             ////
             if (useSeparateListener) {
                 //the invocation happen via a seperate Channel, so we should set up the
@@ -252,17 +247,6 @@
 
                 //send the message
                 engine.send(msgctx);
-/*				 serviceContext.getConfigurationContext().getThreadPool()
-						.execute(new Runnable() {
-							public void run() {
-								try {
-									engine.send(msgctx);
-								} catch (AxisFault e) {
-									// TODO Auto-generated catch block
-									e.printStackTrace();
-								}
-							}
-						});*/
             } else {
                 // here a bloking invocation happens in a new thread, so the
                 // progamming model is non blocking
@@ -276,13 +260,6 @@
         }
 
     }
-
-//    /**
-//     * @param to
-//     */
-//    public void setTo(EndpointReference to) {
-//        this.to = to;
-//    }
 
     /**
      * Set transport information to the the Call, for find how the each parameter acts see
the commant at the instance

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/MEPClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/MEPClient.java?rev=332432&r1=332431&r2=332432&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/MEPClient.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/MEPClient.java
Thu Nov 10 19:15:59 2005
@@ -92,8 +92,8 @@
         if (serviceContext.getAxisService().getOperation(axisop.getName()) == null) {
             serviceContext.getAxisService().addOperation(axisop);
         }
-        if(msgCtx.getMessageInformationHeaders() != null && msgCtx.getMessageInformationHeaders().getAction()
!= null) {
-            messageInformationHeaders.setAction(msgCtx.getMessageInformationHeaders().getAction());
   
+        if (msgCtx.getMessageInformationHeaders() != null && msgCtx.getMessageInformationHeaders().getAction()
!= null) {
+            messageInformationHeaders.setAction(msgCtx.getMessageInformationHeaders().getAction());
         }
         msgCtx.setMessageInformationHeaders(messageInformationHeaders);
         msgCtx.setSoapAction(soapAction);
@@ -177,15 +177,13 @@
      * @throws AxisFault
      */
     public SOAPEnvelope createDefaultSOAPEnvelope() throws AxisFault {
-        SOAPFactory fac = null;
         if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(soapVersionURI)) {
-            fac = OMAbstractFactory.getSOAP12Factory();
+            return OMAbstractFactory.getSOAP12Factory().getDefaultEnvelope();
         } else if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(soapVersionURI)) {
-            fac = OMAbstractFactory.getSOAP11Factory();
+            return OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope();
         } else {
             throw new AxisFault(Messages.getMessage("invaidSOAPversion"));
         }
-        return fac.getDefaultEnvelope();
     }
 
     /**
@@ -233,6 +231,17 @@
         isExceptionToBeThrownOnSOAPFault = exceptionToBeThrownOnSOAPFault;
     }
 
+    /**
+     * User might sometimes needs to add his own headers to the out going message from the
client. This
+     * method will facilitate that. But this is bit restrictive in the sense that user can
only set a
+     * header with only one text as a child. <HeaderBlockName>your text</HeaderBlockName>.
If you want
+     * a much flexible way to add a soap header block use addSOAPHeader(OMElement)
+     *
+     * @param soapHeaderQName - During the creation of an OMElement from the given QName,
we extract
+     *                        the namespace information from the given QName and find whether
there is an
+     *                        already defined namespace. And if found that will be conneted
with this.
+     * @param soapHeaderText
+     */
     public void addSOAPHeader(QName soapHeaderQName, String soapHeaderText) {
         OMElement omElement = OMAbstractFactory.getOMFactory().createOMElement(soapHeaderQName,
null);
         omElement.setText(soapHeaderText);
@@ -240,6 +249,22 @@
             soapHeaderList = new ArrayList();
         }
         soapHeaderList.add(omElement);
+    }
+
+    /**
+     * This is much flexible than the other method and allows user to put anything in to
the SOAP header
+     * block.
+     * @param soapHeaderBlock
+     */
+    public void addSOAPHeader(OMElement soapHeaderBlock) {
+        if (soapHeaderBlock == null) {
+            // what are you trying to do here. You wanna set null to a header ??
+            return;
+        }
+        if (soapHeaderList == null) {
+            soapHeaderList = new ArrayList();
+        }
+        soapHeaderList.add(soapHeaderBlock);
     }
 
     //==============================================================================

Added: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/util/TestConstants.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/util/TestConstants.java?rev=332432&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/util/TestConstants.java
(added)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/util/TestConstants.java
Thu Nov 10 19:15:59 2005
@@ -0,0 +1,25 @@
+package org.apache.axis2.engine.util;
+
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ *
+ * @author : Eran Chinthaka (chinthaka@apache.org)
+ */
+
+/**
+ * This will contain the information shared across the integration test cases.
+ */
+public interface TestConstants {
+}



Mime
View raw message