beehive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mm...@apache.org
Subject svn commit: rev 43689 - in incubator/beehive/trunk/wsm: . src/runtime/org/apache/beehive/wsm/axis src/runtime/org/apache/beehive/wsm/axis/badtiger
Date Fri, 10 Sep 2004 21:18:13 GMT
Author: mmerz
Date: Fri Sep 10 14:18:11 2004
New Revision: 43689

Added:
   incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/badtiger/
   incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/badtiger/EnumWrapper.java
Modified:
   incubator/beehive/trunk/wsm/build.xml
   incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/AnnotatedJWSHandler.java
   incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/AxisHook.java
Log:
Added SOAPBinding annotation support to the AnnotatedJWSHandler and AxisHook.
Since AXIS 1.2 uses a package name containing the "enum" keyword, the EnumWrapper
class was added in the axis/badtiger package and is built using the "source=1.4"
compiler flag.

Contributor: Jonathan Colwell



Modified: incubator/beehive/trunk/wsm/build.xml
==============================================================================
--- incubator/beehive/trunk/wsm/build.xml	(original)
+++ incubator/beehive/trunk/wsm/build.xml	Fri Sep 10 14:18:11 2004
@@ -165,10 +165,19 @@
   </target>
 
   <target name="axis" depends="runtime" if="isJDK15">
+    <!-- Build the badtiger classes using source=1.4 compile flag -->
+    <echo message="BadTiger build"/>
+    <javac destdir="${runtime.classes}" classpathref="axis.classpath" source="1.4" debug="on">
+      <src path="${runtime.dir}"/>
+      <include name="**/axis/badtiger/**"/>
+    </javac>
+
     <!-- Build the axis classes -->
+    <echo message="AXIS build"/>
     <javac destdir="${runtime.classes}" classpathref="axis.classpath" source="1.5" debug="on">
       <src path="${runtime.dir}"/>
       <include name="**/axis/**"/>
+      <exclude name="**/axis/badtiger/**"/>
     </javac>
   </target>
 

Modified: incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/AnnotatedJWSHandler.java
==============================================================================
--- incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/AnnotatedJWSHandler.java
(original)
+++ incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/AnnotatedJWSHandler.java
Fri Sep 10 14:18:11 2004
@@ -69,7 +69,7 @@
  *
  * @author Jonathan Colwell (jcolwell@bea.com)
  * 
- * but most of the code was written by:
+ * but most of the original code was written by:
  * @author Glen Daniels (gdaniels@allaire.com)
  * @author Doug Davis (dug@us.ibm.com)
  * @author Sam Ruby (rubys@us.ibm.com)
@@ -95,7 +95,7 @@
       /* Grab the *.jws filename from the context - should have been */
       /* placed there by another handler (ie. HTTPActionHandler)     */
       /***************************************************************/
-      String   jwsFile = realpath;
+      String jwsFile = realpath;
       String rel = msgContext.getStrProp(Constants.MC_RELATIVE_PATH);
 
       // Check for file existance, report error with
@@ -274,7 +274,9 @@
         // Take the setting for the scope option from the handler
         // parameter named "scope"
         String scope = (String)getOption(RPCProvider.OPTION_SCOPE);
-                if (scope == null) scope = "Request";
+        if (scope == null) {
+            scope = "Request";
+        }
         rpc.setOption(RPCProvider.OPTION_SCOPE, scope);
                 
         ServiceDesc sd = AxisHook.createServiceDesc(wsm, cl);
@@ -293,6 +295,7 @@
         }
         rpc.setOption(RPCProvider.OPTION_ALLOWEDMETHODS, sb.toString());   
         rpc.setOption(RPCProvider.OPTION_WSDL_PORTTYPE, wsm.getWsName());
