axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dee...@apache.org
Subject svn commit: r370994 - in /webservices/axis2/trunk/java/modules: codegen/src/org/apache/axis2/rpc/receivers/ core/src/org/apache/axis2/client/ core/src/org/apache/axis2/context/ core/src/org/apache/axis2/description/ core/src/org/apache/axis2/util/ inte...
Date Sat, 21 Jan 2006 08:31:03 GMT
Author: deepal
Date: Sat Jan 21 00:30:27 2006
New Revision: 370994

URL: http://svn.apache.org/viewcvs?rev=370994&view=rev
Log:
- added a new MessageReceiver to handle inonly case when using java reflection based message
processing
- Improved ServiceClient to manage session and from that user can get the targetEPR and also
user can set target ERP
- So that if someone wants to manage session across multiple service clients he can so that,
in that case all the referencer parameters in the rpr will be copied to request message if
user asked to manage session. 

Added:
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/rpc/receivers/RPCInOnlyMessageReceiver.java
Modified:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/ServiceClient.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ServiceContext.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/util/Utils.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/ServiceGroupContextTest.java
    webservices/axis2/trunk/java/modules/webapp/listServices.jsp
    webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/java2wsdl/SchemaGenerator.java

Added: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/rpc/receivers/RPCInOnlyMessageReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/rpc/receivers/RPCInOnlyMessageReceiver.java?rev=370994&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/rpc/receivers/RPCInOnlyMessageReceiver.java
(added)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/rpc/receivers/RPCInOnlyMessageReceiver.java
Sat Jan 21 00:30:27 2006
@@ -0,0 +1,71 @@
+package org.apache.axis2.rpc.receivers;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.databinding.utils.BeanUtil;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.engine.DependencyManager;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.receivers.AbstractInMessageReceiver;
+
+import java.lang.reflect.Method;
+/*
+* Copyright 2004,2005 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 : Deepal Jayasinghe (deepal@apache.org)
+*
+*/
+
+public class RPCInOnlyMessageReceiver extends AbstractInMessageReceiver {
+
+    private Method method;
+
+    public void invokeBusinessLogic(MessageContext inMessage) throws AxisFault {
+        try {
+            // get the implementation class for the Web Service
+            //todo namespace   , checking
+            Object obj = getTheImplementationObject(inMessage);
+
+            Class ImplClass = obj.getClass();
+            DependencyManager.configureBusinessLogicProvider(obj, inMessage, null);
+
+            AxisOperation op = inMessage.getOperationContext().getAxisOperation();
+
+            OMElement methodElement = inMessage.getEnvelope().getBody()
+                    .getFirstElement();
+            String methodName = op.getName().getLocalPart();
+            Method[] methods = ImplClass.getMethods();
+            //todo method validation has to be done
+            //Todo if we find the method it should be store , in AxisOperation
+            for (int i = 0; i < methods.length; i++) {
+                if (methods[i].getName().equals(methodName)) {
+                    this.method = methods[i];
+                    break;
+                }
+            }
+
+
+            Object[] objectArray = processRequest(methodElement);
+            method.invoke(obj, objectArray);
+        } catch (Exception e) {
+            throw new AxisFault(e);
+        }
+    }
+
+    private Object[] processRequest(OMElement methodElement) throws AxisFault {
+        Class[] parameters = method.getParameterTypes();
+        return BeanUtil.deserialize(methodElement, parameters);
+    }
+}

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/ServiceClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/ServiceClient.java?rev=370994&r1=370993&r2=370994&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/ServiceClient.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/ServiceClient.java
Sat Jan 21 00:30:27 2006
@@ -1,6 +1,7 @@
 package org.apache.axis2.client;
 
 import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.client.async.AsyncResult;
 import org.apache.axis2.client.async.Callback;
 import org.apache.axis2.context.*;
@@ -66,22 +67,19 @@
      * If this service is already in the world that's handed in (in the form of
      * a ConfigurationContext) then I will happily work in it. If not I will
      * create a small little virtual world and live there.
