You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ek...@apache.org on 2005/11/30 01:56:12 UTC
svn commit: r349854 - in /beehive/trunk/wsm: src/api/javax/jws/
src/axis/org/apache/beehive/wsm/axis/
src/core/org/apache/beehive/wsm/processor/checker/
src/core/org/apache/beehive/wsm/registration/
test/src/junit-services/org/apache/beehive/wsm/axis/ ...
Author: ekoneil
Date: Tue Nov 29 16:56:01 2005
New Revision: 349854
URL: http://svn.apache.org/viewcvs?rev=349854&view=rev
Log:
Some JSR-181 1.0 spec work:
- verify some document style bare / wrapped checks that were previously unimplemented
- emit the name of the service being checked. makes things easier to debug...
BB: self
Test: WSM pass
Added:
beehive/trunk/wsm/test/src/junit-services/org/apache/beehive/wsm/beans/
beehive/trunk/wsm/test/src/junit-services/org/apache/beehive/wsm/beans/SessionIdType.java (with props)
beehive/trunk/wsm/test/src/junit-services/org/apache/beehive/wsm/holders/
beehive/trunk/wsm/test/src/junit-services/org/apache/beehive/wsm/holders/SessionIdHolder.java (with props)
Modified:
beehive/trunk/wsm/src/api/javax/jws/WebParam.java
beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/ServiceDescriptionFactory.java
beehive/trunk/wsm/src/core/org/apache/beehive/wsm/processor/checker/Jsr181AnnotationChecker.java
beehive/trunk/wsm/src/core/org/apache/beehive/wsm/registration/TypeRegistrar.java
beehive/trunk/wsm/test/src/junit-services/org/apache/beehive/wsm/axis/FakeWebService.java
beehive/trunk/wsm/test/src/junit/org/apache/beehive/wsm/axis/handlers/AnnotatedWebServiceDeploymentHandlerTest.java
beehive/trunk/wsm/test/src/junit/org/apache/beehive/wsm/test/axis/AxisHookTest.java
Modified: beehive/trunk/wsm/src/api/javax/jws/WebParam.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/src/api/javax/jws/WebParam.java?rev=349854&r1=349853&r2=349854&view=diff
==============================================================================
--- beehive/trunk/wsm/src/api/javax/jws/WebParam.java (original)
+++ beehive/trunk/wsm/src/api/javax/jws/WebParam.java Tue Nov 29 16:56:01 2005
@@ -24,6 +24,10 @@
@Target(value = ElementType.PARAMETER)
public @interface WebParam {
+ public enum Mode {
+ IN, OUT, INOUT
+ }
+
boolean header() default false;
Mode mode() default Mode.IN;
@@ -31,8 +35,4 @@
String name() default "";
String targetNamespace() default "";
-
- public enum Mode {
- IN, OUT, INOUT
- }
}
Modified: beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/ServiceDescriptionFactory.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/ServiceDescriptionFactory.java?rev=349854&r1=349853&r2=349854&view=diff
==============================================================================
--- beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/ServiceDescriptionFactory.java (original)
+++ beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/ServiceDescriptionFactory.java Tue Nov 29 16:56:01 2005
@@ -45,7 +45,10 @@
import org.apache.axis.encoding.TypeMapping;
import org.apache.axis.encoding.TypeMappingRegistry;
import org.apache.axis.encoding.TypeMappingRegistryImpl;
-import org.apache.axis.encoding.ser.*;
+import org.apache.axis.encoding.ser.BeanDeserializerFactory;
+import org.apache.axis.encoding.ser.BeanSerializerFactory;
+import org.apache.axis.encoding.ser.ArrayDeserializerFactory;
+import org.apache.axis.encoding.ser.ArraySerializerFactory;
import org.apache.axis.utils.BeanPropertyDescriptor;
import org.apache.axis.utils.BeanUtils;
import org.apache.axis.Constants;
@@ -129,161 +132,167 @@
*/
sd.getOperations();
- /*
- Walk the methods
- */
Collection<? extends BeehiveWsMethodMetadata> methods = wsm.getMethods();
for(BeehiveWsMethodMetadata meth : methods) {
String operationName = meth.getWmOperationName();
- if(operationName != null && operationName.length() > 0) {
- OperationDesc od = getOperationDesc(sd, meth);
- assert od != null : "Can not find method: " + operationName + " in webservice";
-
- od.setElementQName(new QName(targetNamespace, operationName));
- od.setName(operationName);
- od.setSoapAction(meth.getWmAction());
- if(meth.isOneWay()) {
- od.setMep(OperationType.ONE_WAY);
- }
- else {
- String namespace = "";
- // namespace only should be added for document style, RPC style doesn't need name space for return type.
- if(wsm.getSoapBinding().getStyle() == SOAPBinding.Style.DOCUMENT)
- namespace = meth.getWrTargetNamespace();
-
- od.setReturnQName(new QName(namespace, meth.getWrName()));
-
- QName qn = null;
- QName odReturnType = od.getReturnType();
- final Class returnType = createClass(meth.getJavaReturnType());
-
- // if we are processing an rpc encoded service, and the qname of the return type
- // from the operation desc has a name space uri of soapenc, there is no need to
- // call configureTypeMapping since we already know the type.
- if(wsm.getSoapBinding().getStyle() == SOAPBinding.Style.RPC &&
- wsm.getSoapBinding().getUse() == SOAPBinding.Use.ENCODED) {
-
- if(odReturnType != null &&
- !returnType.isArray() &&
- Constants.URI_SOAP11_ENC.equals(odReturnType.getNamespaceURI()))
- qn = odReturnType;
- }
+ OperationDesc od = getOperationDesc(sd, meth);
+ assert od != null : "Can not find method: " + operationName + " in webservice";
- if (qn == null) {
- qn = configureTypeMapping(sd, returnType, meth.getWrTargetNamespace());
- od.setReturnType(qn);
- od.setReturnClass(returnType);
- }
+ /*
+ Configure web method info
+ */
+ od.setElementQName(new QName(targetNamespace, operationName));
+ od.setName(operationName);
+ od.setSoapAction(meth.getWmAction());
+ if(meth.isOneWay()) {
+ od.setMep(OperationType.ONE_WAY);
+ }
+ else {
+ String namespace = "";
+ /*
+ namespace only should be added for document style,
+ RPC style doesn't need name space for return type.
+ */
+ if(wsm.getSoapBinding().getStyle() == SOAPBinding.Style.DOCUMENT)
+ namespace = meth.getWrTargetNamespace();
- if (wsm.getSoapBinding().getStyle() == SOAPBinding.Style.RPC && returnType.isArray()) {
- od.getReturnParamDesc().setItemQName(new QName("","item"));
- }
+ od.setReturnQName(new QName(namespace, meth.getWrName()));
+
+ QName qn = null;
+ QName odReturnType = od.getReturnType();
+ final Class returnType = createClass(meth.getJavaReturnType());
+
+ /*
+ if we are processing an rpc encoded service, and the qname of the return type
+ from the operation desc has a name space uri of soapenc, there is no need to
+ call configureTypeMapping since we already know the type.
+ */
+ if(wsm.getSoapBinding().getStyle() == SOAPBinding.Style.RPC &&
+ wsm.getSoapBinding().getUse() == SOAPBinding.Use.ENCODED) {
+
+ if(odReturnType != null
+ && !returnType.isArray()
+ && Constants.URI_SOAP11_ENC.equals(odReturnType.getNamespaceURI()))
+ qn = odReturnType;
}
- // process the parameters
- int pcnt = 0;
- for(BeehiveWsParameterMetadata param : meth.getParams()) {
- ParameterDesc pd = od.getParameter(pcnt++);
-
- final Class paramType = createClass(param.getJavaType());
-
- if(pd.getTypeQName() == null) {
- // set the typeQName if it is not set already
- QName typeQName = configureTypeMapping(sd, paramType, param.getWpTargetNamespace());
- /*
- * jongjinchoi@apache.org 2005-Mar-16 -- The typeQName
- * from configureTypeMapping() is not dummy. This is
- * required to find ArrayDeserializer when the
- * document/literal bare array is deserialized.
- */
- pd.setTypeQName(typeQName);
- }
+ if (qn == null) {
+ qn = configureTypeMapping(sd, returnType, meth.getWrTargetNamespace());
+ od.setReturnType(qn);
+ od.setReturnClass(returnType);
+ }
- // set QName
- String namespace = "";
- // namespace only should be added for document style, RPC style doesn't need name space for parameter names.
- if(wsm.getSoapBinding().getStyle() == SOAPBinding.Style.DOCUMENT)
- namespace = param.getWpTargetNamespace();
- QName paramQName = new QName(namespace, param.getWpName());
- pd.setQName(paramQName);
-
- // set Mode
- final boolean header = param.isWpHeader();
- final WebParam.Mode mode = param.getWpMode();
- switch(mode) {
- case IN:
- pd.setMode(ParameterDesc.IN);
- pd.setInHeader(header);
- pd.setOutHeader(false);
- break;
- case OUT:
- pd.setMode(ParameterDesc.OUT);
- pd.setInHeader(false);
- pd.setOutHeader(header);
- break;
- case INOUT:
- pd.setMode(ParameterDesc.INOUT);
- pd.setInHeader(header);
- pd.setOutHeader(header);
- break;
- default:
- throw new IllegalArgumentException("Illegal value for WebParam.Mode: " + mode);
- }
+ if (wsm.getSoapBinding().getStyle() == SOAPBinding.Style.RPC && returnType.isArray())
+ od.getReturnParamDesc().setItemQName(new QName("","item"));
+ }
- // set JavaType
- pd.setJavaType(paramType);
+ /*
+ Configure method parameters
+ */
+ int pcnt = 0;
+ for(BeehiveWsParameterMetadata param : meth.getParams()) {
+ ParameterDesc pd = od.getParameter(pcnt++);
+
+ final Class paramType = createClass(param.getJavaType());
+
+ if(pd.getTypeQName() == null) {
+ /* set the typeQName if it is not set already */
+ QName typeQName = configureTypeMapping(sd, paramType, param.getWpTargetNamespace());
+ /*
+ jongjinchoi@apache.org 2005-Mar-16 -- The typeQName from configureTypeMapping() is not
+ dummy. This is required to find ArrayDeserializer when the document/literal bare array
+ is deserialized.
+ */
+ pd.setTypeQName(typeQName);
}
+ /* set QName */
+ String namespace = "";
/*
- Configure exceptions
+ namespace only should be added for document style, RPC style
+ doesn't need name space for parameter names.
*/
- Method javaMethod = od.getMethod();
- boolean hasUserDefinedFaults = false;
- for(Class thrown : javaMethod.getExceptionTypes()) {
- FaultDesc fd = od.getFaultByClass(thrown);
-
- if(null == fd) {
- String message =
- "Exception: "
+ if(wsm.getSoapBinding().getStyle() == SOAPBinding.Style.DOCUMENT)
+ namespace = param.getWpTargetNamespace();
+
+ QName paramQName = new QName(namespace, param.getWpName());
+ pd.setQName(paramQName);
+
+ final boolean header = param.isWpHeader();
+ final WebParam.Mode mode = param.getWpMode();
+ switch(mode) {
+ case IN:
+ pd.setMode(ParameterDesc.IN);
+ pd.setInHeader(header);
+ pd.setOutHeader(false);
+ break;
+ case OUT:
+ pd.setMode(ParameterDesc.OUT);
+ pd.setInHeader(false);
+ pd.setOutHeader(header);
+ break;
+ case INOUT:
+ pd.setMode(ParameterDesc.INOUT);
+ pd.setInHeader(header);
+ pd.setOutHeader(header);
+ break;
+ default:
+ throw new IllegalArgumentException("Illegal value for WebParam.Mode: " + mode);
+ }
+ pd.setJavaType(paramType);
+ }
+
+ /*
+ Configure web method exceptions
+ */
+ Method javaMethod = od.getMethod();
+ boolean hasUserDefinedFaults = false;
+ for(Class thrown : javaMethod.getExceptionTypes()) {
+ FaultDesc fd = od.getFaultByClass(thrown);
+
+ if(null == fd) {
+ String message =
+ "Exception: "
+ thrown.getCanonicalName()
+ " is not picked up by Axis, only non Remote and Application Specific exceptions are registed in Axis. This is not a fatal error.";
- LOGGER.warn(message);
- continue;
- }
+ LOGGER.warn(message);
+ continue;
+ }
- QName qname = configureTypeMapping(sd, thrown, meth.getWrTargetNamespace());
- fd.setXmlType(qname);
- fd.setQName(qname);
- fd.setComplex(true);
+ QName qname = configureTypeMapping(sd, thrown, meth.getWrTargetNamespace());
+ fd.setXmlType(qname);
+ fd.setQName(qname);
+ fd.setComplex(true);
- ArrayList parameters = fd.getParameters();
+ ArrayList parameters = fd.getParameters();
+ /*
+ Based on JavaServiceDesc.createFaultMetadata comments there should
+ only be one parameter on the fd that points to the type
+ */
+ if (parameters != null) {
/*
- Based on JavaServiceDesc.createFaultMetadata comments there should
- only be one parameter on the fd that points to the type
+ make sure the parmeter description points to the type, since the
+ type was not registered at the time of creating the fault, we
+ need to set the type
*/
- if (parameters != null) {
- /*
- make sure the parmeter description points to the type, since the
- type was not registered at the time of creating the fault, we
- need to set the type
- */
- ParameterDesc parameter = (ParameterDesc) parameters.get(0);
- parameter.setTypeQName(qname);
+ ParameterDesc parameter = (ParameterDesc) parameters.get(0);
+ parameter.setTypeQName(qname);
- /*
- give each fault a unique name, the name will be used
- in the "<details>" section of the soapfault message
- */
- parameter.setQName(new QName(qname.getNamespaceURI(), qname.getLocalPart()+"Fault"));
- hasUserDefinedFaults = true;
- }
+ /*
+ give each fault a unique name, the name will be used
+ in the "<details>" section of the soapfault message
+ */
+ parameter.setQName(new QName(qname.getNamespaceURI(), qname.getLocalPart()+"Fault"));
+ hasUserDefinedFaults = true;
}
+ }
- if(hasUserDefinedFaults) {
- configureTypeMapping(sd, AxisFaultAdaptor.class, meth.getWrTargetNamespace());
- }
+ if(hasUserDefinedFaults) {
+ configureTypeMapping(sd, AxisFaultAdaptor.class, meth.getWrTargetNamespace());
}
+
+ System.out.println("========= operation description ' " + od.getName() + "'\n" + od + "\n==========\n");
}
return sd;
@@ -380,40 +389,22 @@
if(Void.TYPE.equals(type))
return null;
- // If type is holder or it is generic holder, strip it to its base type
- //type = TypeRegistrar.getUnderlyingType(type);
-
if(AxisTypeMappingMetaData.isBuiltInType(type))
return AxisTypeMappingMetaData.getBuiltInTypeQname(type);
+ /* todo: may need to register the holder type also? */
if(Holder.class.isAssignableFrom(type))
- /* todo: may need to register the holder type also? */
type = TypeRegistrar.getHoldersValueClass(type);
/* the type needs to be registered */
TypeMapping tm = desc.getTypeMapping();
- /*
- QName qname = tm.getTypeQName(type);
- System.out.println("###################################type: "
- + type.getCanonicalName() + " qname is: " + qname
- + " default namesapce: " + defaultNamespace);
- if (null == qname || // Not registered
- !qname.getNamespaceURI().equals(defaultNamespace)) {
- // registered but not in current namespace
- qname = generateQName(type, desc);
- qname = new QName(defaultNamespace, Types.getLocalNameFromFullName(type.getName()));
- System.out.println("CREATE QNAME: #############################type: " + type.getCanonicalName() + " qname is: " + qname);
- }
- */
- /* todo: move this to the constructor (?) */
BindingLookupService lookupService = new SystemTypeLookupService();
QName qname = lookupService.class2qname(type, defaultNamespace);
if(type.isArray()) {
/*
- * jongjinchoi@apache.org 2005-Mar-16 -- don't register array
- * serializer in document(bare or wrapped)/literal mode.
+ don't register array serializer in document(bare or wrapped)/literal mode.
*/
if(!tm.isRegistered(type, qname) && desc.getStyle() == Style.RPC && desc.getUse() == Use.ENCODED) {
tm.register(type, qname,
@@ -447,13 +438,11 @@
|| getDataHandlerClass().isAssignableFrom(type))) {
try {
/*
- * NOTE jcolwell@bea.com 2004-Oct-08 -- doing reflection
- * here in case AXIS was built without attachment
- * support.
+ Use reflection here in case Axis was built without attachment support.
*/
ClassLoader cl = ServiceDescriptionFactory.class.getClassLoader();
/*
- Loadclass could have been done in import also, but if there are no activation.jar then this would
+ cl.loadclass could have been done in import also, but if there are no activation.jar then this would
cause error when the class is loaded. To prevent that we load the class explicitly at this point.
if we had done the "new org.apache.axis.encoding.ser.JAFDataHandlerSerializerFactory"
then the class would have had dependecies to the org.apache... class which would not have worked in
@@ -470,18 +459,13 @@
tm.register(type, qname, sf, dsf);
}
catch(Exception e) {
- /* todo: log properly */
- e.printStackTrace();
+ LOGGER.info("Unable to find attachment serializers. Attachment support will be disabled. Cause: " + e, e);
}
}
/*
- * NOTE jcolwell@bea.com 2004-Dec-01 -- java.rmi.Remote is
- * prohibited by the jax-rpc spec
- *
- * NOTE jcolwell@bea.com 2004-Oct-11 -- restricting against
- * File, since it doesn't make sense to serialize as a bean. It
- * causes an infinite loop as it keeps returning itself from the
- * getAbsoluteFile and getCanonicalFile calls
+ - java.rmi.Remote is prohibited by the jax-rpc spec
+ - restricting against File, since it doesn't make sense to serialize as a bean. It
+ causes an infinite loop as it keeps returning itself from the getAbsoluteFile and getCanonicalFile calls
*/
else if(!Remote.class.isAssignableFrom(type) && !File.class.isAssignableFrom(type)) {
TypeDesc td = TypeDesc.getTypeDescForClass(type);
@@ -498,27 +482,26 @@
/*
type desc is used for java-xml mapping, make sure the class and all its super classes have a type desc defined.
*/
- if(null == td) {
+ if(td == null) {
td = new TypeDesc(type);
/*
create type descriptor for this class --- NOT its super classes at this point. add super class types.
*/
Class supa = type.getSuperclass();
- if((supa != null)
- && (supa != java.lang.Object.class)
- && (supa != java.lang.Exception.class)
- && (supa != java.lang.Throwable.class)
- && (supa != java.rmi.RemoteException.class)
- && (supa != org.apache.axis.AxisFault.class)) {
+ if(supa != null
+ && supa != java.lang.Object.class
+ && supa != java.lang.Exception.class
+ && supa != java.lang.Throwable.class
+ && supa != java.rmi.RemoteException.class
+ && supa != org.apache.axis.AxisFault.class) {
configureTypeMapping(desc, supa, defaultNamespace);
}
- // check to see if a type mapping was created for the
- // super class.
+
+ /* check to see if a type mapping was created for the super class */
superTd = TypeDesc.getTypeDescForClass(supa);
if(superTd != null) {
- // super class is a regular javabean with axis typedesc
+ /* super class is a regular javabean with axis typedesc */
superPd = superTd.getPropertyDescriptors();
- // this is mapping for all my super classes
}
td.setXmlType(qname);
TypeDesc.registerTypeDescForClass(type, td);
@@ -570,7 +553,7 @@
String ns = qname.getNamespaceURI();
/*
name space for the class if there is no parent find proper namespace for this element...
- we need to find out whihc class in the hierarchy the element came from once you know
+ we need to find out which class in the hierarchy the element came from once you know
where the element came form (which class) then you know the element's name space.
*/
if(superTd != null && superPd != null) {
Modified: beehive/trunk/wsm/src/core/org/apache/beehive/wsm/processor/checker/Jsr181AnnotationChecker.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/src/core/org/apache/beehive/wsm/processor/checker/Jsr181AnnotationChecker.java?rev=349854&r1=349853&r2=349854&view=diff
==============================================================================
--- beehive/trunk/wsm/src/core/org/apache/beehive/wsm/processor/checker/Jsr181AnnotationChecker.java (original)
+++ beehive/trunk/wsm/src/core/org/apache/beehive/wsm/processor/checker/Jsr181AnnotationChecker.java Tue Nov 29 16:56:01 2005
@@ -33,6 +33,7 @@
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.soap.SOAPMessageHandlers;
+import javax.jws.soap.SOAPBinding;
import javax.wsdl.factory.WSDLFactory;
import javax.wsdl.xml.WSDLReader;
import javax.wsdl.Definition;
@@ -49,7 +50,6 @@
import com.sun.mirror.declaration.ParameterDeclaration;
import com.sun.mirror.apt.Messager;
import com.sun.mirror.type.VoidType;
-import com.sun.mirror.type.ReferenceType;
import org.xml.sax.InputSource;
/**
@@ -87,6 +87,7 @@
public void check(TypeDeclaration typeDecl) {
if(typeDecl instanceof ClassDeclaration) {
+ _messager.printNotice("Checking web service implementation bean " + typeDecl.getSimpleName());
validateClassDeclaration((ClassDeclaration)typeDecl);
Collection<? extends MethodDeclaration> methods = typeDecl.getMethods();
@@ -95,6 +96,7 @@
}
}
else if(typeDecl instanceof InterfaceDeclaration) {
+ _messager.printNotice("Checking web service endpoint interface bean " + typeDecl.getSimpleName());
validateInterfaceDeclaration((InterfaceDeclaration)typeDecl);
Collection<? extends MethodDeclaration> methods = typeDecl.getMethods();
@@ -118,7 +120,9 @@
if(modifiers.contains(Modifier.FINAL))
_messager.printError("@WebService implementation bean must not be final");
- /* todo: check that this is an outer class */
+ /* ensure that this class is declared as an outer class */
+ if(classDecl.getDeclaringType() != null)
+ _messager.printError("@WebService implementation bean must be an outer class");
/* check for a default constructor */
boolean hasDefaultConstructor = false;
@@ -217,7 +221,6 @@
}
/* SOAPHandler annotations -- no validation required */
- /* SOAPBinding annotation -- no validation required */
/* HandlerChain annotation -- no validation required*/
}
@@ -237,7 +240,10 @@
private void validateMethod(MethodDeclaration methodDecl) {
+ WebMethod webMethod = methodDecl.getAnnotation(WebMethod.class);
Oneway oneway = methodDecl.getAnnotation(Oneway.class);
+ Collection<ParameterDeclaration> params = methodDecl.getParameters();
+
if(oneway != null) {
if(!(methodDecl.getReturnType() instanceof VoidType))
_messager.printError("@Oneway method " + methodDecl.getSimpleName() + " has illegal return type: " + methodDecl.getReturnType());
@@ -246,7 +252,6 @@
_messager.printError("@oneway method " + methodDecl.getSimpleName() + " can not declare exceptions");
/* ensure no OUT or INOUT parameters */
- Collection<ParameterDeclaration> params = methodDecl.getParameters();
for(ParameterDeclaration param : params) {
WebParam webParam = param.getAnnotation(WebParam.class);
@@ -259,19 +264,44 @@
}
}
- WebMethod webMethod = methodDecl.getAnnotation(WebMethod.class);
if(webMethod != null) {
-
- /* check public */
if(!(methodDecl.getModifiers().contains(Modifier.PUBLIC)))
_messager.printError("@WebMethod '" + methodDecl.getSimpleName() + "' must be public.");
- Collection<ReferenceType> exceptions = methodDecl.getThrownTypes();
- for(ReferenceType exception : exceptions) {
- /* todo: check not throwing RemoteException */
+ /* todo: JAX-RPC 1.1 section 5 validation */
+ }
+
+ /* implement section 6.1.2.2 checks for Style validation*/
+ SOAPBinding soapBinding = methodDecl.getDeclaringType().getAnnotation(SOAPBinding.class);
+ SOAPBinding.Style style = soapBinding != null ? soapBinding.style() : SOAPBinding.Style.DOCUMENT;
+ SOAPBinding.ParameterStyle parameterStyle = soapBinding != null ? soapBinding.parameterStyle() : SOAPBinding.ParameterStyle.WRAPPED;
+
+ if(style == SOAPBinding.Style.DOCUMENT) { // && parameterStyle == SOAPBinding.ParameterStyle.BARE) {
+ if(parameterStyle == SOAPBinding.ParameterStyle.BARE) {
+ if(oneway == null && methodDecl.getReturnType() instanceof VoidType)
+ _messager.printError("Document bare operation \"" + methodDecl.getSimpleName() + "\" must be declared oneway if it returns void");
+
+ int inParams = 0;
+ for(ParameterDeclaration paramDecl : params) {
+ WebParam webParam = paramDecl.getAnnotation(WebParam.class);
+ if(webParam == null || webParam.mode() == WebParam.Mode.IN)
+ inParams++;
+ }
+
+ if(inParams != 1)
+ _messager.printError("Document style operation \"" + methodDecl.getSimpleName() + "\" must have exactly one non-header IN parameter");
+ }
+ else if(parameterStyle == SOAPBinding.ParameterStyle.WRAPPED) {
+ /* no-op */
}
- /* todo: JAX-RPC 1.1 section 5 validation */
+ for(ParameterDeclaration paramDecl : params) {
+ WebParam webParam = paramDecl.getAnnotation(WebParam.class);
+ if(webParam != null && !webParam.header() && (webParam.mode() == WebParam.Mode.INOUT || webParam.mode() == WebParam.Mode.OUT))
+ _messager.printError("Document style operation \"" + methodDecl.getSimpleName() + "\" must not have a non-header OUT or INOUT parameter.");
+ }
+
+ /* todo: another check in 6.1.2.2 about the uniqueness of XML elements */
}
}
@@ -293,16 +323,9 @@
InputSource inputSource = new InputSource(inputStream);
WebService wsAnnot = typeDeclaration.getAnnotation(WebService.class);
-/*
- String serviceName = wsAnnot.serviceName();
- if(serviceName == null)
- serviceName = typeDeclaration.getSimpleName() + "Service";
-*/
-
String name = wsAnnot.name();
- if (name.equals("")) {
+ if (name.equals(""))
name = typeDeclaration.getSimpleName();
- }
Definition definition = wsdlReader.readWSDL(null, inputSource);
String targetNamespace = wsAnnot.targetNamespace();
Modified: beehive/trunk/wsm/src/core/org/apache/beehive/wsm/registration/TypeRegistrar.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/src/core/org/apache/beehive/wsm/registration/TypeRegistrar.java?rev=349854&r1=349853&r2=349854&view=diff
==============================================================================
--- beehive/trunk/wsm/src/core/org/apache/beehive/wsm/registration/TypeRegistrar.java (original)
+++ beehive/trunk/wsm/src/core/org/apache/beehive/wsm/registration/TypeRegistrar.java Tue Nov 29 16:56:01 2005
@@ -176,19 +176,15 @@
}
else if(t instanceof Class) {
if(Holder.class.isAssignableFrom((Class)t)) {
- // if type is not a holder type, there is no point to dig any deeper
Field[] publicFields = ((Class)t).getFields();
for(int i = 0; i < publicFields.length; i++) {
- if(0 == "value".compareTo(publicFields[i].getName())) {
- res = publicFields[i].getType();
- break;
- }
+ if(publicFields[i].getName().equals("value"))
+ return publicFields[i].getType();
}
}
else throw new RuntimeException("Invalid class. Type: " + t + " is not a holder.");
}
- // otherwise just return the type
return res;
}
Modified: beehive/trunk/wsm/test/src/junit-services/org/apache/beehive/wsm/axis/FakeWebService.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/test/src/junit-services/org/apache/beehive/wsm/axis/FakeWebService.java?rev=349854&r1=349853&r2=349854&view=diff
==============================================================================
--- beehive/trunk/wsm/test/src/junit-services/org/apache/beehive/wsm/axis/FakeWebService.java (original)
+++ beehive/trunk/wsm/test/src/junit-services/org/apache/beehive/wsm/axis/FakeWebService.java Tue Nov 29 16:56:01 2005
@@ -17,27 +17,23 @@
*/
package org.apache.beehive.wsm.axis;
+import java.math.BigDecimal;
import javax.jws.Oneway;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
+import javax.xml.rpc.holders.Holder;
import org.apache.beehive.wsm.axis.beans.ModeratelyComplexObject;
+import org.apache.beehive.wsm.holders.SessionIdHolder;
/**
- * ****************************************************************************
- * NOTE jcolwell@bea.com 2004-Sep-21 --
- * Add more methods and annotations to provide a thorough test of the
- * AXIS JSR-181 implementation.
- *
- * @author Jonathan Colwell
*/
-@WebService(
- name = "FakeName",
- serviceName = "FakeServiceName",
- targetNamespace = "http://fake.target.namespace/")
+@WebService(name = "FakeName",
+ serviceName = "FakeServiceName",
+ targetNamespace = "http://fake.target.namespace/")
@SOAPBinding(style = SOAPBinding.Style.RPC)
public class FakeWebService {
@@ -50,5 +46,10 @@
@WebMethod(operationName = "processThingy")
@Oneway
public void processModeratelyComplexObject(@WebParam(name = "thingy") ModeratelyComplexObject mco) {
+ }
+
+ @WebMethod
+ public void doParameterInHeader(
+ @WebParam(header=true, mode=WebParam.Mode.INOUT) SessionIdHolder sessionId) {
}
}
Added: beehive/trunk/wsm/test/src/junit-services/org/apache/beehive/wsm/beans/SessionIdType.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/test/src/junit-services/org/apache/beehive/wsm/beans/SessionIdType.java?rev=349854&view=auto
==============================================================================
--- beehive/trunk/wsm/test/src/junit-services/org/apache/beehive/wsm/beans/SessionIdType.java (added)
+++ beehive/trunk/wsm/test/src/junit-services/org/apache/beehive/wsm/beans/SessionIdType.java Tue Nov 29 16:56:01 2005
@@ -0,0 +1,35 @@
+/**
+ Copyright 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.
+
+ $Header:$
+ */
+package org.apache.beehive.wsm.beans;
+
+import java.math.BigDecimal;
+
+/**
+ *
+ */
+public class SessionIdType {
+ private BigDecimal _sessionId;
+
+ public BigDecimal getSessionId() {
+ return _sessionId;
+ }
+
+ public void setSessionId(BigDecimal sessionId) {
+ _sessionId = sessionId;
+ }
+}
Propchange: beehive/trunk/wsm/test/src/junit-services/org/apache/beehive/wsm/beans/SessionIdType.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/wsm/test/src/junit-services/org/apache/beehive/wsm/holders/SessionIdHolder.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/test/src/junit-services/org/apache/beehive/wsm/holders/SessionIdHolder.java?rev=349854&view=auto
==============================================================================
--- beehive/trunk/wsm/test/src/junit-services/org/apache/beehive/wsm/holders/SessionIdHolder.java (added)
+++ beehive/trunk/wsm/test/src/junit-services/org/apache/beehive/wsm/holders/SessionIdHolder.java Tue Nov 29 16:56:01 2005
@@ -0,0 +1,30 @@
+/**
+ Copyright 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.
+
+ $Header:$
+ */
+package org.apache.beehive.wsm.holders;
+
+import javax.xml.rpc.holders.Holder;
+
+import org.apache.beehive.wsm.beans.SessionIdType;
+
+/**
+ *
+ */
+public class SessionIdHolder
+ implements Holder {
+ public SessionIdType value;
+}
Propchange: beehive/trunk/wsm/test/src/junit-services/org/apache/beehive/wsm/holders/SessionIdHolder.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/wsm/test/src/junit/org/apache/beehive/wsm/axis/handlers/AnnotatedWebServiceDeploymentHandlerTest.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/test/src/junit/org/apache/beehive/wsm/axis/handlers/AnnotatedWebServiceDeploymentHandlerTest.java?rev=349854&r1=349853&r2=349854&view=diff
==============================================================================
--- beehive/trunk/wsm/test/src/junit/org/apache/beehive/wsm/axis/handlers/AnnotatedWebServiceDeploymentHandlerTest.java (original)
+++ beehive/trunk/wsm/test/src/junit/org/apache/beehive/wsm/axis/handlers/AnnotatedWebServiceDeploymentHandlerTest.java Tue Nov 29 16:56:01 2005
@@ -33,6 +33,18 @@
public class AnnotatedWebServiceDeploymentHandlerTest
extends TestCase {
+ public void testHeaderParamService()
+ throws Exception {
+ final String className =
+ "org.apache.beehive.wsm.axis.FakeWebService"; // rpc style web service
+
+ AnnotatedWebServiceDeploymentHandler hdlr = new AnnotatedWebServiceDeploymentHandler();
+ Class clazz = Class.forName(className);
+ SOAPService fakeSOAPService = hdlr.getSOAPService(clazz);
+
+ System.out.println("===\n" + fakeSOAPService + "\n===\n");
+ }
+
public void testInvokeRPCSOAPService()
throws Exception {
final String classname = "org.apache.beehive.wsm.axis.FakeWebService"; // rpc style web service
Modified: beehive/trunk/wsm/test/src/junit/org/apache/beehive/wsm/test/axis/AxisHookTest.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/test/src/junit/org/apache/beehive/wsm/test/axis/AxisHookTest.java?rev=349854&r1=349853&r2=349854&view=diff
==============================================================================
--- beehive/trunk/wsm/test/src/junit/org/apache/beehive/wsm/test/axis/AxisHookTest.java (original)
+++ beehive/trunk/wsm/test/src/junit/org/apache/beehive/wsm/test/axis/AxisHookTest.java Tue Nov 29 16:56:01 2005
@@ -215,8 +215,11 @@
public static class FakeWebService {
- // a method with an exception just to test exception processing in ServiceDescriptionFactory
- public String fakeWayWebMethodWithException(javax.xml.rpc.holders.IntHolder num) throws NumberFormatException, MyException {
+ /*
+ a method with an exception just to test exception processing in ServiceDescriptionFactory
+ */
+ public String fakeWayWebMethodWithException(javax.xml.rpc.holders.IntHolder num)
+ throws NumberFormatException, MyException {
return "You're number " + num.value + '!';
}
@@ -225,7 +228,6 @@
}
public void fakeOneWayWebMethod(Boolean b) {
- //do nothing
}
}