You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ke...@apache.org on 2007/01/24 08:00:29 UTC

svn commit: r499285 - in /webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2: description/WSDL20ToAxisServiceBuilder.java transport/http/AxisServlet.java transport/http/util/RESTUtil.java

Author: keithc
Date: Tue Jan 23 23:00:29 2007
New Revision: 499285

URL: http://svn.apache.org/viewvc?view=rev&rev=499285
Log:
Fixing build break caused by woden API change
Added soap action to message context (need this in the soap response case)

Modified:
    webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java
    webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java
    webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/util/RESTUtil.java

Modified: webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java?view=diff&rev=499285&r1=499284&r2=499285
==============================================================================
--- webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java (original)
+++ webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java Tue Jan 23 23:00:29 2007
@@ -91,11 +91,12 @@
     public WSDL20ToAxisServiceBuilder(String wsdlUri,
                                       String name, String interfaceName) throws Exception {
         WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
-        DescriptionElement descriptionElement = wsdlReader.readWSDL(wsdlUri);
+        Description description = wsdlReader.readWSDL(wsdlUri);
+        DescriptionElement descriptionElement = description.toElement();
         savedTargetNamespace = descriptionElement.getTargetNamespace()
                 .toString();
         namespacemap = descriptionElement.getNamespaces();
-        this.description = descriptionElement.toComponent();
+        this.description = description;
         this.serviceName = null;
         if (name != null) {
             serviceName = new QName(descriptionElement.getTargetNamespace().toString(), name);
@@ -314,9 +315,10 @@
         try {
             if (description == null) {
 
+                Description description = null;
                 DescriptionElement descriptionElement = null;
                 if (wsdlURI != null && !"".equals(wsdlURI)) {
-                    descriptionElement = readInTheWSDLFile(wsdlURI);
+                    description = readInTheWSDLFile(wsdlURI);
                 } else if (in != null) {
 
                     DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory
@@ -329,14 +331,15 @@
                     WSDLSource wsdlSource = reader.createWSDLSource();
                     wsdlSource.setSource(document.getDocumentElement());
                     wsdlSource.setBaseURI(new URI(getBaseUri()));
-                    descriptionElement = reader.readWSDL(wsdlSource);
+                    description = reader.readWSDL(wsdlSource);
+                    descriptionElement = description.toElement();
                 } else {
                     throw new AxisFault("No resources found to read the wsdl");
                 }
 
                 savedTargetNamespace = descriptionElement.getTargetNamespace().toString();
                 namespacemap = descriptionElement.getNamespaces();
-                this.description = descriptionElement.toComponent();
+                this.description = description;
 
             }
             // Create the namespacemap
@@ -1271,7 +1274,7 @@
         return false;
     }
 
-    private DescriptionElement readInTheWSDLFile(String wsdlURI)
+    private Description readInTheWSDLFile(String wsdlURI)
             throws WSDLException {
 
         WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();

Modified: webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java?view=diff&rev=499285&r1=499284&r2=499285
==============================================================================
--- webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java (original)
+++ webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java Tue Jan 23 23:00:29 2007
@@ -233,13 +233,7 @@
         if (!disableREST && enableRESTInAxis2MainServlet && isRESTRequest(req)) {
             msgContext = createMessageContext(req, res);
             try {
-              String soapActionHeader = req.getHeader(HTTPConstants.HEADER_SOAP_ACTION);
 
-            if ((soapActionHeader != null) && soapActionHeader.startsWith("\"")
-                && soapActionHeader.endsWith("\"")) {
-                soapActionHeader = soapActionHeader.substring(1, soapActionHeader.length() - 1);
-            }
-                msgContext.setSoapAction(soapActionHeader);
                 new RESTUtil(configContext).processPostRequest(msgContext,
                         req,
                         res);

Modified: webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/util/RESTUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/util/RESTUtil.java?view=diff&rev=499285&r1=499284&r2=499285
==============================================================================
--- webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/util/RESTUtil.java (original)
+++ webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/transport/http/util/RESTUtil.java Tue Jan 23 23:00:29 2007
@@ -22,6 +22,7 @@
 import org.apache.axiom.soap.SOAPBody;
 import org.apache.axiom.soap.SOAPEnvelope;
 import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAP12Constants;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
 import org.apache.axis2.context.ConfigurationContext;
@@ -121,6 +122,35 @@
                                      HttpServletResponse response) throws AxisFault {
         // here, only the parameters in the URI are supported. Others will be discarded.
         try {
+
+            // when using the wsdl2 soap response MEP it can contain soap action. We better look for it here,
+            // if its there put it into msgContext so that we can use it later for dispatching purposes.
+
+            String contentType = request.getContentType();
+
+            if (contentType != null) {
+
+                //Check for action header and set it in as soapAction in MessageContext
+                int index = contentType.indexOf("action");
+                if (index > -1) {
+                    String transientString = contentType.substring(index, contentType.length());
+                    int equal = transientString.indexOf("=");
+                    int firstSemiColon = transientString.indexOf(";");
+                    String soapAction; // This will contain "" in the string
+                    if (firstSemiColon > -1) {
+                        soapAction = transientString.substring(equal + 1, firstSemiColon);
+                    } else {
+                        soapAction = transientString.substring(equal + 1, transientString.length());
+                    }
+                    if ((soapAction != null) && soapAction.startsWith("\"")
+                            && soapAction.endsWith("\"")) {
+                        soapAction = soapAction
+                                .substring(1, soapAction.length() - 1);
+                    }
+                    msgContext.setSoapAction(soapAction);
+
+                }
+            }
 
             // set the required properties so that even if there is an error during the dispatch
             // phase the response message will be passed to the client well. 



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