-     * 
-     * @param configContext
-     *            The configuration context under which this service lives (may
-     *            be null, in which case a new local one will be created)
-     * @param axisService
-     *            The service for which this is the client.
-     * @throws AxisFault
-     *             if something goes wrong while creating a config context (if
-     *             needed)
+     *
+     * @param configContext The configuration context under which this service lives (may
+     *                      be null, in which case a new local one will be created)
+     * @param axisService   The service for which this is the client.
+     * @throws AxisFault if something goes wrong while creating a config context (if
+     *                   needed)
      */
     public ServiceClient(ConfigurationContext configContext,
-            AxisService axisService) throws AxisFault {
+                         AxisService axisService) throws AxisFault {
         // create a config context if needed
         this.configContext = (configContext != null) ? configContext
                 : ConfigurationContextFactory
-                        .createConfigurationContextFromFileSystem(null, null);
+                .createConfigurationContextFromFileSystem(null, null);
 
         // save the axisConfig and service
         this.axisConfig = this.configContext.getAxisConfiguration();
@@ -104,28 +102,23 @@
     /**
      * Create a service client for WSDL service identified by the QName of the
      * wsdl:service element in a WSDL document.
-     * 
-     * @param configContext
-     *            The configuration context under which this service lives (may
-     *            be null, in which case a new local one will be created) *
-     * @param wsdlURL
-     *            The URL of the WSDL document to read
-     * @param wsdlServiceName
-     *            The QName of the WSDL service in the WSDL document to create a
-     *            client for
-     * @param portName
-     *            The name of the WSDL 1.1 port to create a client for. May be
-     *            null (if WSDL 2.0 is used or if only one port is there). .
-     * @throws AxisFault
-     *             if something goes wrong while creating a config context (if
-     *             needed)
+     *
+     * @param configContext   The configuration context under which this service lives (may
+     *                        be null, in which case a new local one will be created) *
+     * @param wsdlURL         The URL of the WSDL document to read
+     * @param wsdlServiceName The QName of the WSDL service in the WSDL document to create
a
+     *                        client for
+     * @param portName        The name of the WSDL 1.1 port to create a client for. May be
+     *                        null (if WSDL 2.0 is used or if only one port is there). .
+     * @throws AxisFault if something goes wrong while creating a config context (if
+     *                   needed)
      */
     public ServiceClient(ConfigurationContext configContext, URL wsdlURL,
-            QName wsdlServiceName, String portName) throws AxisFault {
+                         QName wsdlServiceName, String portName) throws AxisFault {
         // create a config context if needed
         this.configContext = (configContext != null) ? configContext
                 : ConfigurationContextFactory
-                        .createConfigurationContextFromFileSystem(null, null);
+                .createConfigurationContextFromFileSystem(null, null);
         try {
             this.axisConfig = this.configContext.getAxisConfiguration();
             axisService = ClientUtils.creatAxisService(wsdlURL,
@@ -137,7 +130,7 @@
             }
             ServiceGroupContext sgc = new ServiceGroupContext(
                     this.configContext, (AxisServiceGroup) this.axisService
-                            .getParent());
+                    .getParent());
             this.serviceContext = sgc.getServiceContext(this.axisService);
         } catch (IOException e) {
             throw new AxisFault(e);
@@ -156,7 +149,7 @@
      * Create an anonymous axisService with one (anonymous) operation each for
      * each MEP that I support dealing with anonymously using the convenience
      * APIs.
-     * 
+     *
      * @return the minted anonymous service
      */
     private AxisService createAnonymousService() {
@@ -183,7 +176,7 @@
      * Return the AxisService this is a client for. This is primarily useful
      * when the AxisService is created anonymously or from WSDL as otherwise the
      * user had the AxisService to start with.
-     * 
+     *
      * @return the axisService
      */
     public AxisService getAxisService() {
@@ -199,7 +192,7 @@
 
     /**
      * Get the client configuration from this service interaction.
-     * 
+     *
      * @return set of options set earlier.
      */
     public Options getOptions() {
@@ -217,7 +210,7 @@
     /**
      * Get the client configuration from this service interaction which have
      * been used to overide operation client options as well.
-     * 
+     *
      * @return set of options set earlier.
      */
     public Options getOverideOptions() {
@@ -226,11 +219,9 @@
 
     /**
      * Engage a module for this service client.
-     * 
-     * @param moduleName
-     *            Name of the module to engage
-     * @throws AxisFault
-     *             if something goes wrong
+     *
+     * @param moduleName Name of the module to engage
+     * @throws AxisFault if something goes wrong
      */
     public void engageModule(QName moduleName) throws AxisFault {
         axisService.engageModule(axisConfig.getModule(moduleName), axisConfig);
@@ -240,9 +231,8 @@
      * Add an XML element as a header to be sent with interactions. This allows
      * users to go a bit beyond the dirt simple XML in/out pattern using this
      * simplified API. A header
-     * 
-     * @param header
-     *            The header to be added for interactions. Must not be null.
+     *
+     * @param header The header to be added for interactions. Must not be null.
      */
     public void addHeader(OMElement header) {
         if (headers == null) {
@@ -254,7 +244,7 @@
     /**
      * Add a simple header consisting of some text (and a header name; duh) to
      * be sent with interactions.
-     * 
+     *
      * @param headerName
      * @param headerText
      */
@@ -271,12 +261,10 @@
      * possibly receive a fault. If you need more control over this interaction
      * then you need to create a client (@see createClient()) for the operation
      * and use that instead.
-     * 
-     * @param elem
-     *            The XML to send
-     * @throws AxisFault
-     *             if something goes wrong while sending it or if a fault is
-     *             received in response (per the Robust In-Only MEP).
+     *
+     * @param elem The XML to send
+     * @throws AxisFault if something goes wrong while sending it or if a fault is
+     *                   received in response (per the Robust In-Only MEP).
      */
     public void sendRobust(OMElement elem) throws AxisFault {
         sendRobust(ANON_ROBUST_OUT_ONLY_OP, elem);
@@ -288,14 +276,11 @@
      * possibly receive a fault under the guise of a specific operation. If you
      * need more control over this interaction then you need to create a client
      * (@see createClient()) for the operation and use that instead.
-     * 
-     * @param operation
-     *            The name of the operation to use. Must NOT be null.
-     * @param elem
-     *            The XML to send
-     * @throws AxisFault
-     *             if something goes wrong while sending it or if a fault is
-     *             received in response (per the Robust In-Only MEP).
+     *
+     * @param operation The name of the operation to use. Must NOT be null.
+     * @param elem      The XML to send
+     * @throws AxisFault if something goes wrong while sending it or if a fault is
+     *                   received in response (per the Robust In-Only MEP).
      */
     public void sendRobust(QName operation, OMElement elem) throws AxisFault {
         // look up the appropriate axisop and create the client
@@ -319,11 +304,9 @@
      * a service operation who's MEP is In-Only. That is, there is no
      * opportunity to get an error from the service via this API; one may still
      * get client-side errors, such as host unknown etc.
-     * 
-     * @param elem
-     *            The XML element to send to the service
-     * @throws AxisFault
-     *             If something goes wrong trying to send the XML
+     *
+     * @param elem The XML element to send to the service
+     * @throws AxisFault If something goes wrong trying to send the XML
      */
     public void fireAndForget(OMElement elem) throws AxisFault {
         fireAndForget(ANON_OUT_ONLY_OP, elem);
@@ -335,13 +318,10 @@
      * MEP is In-Only. That is, there is no opportunity to get an error from the
      * service via this API; one may still get client-side errors, such as host
      * unknown etc.
-     * 
-     * @param operation
-     *            The operation to send fire the message under
-     * @param elem
-     *            The XML element to send to the service
-     * @throws AxisFault
-     *             If something goes wrong trying to send the XML
+     *
+     * @param operation The operation to send fire the message under
+     * @param elem      The XML element to send to the service
+     * @throws AxisFault If something goes wrong trying to send the XML
      */
     public void fireAndForget(QName operation, OMElement elem) throws AxisFault {
         // look up the appropriate axisop and create the client
@@ -438,7 +418,7 @@
     }
 
     public void sendReceiveNonBlocking(QName operation, OMElement elem,
-            Callback callback) throws AxisFault {
+                                       Callback callback) throws AxisFault {
         MessageContext mc = new MessageContext();
         fillSoapEnvelope(mc, elem);
         OperationClient mepClient = createClient(operation);
@@ -463,13 +443,11 @@
      * you're doing and need the full capabilities of Axis2's client
      * architecture. This is meant for people with deep skin and not the light
      * user.
-     * 
-     * @param operation
-     *            The QName of the operation to create a client for.
+     *
+     * @param operation The QName of the operation to create a client for.
      * @return a MEP client configured to talk to the given operation or null if
      *         the operation name is not found.
-     * @throws AxisFault
-     *             if the operation is not found or something else goes wrong
+     * @throws AxisFault if the operation is not found or something else goes wrong
      */
     public OperationClient createClient(QName operation) throws AxisFault {
         AxisOperation axisOp = axisService.getOperation(operation);
@@ -492,7 +470,7 @@
     /**
      * This will close the out put stream or , and remove entry from waiting
      * queue of the transport Listener queue
-     * 
+     *
      * @throws AxisFault
      */
     private void finalizeInvoke(MessageContext msgCtx) throws AxisFault {
@@ -505,7 +483,7 @@
     /**
      * Return the SOAP factory to use depending on what options have been set
      * (or default to SOAP 1.1)
-     * 
+     *
      * @return the SOAP factory
      */
     private SOAPFactory getSOAPFactory() {
@@ -520,13 +498,10 @@
 
     /**
      * Prepare a SOAP envelope with the stuff to be sent.
-     * 
-     * @param mc
-     *            the message context to be filled
-     * @param elem
-     *            the payload content
-     * @throws AxisFault
-     *             if something goes wrong
+     *
+     * @param mc   the message context to be filled
+     * @param elem the payload content
+     * @throws AxisFault if something goes wrong
      */
     private void fillSoapEnvelope(MessageContext mc, OMElement elem)
             throws AxisFault {
@@ -543,6 +518,30 @@
             }
         }
         mc.setEnvelope(se);
+    }
+
+    /**
+     * To get the EPR of the service client if there is
+     *
+     * @return <code>String</code>
+     */
+    public String getMyEPRAddress() {
+        return serviceContext.getMyEPRAddress();
+    }
+
+    /**
+     * To get the Targert EPR if any in service conetext
+     * and reference paramters in TEPR can send back , in the same time this epr can use
to manage
+     * session across mutiple ServiceClient
+     *
+     * @return <code>EndpointReference</code>
+     */
+    public EndpointReference getTargetEPR() {
+        return serviceContext.getTargetEPR();
+    }
+
+    public void setTargetEPR(EndpointReference targetEpr) {
+        serviceContext.setTargetEPR(targetEpr);
     }
 
     /**

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ServiceContext.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ServiceContext.java?rev=370994&r1=370993&r2=370994&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ServiceContext.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ServiceContext.java
Sat Jan 21 00:30:27 2006
@@ -19,6 +19,7 @@
 
 import org.apache.axis2.description.AxisOperation;
 import org.apache.axis2.description.AxisService;
+import org.apache.axis2.addressing.EndpointReference;
 
 import javax.xml.namespace.QName;
 import java.util.ArrayList;
@@ -30,6 +31,7 @@
 public class ServiceContext extends AbstractContext {
 
     private String myEPRAddress;
+    private EndpointReference targetEPR;
 
     private transient AxisService axisService;
     private String serviceInstanceID;
@@ -107,5 +109,13 @@
 
     public void setMyEPRAddress(String myEPRAddress) {
         this.myEPRAddress = myEPRAddress;
+    }
+
+    public EndpointReference getTargetEPR() {
+        return targetEPR;
+    }
+
+    public void setTargetEPR(EndpointReference targetEPR) {
+        this.targetEPR = targetEPR;
     }
 }

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=370994&r1=370993&r2=370994&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
Sat Jan 21 00:30:27 2006
@@ -1,6 +1,7 @@
 package org.apache.axis2.description;
 
 import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.AddressingConstants;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.client.ListenerManager;
 import org.apache.axis2.client.OperationClient;
@@ -14,7 +15,6 @@
 import org.apache.axis2.engine.AxisEngine;
 import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.om.OMElement;
-import org.apache.axis2.om.OMException;
 import org.apache.axis2.soap.SOAPBody;
 import org.apache.axis2.soap.SOAPEnvelope;
 import org.apache.axis2.soap.SOAPFault;
@@ -25,9 +25,9 @@
 import org.apache.wsdl.WSDLConstants;
 
 import javax.xml.namespace.QName;
-import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.Map;
 
 /**
  * Author: Deepal Jayasinghe Date: Oct 3, 2005 Time: 6:01:33 PM
@@ -104,7 +104,7 @@
                              Options options) {
         this.axisOp = axisOp;
         this.sc = sc;
-        this.options = new Options(options);
+        this.options = options;
         this.completed = false;
         this.oc = new OperationContext(axisOp);
         this.oc.setParent(this.sc);
@@ -311,12 +311,16 @@
 
     private void addRefParsToRequset(SOAPEnvelope env) {
         if (options.isManageSession()) {
-            SOAPHeader sh = env.getHeader();
-            ArrayList replyTorefpars = sc.getReplyTorefpars();
-            if (replyTorefpars.size() > 0) {
-                for (int i = 0; i < replyTorefpars.size(); i++) {
-                    OMElement refPars = (OMElement) replyTorefpars.get(i);
-                    sh.addChild(refPars);
+            EndpointReference tepr = sc.getTargetEPR();
+            if (tepr != null) {
+                Map map = tepr.getAllReferenceParameters();
+                Iterator valuse = map.values().iterator();
+                SOAPHeader sh = env.getHeader();
+                while (valuse.hasNext()) {
+                    Object refparaelement = valuse.next();
+                    if (refparaelement instanceof OMElement) {
+                        sh.addChild((OMElement) refparaelement);
+                    }
                 }
             }
         }
@@ -360,16 +364,19 @@
         try {
             // Adding request reference parameters into ServiceContext , so then in the next
             // requesy automatically send them back
-            OMElement refernceParameters = resenvelope.getHeader()
-                    .getFirstChildWithName(new QName("ReplyTo"))
-                    .getFirstChildWithName(new QName("ReferenceParameters"));
-            ArrayList replyTorefPars = new ArrayList();
-            Iterator refPars = refernceParameters.getChildren();
-            while (refPars.hasNext()) {
-                OMElement omElement = (OMElement) refPars.next();
-                replyTorefPars.add(omElement);
-            }
-            sc.setReplyTorefpars(replyTorefPars);
+            sc.setTargetEPR(getReplyToEPR(resenvelope.getHeader()
+                    .getFirstChildWithName(new QName("ReplyTo"))));
+//            sc.setTargetEPR(epr);
+//            OMElement refernceParameters = resenvelope.getHeader()
+//                    .getFirstChildWithName(new QName("ReplyTo"))
+//                    .getFirstChildWithName(new QName("ReferenceParameters"));
+//            ArrayList replyTorefPars = new ArrayList();
+//            Iterator refPars = refernceParameters.getChildren();
+//            while (refPars.hasNext()) {
+//                OMElement omElement = (OMElement) refPars.next();
+//                replyTorefPars.add(omElement);
+//            }
+//            sc.setReplyTorefpars(replyTorefPars);
 
         } catch (Exception e) {
             //NPE may occure there for need to catch this
@@ -385,6 +392,27 @@
         }
 
         return responseMessageContext;
+    }
+
+    private EndpointReference getReplyToEPR(OMElement headerElement) {
+        EndpointReference epr = new EndpointReference(null);
+        Iterator childElements = headerElement.getChildElements();
+        while (childElements.hasNext()) {
+            OMElement eprChildElement = (OMElement) childElements.next();
+            if (AddressingConstants.EPR_ADDRESS.equals(eprChildElement.getLocalName())) {
+//                epr.setAddress(eprChildElement.getText());
+            } else if (AddressingConstants.EPR_REFERENCE_PARAMETERS.equals(eprChildElement.getLocalName()))
{
+
+                Iterator referenceParameters = eprChildElement.getChildElements();
+                while (referenceParameters.hasNext()) {
+                    OMElement element = (OMElement) referenceParameters.next();
+                    epr.addReferenceParameter(element);
+                }
+            } else if (AddressingConstants.Final.WSA_METADATA.equals(eprChildElement.getLocalName()))
{
+                epr.setMetaData(eprChildElement);
+            }
+        }
+        return epr;
     }
 
     /**

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=370994&r1=370993&r2=370994&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
Sat Jan 21 00:30:27 2006
@@ -192,6 +192,7 @@
         if (mc.getMessageID() == null) {
             setMessageID(mc);
         }
+        mc.setServiceContext(sc);
         axisOp.registerOperationContext(mc, oc);
         this.completed = false;
     }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/Utils.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/Utils.java?rev=370994&r1=370993&r2=370994&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/Utils.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/Utils.java Sat Jan
21 00:30:27 2006
@@ -277,7 +277,13 @@
 
 
     public static QName getModuleName(String name, String versionID) {
-        return new QName(name + "-" + versionID);
+        String moduleName ;
+        if(versionID!=null && !versionID.equals("")){
+           moduleName = name + "-" + versionID;
+        } else {
+            moduleName = name;
+        }
+        return new QName(moduleName);
     }
 
     public static void calculateDefaultModuleVersion(HashMap modules, AxisConfiguration axisConfig)
{

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/ServiceGroupContextTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/ServiceGroupContextTest.java?rev=370994&r1=370993&r2=370994&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/ServiceGroupContextTest.java
(original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/ServiceGroupContextTest.java
Sat Jan 21 00:30:27 2006
@@ -13,10 +13,8 @@
 import org.apache.axis2.integration.UtilServer;
 import org.apache.axis2.om.OMAbstractFactory;
 import org.apache.axis2.om.OMElement;
-import org.apache.axis2.om.OMNamespace;
 import org.apache.axis2.soap.SOAPEnvelope;
 import org.apache.axis2.soap.SOAPFactory;
-import org.apache.axis2.soap.SOAPHeaderBlock;
 import org.apache.axis2.util.Utils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -91,28 +89,15 @@
         options.setAction(operationName.getLocalPart());
 
         ConfigurationContext configContext =
-                ConfigurationContextFactory.createConfigurationContextFromFileSystem("target/test-resources/integrationRepo",null);
-        ServiceClient sender = new ServiceClient(configContext,null);
+                ConfigurationContextFactory.createConfigurationContextFromFileSystem("target/test-resources/integrationRepo",
null);
+        ServiceClient sender = new ServiceClient(configContext, null);
         sender.setOptions(options);
 
-        OMElement result = sender.sendReceive(payload.getBody().getFirstElement());
+        sender.sendReceive(payload.getBody().getFirstElement());
 
-        OMNamespace axis2Namespace = fac.createOMNamespace(Constants.AXIS2_NAMESPACE_URI,
-                Constants.AXIS2_NAMESPACE_PREFIX);
         SOAPEnvelope defaultEnvelope = fac.getDefaultEnvelope();
 
         //TODO : ple imporove this , what I have done is a hack
-        OMElement body = (OMElement) result.getParent();
-        SOAPEnvelope soapEnvlop = (SOAPEnvelope) body.getParent();
-
-        String serviceGroupIds= soapEnvlop.getHeader().getFirstChildWithName(new QName("ReplyTo"))
-                .getFirstChildWithName(new QName("ReferenceParameters")).
-                getFirstChildWithName(new QName("ServiceGroupId")).getText();
-
-//        OMElement soapHeaderElement = fac.createOMElement(Constants.SERVICE_GROUP_ID, axis2Namespace);
-//        soapHeaderElement.setText(serviceGroupId);
-
-//        sender.addHeader(soapHeaderElement);
         OMElement result2 = sender.sendReceive(defaultEnvelope.getBody().getFirstElement());
         String text = result2.getText();
         assertEquals("Number of requests should be 2", 2, Integer.parseInt(text));

Modified: webservices/axis2/trunk/java/modules/webapp/listServices.jsp
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/webapp/listServices.jsp?rev=370994&r1=370993&r2=370994&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/webapp/listServices.jsp (original)
+++ webservices/axis2/trunk/java/modules/webapp/listServices.jsp Sat Jan 21 00:30:27 2006
@@ -42,27 +42,29 @@
         Hashtable errornessservice =(Hashtable)request.getSession().getAttribute(Constants.ERROR_SERVICE_MAP);
          boolean status = false;
         if (serviceMap!=null && !serviceMap.isEmpty()){
-        HashMap operations;
+        Iterator opItr;
+        //HashMap operations;
         String serviceName ;
         Collection servicecol = serviceMap.values();
-        Collection operationsList;
+       // Collection operationsList;
        for (Iterator iterator = servicecol.iterator(); iterator.hasNext();) {
             AxisService axisService = (AxisService) iterator.next();
-            operations = axisService.getOperations();
-            operationsList = operations.values();
+            opItr = axisService.getOperations();
+            //operationsList = operations.values();
             serviceName = axisService.getName();
             %><h2><font color="blue"><a href="<%=prifix + axisService.getName()%>?wsdl"><%=serviceName%></a></font></h2>
            <font color="blue">Service EPR : <font color="black"><%=prifix
+ axisService.getName()%></font>
            <h4>Service Description : <font color="black"><%=axisService.getServiceDescription()%></h4>
            <%
-            if (operationsList.size() > 0) {
+            if (opItr.hasNext()) {
                 %><i>Available operations</i><%
             } else {
                 %><i> There are no Operations specified</i><%
             }
+               opItr = axisService.getOperations();
            %><ul><%
-            for (Iterator iterator1 = operationsList.iterator(); iterator1.hasNext();) {
-                AxisOperation axisOperation = (AxisOperation) iterator1.next();
+            while (opItr.hasNext()) {
+                AxisOperation axisOperation = (AxisOperation) opItr.next();
                 %><li><%=axisOperation.getName().getLocalPart()%></li>
 <%--                <br>Operation EPR : <%=prifix + axisService.getName().getLocalPart()
+ "/"+ axisOperation.getName().getLocalPart()%>--%>
                 <%

Modified: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/java2wsdl/SchemaGenerator.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/java2wsdl/SchemaGenerator.java?rev=370994&r1=370993&r2=370994&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/java2wsdl/SchemaGenerator.java
(original)
+++ webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/java2wsdl/SchemaGenerator.java
Sat Jan 21 00:30:27 2006
@@ -3,20 +3,8 @@
 import org.apache.axis2.wsdl.java2wsdl.bytecode.MethodTable;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.ws.commons.schema.XmlSchema;
-import org.apache.ws.commons.schema.XmlSchemaCollection;
-import org.apache.ws.commons.schema.XmlSchemaComplexType;
-import org.apache.ws.commons.schema.XmlSchemaElement;
-import org.apache.ws.commons.schema.XmlSchemaForm;
-import org.apache.ws.commons.schema.XmlSchemaSequence;
-import org.codehaus.jam.JClass;
-import org.codehaus.jam.JMethod;
-import org.codehaus.jam.JParameter;
-import org.codehaus.jam.JProperty;
-import org.codehaus.jam.JamClassIterator;
-import org.codehaus.jam.JamService;
-import org.codehaus.jam.JamServiceFactory;
-import org.codehaus.jam.JamServiceParams;
+import org.apache.ws.commons.schema.*;
+import org.codehaus.jam.*;
 
 import javax.xml.namespace.QName;
 import java.util.HashMap;
@@ -317,6 +305,21 @@
         }
     }
 
+    /**
+     * JAM convert first name of an attribute into UpperCase as an example
+     * if there is a instance variable called foo in a bean , then Jam give that as Foo
+     * so this method is to correct that error
+     *
+     * @param wrongName
+     * @return
+     */
+    private String getCorrectName(String wrongName) {
+        if (wrongName.length() > 1) {
+            return wrongName.substring(0, 1).toLowerCase() + wrongName.substring(1, wrongName.length());
+        } else {
+            return wrongName.substring(0, 1).toLowerCase();
+        }
+    }
 
     private void generateSchema(JClass javaType) {
         String name = javaType.getQualifiedName();
@@ -352,11 +355,12 @@
                 }
                 if (typeTable.isSimpleType(propertyName)) {
                     XmlSchemaElement elt1 = new XmlSchemaElement();
-                    elt1.setName(property.getSimpleName());
+                    elt1.setName(getCorrectName(property.getSimpleName()));
                     elt1.setSchemaTypeName(typeTable.getSimpleSchemaTypeName(propertyName));
                     sequence.getItems().add(elt1);
                     if (isArryType) {
                         elt1.setMaxOccurs(Long.MAX_VALUE);
+                        elt1.setMinOccurs(Long.MIN_VALUE);
 //                        elt1.setMinOccurs(2);
                     }
                 } else {
@@ -366,11 +370,12 @@
                         generateSchema(property.getType());
                     }
                     XmlSchemaElement elt1 = new XmlSchemaElement();
-                    elt1.setName(property.getSimpleName());
+                    elt1.setName(getCorrectName(property.getSimpleName()));
                     elt1.setSchemaTypeName(typeTable.getComplexScheamType(propertyName));
                     sequence.getItems().add(elt1);
                     if (isArryType) {
                         elt1.setMaxOccurs(Long.MAX_VALUE);
+                        elt1.setMinOccurs(Long.MIN_VALUE);
                     }
                 }
             }



Mime
View raw message