+        rpc.setOption(RPCProvider.OPTION_WSDL_SERVICEPORT, wsm.getWsName());
         rpc.setOption(RPCProvider.OPTION_WSDL_SERVICEELEMENT,
                       wsm.getWsServiceName());
         rpc.setOption(RPCProvider.OPTION_WSDL_TARGETNAMESPACE, 

Modified: incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/AxisHook.java
==============================================================================
--- incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/AxisHook.java	(original)
+++ incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/AxisHook.java	Fri
Sep 10 14:18:11 2004
@@ -13,7 +13,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.beehive.wsm.axis;
 
 import java.lang.reflect.Method;
@@ -29,9 +28,11 @@
 import org.apache.axis.description.JavaServiceDesc;
 import org.apache.axis.description.ParameterDesc;
 import org.apache.axis.description.OperationDesc;
+import org.apache.beehive.wsm.axis.badtiger.EnumWrapper;
 import org.apache.beehive.wsm.jsr181.model.WebServiceTYPEMetadata;
 import org.apache.beehive.wsm.jsr181.model.WebServiceMETHODMetadata;
 import org.apache.beehive.wsm.jsr181.model.WebServicePARAMETERMetadata;
+import org.apache.beehive.wsm.jsr181.model.SOAPBindingInfo;
 
 import javax.jws.WebParam;
 
@@ -65,6 +66,10 @@
 
         String targetNamespace = wsm.getWsTargetNamespace();
         sd.setDefaultNamespace(targetNamespace);
+
+
+        SOAPBindingInfo sbi = wsm.getSoapBinding();
+        configureSoapBinding(sd, sbi);
       
         Collection<WebServiceMETHODMetadata> methods = wsm.getMethods();
         List<String> allowedMethods = new ArrayList<String>();
@@ -82,11 +87,15 @@
                 allowedMethods.add(javaMethodName);
 
                 od.setSoapAction(meth.getWmAction());
-
-                od.setReturnQName(new QName(meth.getWrName()));   
-
-                od.setReturnClass(meth.getJavaReturnType());
-                //      od.setReturnHeader(
+                
+                if (meth.isOneWay()) {                    
+                    od.setReturnClass(java.lang.Void.TYPE);
+                }
+                else {
+                    od.setReturnQName(new QName(meth.getWrName()));   
+                    od.setReturnClass(meth.getJavaReturnType());
+                    //od.setReturnHeader(
+                }
             
                 List<WebServicePARAMETERMetadata> parameters = meth.getParams();
                 List<Class> paramClasses = new ArrayList<Class>();          
@@ -135,6 +144,50 @@
         sd.setAllowedMethods(allowedMethods);
         
         return sd;
+    }
+
+    protected static void configureSoapBinding(ServiceDesc sd,
+                                               SOAPBindingInfo sbi)
+    {       
+     
+        javax.jws.soap.SOAPBinding.Style style 
+            = javax.jws.soap.SOAPBinding.Style.DOCUMENT;
+        javax.jws.soap.SOAPBinding.Use use
+            = javax.jws.soap.SOAPBinding.Use.LITERAL;
+        javax.jws.soap.SOAPBinding.ParameterStyle paramStyle
+            = javax.jws.soap.SOAPBinding.ParameterStyle.WRAPPED;
+
+        if (sbi != null) {
+           style = sbi.getStyle();
+           use = sbi.getUse();
+           paramStyle = sbi.getParameterStyle();
+        }
+
+        if (style == style.RPC) {
+            sd.setStyle(EnumWrapper.RPC);
+            if (use == use.ENCODED) {
+                sd.setUse(EnumWrapper.ENCODED);
+            }
+            else {
+                sd.setUse(EnumWrapper.LITERAL);
+            }
+        }
+        else {
+            /*
+             * since DOCUMENT ENCODED is not valid so
+             * force to use LITERAL
+             */
+            sd.setUse(EnumWrapper.LITERAL);
+
+            // check if this is a wrapped document literal 
+            if (paramStyle == paramStyle.WRAPPED) {
+                sd.setStyle(EnumWrapper.WRAPPED);
+            }
+            else {
+                // just regular document style
+                sd.setStyle(EnumWrapper.DOCUMENT);
+            }
+        }        
     }
 }
   

Added: incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/badtiger/EnumWrapper.java
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/badtiger/EnumWrapper.java
Fri Sep 10 14:18:11 2004
@@ -0,0 +1,42 @@
+/*
+ * EnumWrapper.java
+ * 
+ * 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.
+ * 
+ */
+package org.apache.beehive.wsm.axis.badtiger;
+
+import org.apache.axis.enum.Style;
+import org.apache.axis.enum.Use;
+
+
+/*******************************************************************************
+ * This class provides a way to work with some of the Classes from AXIS with 
+ * enum in the package.  Building this package using source=1.4 provides a 
+ * cheesy solution to this annoying problem.
+ *
+ * @author Jonathan Colwell
+ */
+public class EnumWrapper {
+
+    public static final Style DOCUMENT = Style.DOCUMENT;
+    public static final Style RPC = Style.RPC;
+    public static final Style WRAPPED = Style.WRAPPED;
+    public static final Style MESSAGE = Style.MESSAGE;
+
+    public static final Use ENCODED = Use.ENCODED;
+    public static final Use LITERAL = Use.LITERAL;
+}

Mime
View raw message