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/16 08:38:04 UTC
svn commit: r344941 [1/2] - in /beehive/trunk/wsm:
src/axis/org/apache/beehive/wsm/axis/
src/axis/org/apache/beehive/wsm/axis/handlers/ test/
test/src/junit-server/org/apache/beehive/wsm/test/axis/wsdl/
test/src/junit-server/org/apache/beehive/wsm/test...
Author: ekoneil
Date: Tue Nov 15 23:37:49 2005
New Revision: 344941
URL: http://svn.apache.org/viewcvs?rev=344941&view=rev
Log:
WSM bug fixing...
- fix for BEEHIVE-745 is included here
- DRT for BEEHIVE-745
- rename AxisHook to ServiceDescriptionFactory
- move some test code around so the logic to build URLs to WSDLs is reusable
BB: self
Test: WSM DRT and service control DRT pass
Added:
beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/ServiceDescriptionFactory.java (contents, props changed)
- copied, changed from r344381, beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/AxisHook.java
beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/misc/
beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/misc/OverloadedOperationsTest.java (with props)
beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/util/
beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/util/Util.java (contents, props changed)
- copied, changed from r344375, beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/axis/wsdl/Util.java
beehive/trunk/wsm/test/src/junit/log4j.xml (with props)
beehive/trunk/wsm/test/webapp/src-ws/webservice/OverloadedOperations.java (with props)
beehive/trunk/wsm/test/webapp/src/org/apache/beehive/wsm/test/beans/
beehive/trunk/wsm/test/webapp/src/org/apache/beehive/wsm/test/documents/
beehive/trunk/wsm/test/webapp/src/org/apache/beehive/wsm/test/documents/PingDocument.java (with props)
beehive/trunk/wsm/test/webapp/src/org/apache/beehive/wsm/test/headers/
beehive/trunk/wsm/test/webapp/src/org/apache/beehive/wsm/test/headers/SecurityHeader.java (with props)
beehive/trunk/wsm/test/webapp/src/org/apache/beehive/wsm/test/holders/
beehive/trunk/wsm/test/webapp/src/org/apache/beehive/wsm/test/holders/PingDocumentHolder.java (with props)
Removed:
beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/AxisHook.java
beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/axis/wsdl/Util.java
Modified:
beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/AxisFaultAdaptor.java
beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/handlers/AnnotatedWebServiceDeploymentHandler.java
beehive/trunk/wsm/test/build.xml
beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/axis/wsdl/OnewayTest.java
beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/axis/wsdl/WebMethodActionTest.java
beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/axis/wsdl/WebMethodOperationNameTest.java
beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/axis/wsdl/WebMethodOverrideTest.java
beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/axis/wsdl/WebServiceNameTest.java
beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/axis/wsdl/WebServiceServiceNameTest.java
beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/axis/wsdl/WebServiceTargetNamespaceTest.java
beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/controls/SimpleControlsTest.java
beehive/trunk/wsm/test/src/junit-services/org/apache/beehive/wsm/axis/FakeDocWebService.java
beehive/trunk/wsm/test/src/junit/org/apache/beehive/wsm/axis/handlers/FaultTest.java
beehive/trunk/wsm/test/src/junit/org/apache/beehive/wsm/test/axis/AxisHookTest.java
Modified: beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/AxisFaultAdaptor.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/AxisFaultAdaptor.java?rev=344941&r1=344940&r2=344941&view=diff
==============================================================================
--- beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/AxisFaultAdaptor.java (original)
+++ beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/AxisFaultAdaptor.java Tue Nov 15 23:37:49 2005
@@ -21,6 +21,7 @@
import org.apache.axis.AxisFault;
import org.apache.axis.Constants;
import org.apache.axis.MessageContext;
+import org.apache.axis.encoding.SerializationContext;
import org.apache.axis.description.FaultDesc;
import org.apache.axis.description.ParameterDesc;
@@ -58,12 +59,13 @@
/**
* Writes the exception data to the faultDetails
*/
- public void writeDetails(javax.xml.namespace.QName qname, org.apache.axis.encoding.SerializationContext context)
+ public void writeDetails(QName qname, SerializationContext context)
throws java.io.IOException {
FaultDesc fd = null;
QName faultQname = null;
assert _msgContext != null : "Found null MessageContext";
+
fd = _msgContext.getOperation().getFaultByClass(_origExp.getClass());
assert fd != null : "Received null FaultDesc";
Copied: beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/ServiceDescriptionFactory.java (from r344381, beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/AxisHook.java)
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/ServiceDescriptionFactory.java?p2=beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/ServiceDescriptionFactory.java&p1=beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/AxisHook.java&r1=344381&r2=344941&rev=344941&view=diff
==============================================================================
--- beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/AxisHook.java (original)
+++ beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/ServiceDescriptionFactory.java Tue Nov 15 23:37:49 2005
@@ -67,58 +67,79 @@
import org.apache.xmlbeans.XmlObject;
/**
+ * This class is used from the AnnotatedWebServiceDeploymentHandler to produce an Axis
+ * {@link ServiceDesc} object. The service description is built from the description
+ * of a JSR-181 compliant annotated web service.
*/
-public class AxisHook {
+public final class ServiceDescriptionFactory {
- private static Log LOGGER = LogFactory.getLog(AxisHook.class);
+ private static Log LOGGER = LogFactory.getLog(ServiceDescriptionFactory.class);
- public static ServiceDesc createServiceDesc(BeehiveWsTypeMetadata wsm, ClassLoader cl)
+ public static ServiceDescriptionFactory getInstance() {
+ return new ServiceDescriptionFactory();
+ }
+
+ /* Do not construct */
+ private ServiceDescriptionFactory() {}
+
+ public ServiceDesc createServiceDescription(BeehiveWsTypeMetadata wsm, ClassLoader cl)
throws ClassNotFoundException, InvalidTypeMappingException {
JavaServiceDesc sd = new JavaServiceDesc();
- if(null == cl) {
- // If no classloader was provided, use the one that loaded this Class
- cl = AxisHook.class.getClassLoader();
- }
+ /*
+ If no classloader was provided, use the one that loaded this Class
+ */
+ if(cl == null)
+ cl = ServiceDescriptionFactory.class.getClassLoader();
+
final Class serviceClass = cl.loadClass(wsm.getServiceClassName());
- // Create a list of the allowed methods
+ /*
+ Create a list of the allowed methods
+ */
List<String> allowedMethods = new ArrayList<String>();
for(BeehiveWsMethodMetadata meth : wsm.getMethods()) {
String method = meth.getJavaMethodName();
allowedMethods.add(method);
}
- // set the ServiceDesc base information
+ /*
+ set the ServiceDesc base information
+ */
sd.setName(wsm.getName());
sd.setImplClass(serviceClass);
+
String targetNamespace = wsm.getTargetNamespace();
sd.setDefaultNamespace(targetNamespace);
sd.setAllowedMethods(allowedMethods);
configureSoapBinding(sd, wsm.getSoapBinding());
TypeMappingRegistry tmr = new TypeMappingRegistryImpl(true);
- TypeMapping tm = tmr.getOrMakeTypeMapping
- (sd.getUse() == Use.ENCODED ? "http://schemas.xmlsoap.org/soap/encoding/" : "");
+ TypeMapping tm = tmr.getOrMakeTypeMapping(sd.getUse() == Use.ENCODED ? "http://schemas.xmlsoap.org/soap/encoding/" : "");
sd.setTypeMappingRegistry(tmr);
sd.setTypeMapping(tm);
/*
- * jongjinchoi@apache.org 2005-Mar-16 -- Use Axis's introspection
- * feature instead of creating new OperationDesc and ParameterDescs
- * directly. The introspected OperationDesc and ParameterDescs are
- * overrided by WSM. When appropriate type mapping registry is set, Axis
- * fills the ParameterDesc's typeEntry from the preset typemapping
- * registry, which is required for Axis to work in wrapped/lit mode.
- */
+ * jongjinchoi@apache.org 2005-Mar-16 -- Use Axis's introspection
+ * feature instead of creating new OperationDesc and ParameterDescs
+ * directly. The introspected OperationDesc and ParameterDescs are
+ * overrided by WSM. When appropriate type mapping registry is set, Axis
+ * fills the ParameterDesc's typeEntry from the preset typemapping
+ * registry, which is required for Axis to work in wrapped/lit mode.
+ */
sd.getOperations();
- // Walk the methods
- for(BeehiveWsMethodMetadata meth : wsm.getMethods()) {
+ /*
+ Walk the methods
+ */
+ Collection<? extends BeehiveWsMethodMetadata> methods = wsm.getMethods();
+ for(BeehiveWsMethodMetadata meth : methods) {
String operationName = meth.getWmOperationName();
- if(null != operationName && 0 < operationName.length()) {
- // set the Operations properties
- OperationDesc od = sd.getOperationByName(meth.getJavaMethodName());
+
+ 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());
@@ -140,10 +161,10 @@
// 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 &&
+ if(wsm.getSoapBinding().getStyle() == SOAPBinding.Style.RPC &&
wsm.getSoapBinding().getUse() == SOAPBinding.Use.ENCODED) {
- if (odReturnType != null &&
+ if(odReturnType != null &&
!returnType.isArray() &&
Constants.URI_SOAP11_ENC.equals(odReturnType.getNamespaceURI()))
qn = odReturnType;
@@ -214,59 +235,102 @@
pd.setJavaType(paramType);
}
- // set Exceptions
+ /*
+ Configure exceptions
+ */
Method javaMethod = od.getMethod();
boolean hasUserDefinedFaults = false;
for(Class thrown : javaMethod.getExceptionTypes()) {
FaultDesc fd = od.getFaultByClass(thrown);
+
if(null == fd) {
- LOGGER.info("Exception: "
+ String message =
+ "Exception: "
+ thrown.getCanonicalName()
- + " is not picked up by the Axis, only non Remote and Application Specific exceptions are registed in Axis. This is not a fatal error.");
+ + " 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;
}
+
QName qname = configureTypeMapping(sd, thrown, meth.getWrTargetNamespace());
fd.setXmlType(qname);
fd.setQName(qname);
fd.setComplex(true);
-
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
/*
- * comments form Axis JavaServiceDesc class (around line
- * 1366)
- * // Parameters // We add a single parameter which
- * points to the type if (fault.getParameters() == null) {
- * if (xmlType == 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
+ 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);
- // 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"));
+ /*
+ 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());
+ }
}
}
+
return sd;
}
+ private OperationDesc getOperationDesc(ServiceDesc serviceDescription, BeehiveWsMethodMetadata methodMetadata) {
+ assert serviceDescription != null;
+ assert methodMetadata != null;
+
+ OperationDesc[] operations = serviceDescription.getOperationsByName(methodMetadata.getJavaMethodName());
+ assert operations.length >= 1;
+
+ /*
+ Short-circuit for the common case. Assume that a single operation that matches in name is the
+ correct one.
+ */
+ if(operations.length == 1)
+ return operations[0];
+
+ List methodParams = methodMetadata.getParams();
+ for(int i = 0; i < operations.length; i++) {
+ OperationDesc opDesc = operations[i];
+
+ int paramCount = methodParams.size();
+ if(paramCount == opDesc.getNumParams()) {
+ boolean match = true;
+ for(int j = 0; j < paramCount; j++) {
+ ParameterDesc paramDesc = opDesc.getParameter(j);
+ BeehiveWsParameterMetadata wsParam = (BeehiveWsParameterMetadata)methodParams.get(j);
+
+ assert paramDesc != null;
+ assert wsParam != null;
+
+ if(!(wsParam.getJavaType().equals(paramDesc.getJavaType().getName()))) {
+ match = false;
+ break;
+ }
+ }
+
+ if(match)
+ return opDesc;
+ }
+ }
+
+ return null;
+ }
+
/**
* This method will return a boolean value indicating that Activation is
* enabled. Activation requires the DataHandler and the Multipart Classes to
@@ -274,7 +338,7 @@
*
* @return boolean indicating that Activation is enabled.
*/
- private static boolean isActivationEnabled() {
+ private boolean isActivationEnabled() {
return null != getDataHandlerClass() && null != getMultipartClass();
}
@@ -284,9 +348,9 @@
*
* @return The DataHandler Class or null if the DataHandler is not found
*/
- private static Class getDataHandlerClass() {
+ private Class getDataHandlerClass() {
try {
- return AxisHook.class.getClassLoader().loadClass("javax.activation.DataHandler");
+ return ServiceDescriptionFactory.class.getClassLoader().loadClass("javax.activation.DataHandler");
}
catch(ClassNotFoundException e) {
/* todo: this should log a warning */
@@ -300,10 +364,9 @@
*
* @return The MimeMultipart Class or null if the DataHandler is not found.
*/
- private static Class getMultipartClass() {
+ private Class getMultipartClass() {
try {
- return AxisHook.class.getClassLoader().loadClass(
- "javax.mail.internet.MimeMultipart");
+ return ServiceDescriptionFactory.class.getClassLoader().loadClass("javax.mail.internet.MimeMultipart");
}
catch(ClassNotFoundException e) {
/* todo: this should log a warning */
@@ -311,281 +374,237 @@
return null;
}
- private static QName configureTypeMapping(ServiceDesc desc, Class type, String defaultNameSpace)
+ private QName configureTypeMapping(ServiceDesc desc, Class type, String defaultNamespace)
throws InvalidTypeMappingException {
- try {
- 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);
+ 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);
+
+ 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.
+ */
+ if(!tm.isRegistered(type, qname) && desc.getStyle() == Style.RPC && desc.getUse() == Use.ENCODED) {
+ tm.register(type, qname,
+ new ArraySerializerFactory(type, qname),
+ new ArrayDeserializerFactory());
}
- if(Holder.class.isAssignableFrom(type)) {
- type = TypeRegistrar.getHoldersValueClass(type);
- // NOTE: May need to register the holder type also.
+ if (desc.getStyle() == Style.RPC) {
+ configureTypeMapping(desc, type.getComponentType(), defaultNamespace);
+ return XMLType.SOAP_ARRAY;
}
- // if type needs to be registered
- TypeMapping tm = desc.getTypeMapping();
- // QName q = tm.getTypeQName(type);
- // System.out.println("###################################type: "
- // + type.getCanonicalName() + " qname is: " + q
- // + " default namesapce: " + defaultNameSpace);
- // if (null == q || // Not registered
- // !q.getNamespaceURI().equals(defaultNameSpace)) { // registered
- // // but not
- // // in
- // // current
- // // namespace
- // // q = generateQName(type, desc);
- // q = new QName(defaultNameSpace, Types
- // .getLocalNameFromFullName(type.getName()));
- // System.out
- // .println("CREATE QNAME: #############################type: "
- // + type.getCanonicalName() + " qname is: " + q);
- // }
+ QName qcomp = configureTypeMapping(desc, type.getComponentType(), defaultNamespace);
+ if(desc.getUse() == Use.LITERAL)
+ qname = qcomp;
+ }
+ else if(!tm.isRegistered(type, qname)) {
+ if(XmlObject.class.isAssignableFrom(type)) {
+ qname = XmlBeans.typeForClass(type).getName();
+ tm.register(type, qname,
+ new XmlBeanSerializerFactory(type, qname),
+ new XmlBeanDeserializerFactory(type, qname));
+ }
+ /*
+ * NOTE jcolwell@bea.com 2004-Oct-11 -- these datahandler using
+ * classes are generally already registered but just in case...
+ */
+ else if(isActivationEnabled() &&
+ (java.awt.Image.class.isAssignableFrom(type)
+ || getMultipartClass().isAssignableFrom(type)
+ || getDataHandlerClass().isAssignableFrom(type))) {
+ try {
+ /*
+ * NOTE jcolwell@bea.com 2004-Oct-08 -- doing 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
+ 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
+ case activation was not on the path.
+ */
+ Class<SerializerFactory> sfClass =
+ (Class<SerializerFactory>)cl.loadClass("org.apache.axis.encoding.ser.JAFDataHandlerSerializerFactory");
+ Class<DeserializerFactory> dsfClass =
+ (Class<DeserializerFactory>)cl.loadClass("org.apache.axis.encoding.ser.JAFDataHandlerDeserializerFactory");
+ Constructor<SerializerFactory> sfCon = sfClass.getConstructor(Class.class, QName.class);
+ Constructor<DeserializerFactory> dsfCon = dsfClass.getConstructor(Class.class, QName.class);
+ SerializerFactory sf = sfCon.newInstance(type, qname);
+ DeserializerFactory dsf = dsfCon.newInstance(type, qname);
+ tm.register(type, qname, sf, dsf);
+ }
+ catch(Exception e) {
+ /* todo: log properly */
+ e.printStackTrace();
+ }
+ }
+ /*
+ * 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
+ */
+ else if(!Remote.class.isAssignableFrom(type) && !File.class.isAssignableFrom(type)) {
+ TypeDesc td = TypeDesc.getTypeDescForClass(type);
- BindingLookupService lookupService = new SystemTypeLookupService(); // move this to the constructor
- QName q = lookupService.class2qname(type, defaultNameSpace);
+ /*
+ if type was registered in a different namespace, then ignore this and create a new td
+ */
+ if(td != null && !td.getXmlType().getNamespaceURI().equals(qname.getNamespaceURI())) {
+ td = null;
+ }
- if(type.isArray()) {
+ TypeDesc superTd = null;
+ BeanPropertyDescriptor[] superPd = null;
/*
- * jongjinchoi@apache.org 2005-Mar-16 -- don't register array
- * serializer in document(bare or wrapped)/literal mode.
- */
- if(!tm.isRegistered(type, q) && desc.getStyle() == Style.RPC && desc.getUse() == Use.ENCODED) {
- tm.register(type,
- q,
- new ArraySerializerFactory(type, q),
- new ArrayDeserializerFactory());
- }
-
- if (desc.getStyle() == Style.RPC) {
- configureTypeMapping(desc, type.getComponentType(), defaultNameSpace);
- return XMLType.SOAP_ARRAY;
- }
-
- QName qcomp = configureTypeMapping(desc, type.getComponentType(), defaultNameSpace);
- if(desc.getUse() == Use.LITERAL) {
- q = qcomp;
+ 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) {
+ 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)) {
+ configureTypeMapping(desc, supa, defaultNamespace);
+ }
+ // 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
+ superPd = superTd.getPropertyDescriptors();
+ // this is mapping for all my super classes
+ }
+ td.setXmlType(qname);
+ TypeDesc.registerTypeDescForClass(type, td);
+ /*
+ NOTE: this is partially finished td, so more processing to follow that is why its td is not set to
+ null as it is for the case when it is already provided (when td !=null)
+ */
}
- }
- else if(!tm.isRegistered(type, q)) {
- if(XmlObject.class.isAssignableFrom(type)) {
- q = XmlBeans.typeForClass(type).getName();
- tm.register(type,
- q,
- new XmlBeanSerializerFactory(type, q),
- new XmlBeanDeserializerFactory(type, q));
+ else {
+ /*
+ we don't need type desc. any more this is a complete td
+ */
+ td = null;
}
/*
- * NOTE jcolwell@bea.com 2004-Oct-11 -- these datahandler using
- * classes are generally already registered but just in case...
- */
- else if(isActivationEnabled() &&
- (java.awt.Image.class.isAssignableFrom(type) ||
- getMultipartClass().isAssignableFrom(type) ||
- getDataHandlerClass().isAssignableFrom(type))) {
- try {
- /*
- * NOTE jcolwell@bea.com 2004-Oct-08 -- doing reflection
- * here in case AXIS was built without attachment
- * support.
- */
- ClassLoader cl = AxisHook.class.getClassLoader();
- // 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 case activation was
- // not on the path.
- Class<SerializerFactory> sfClass =
- (Class<SerializerFactory>)cl.loadClass
- ("org.apache.axis.encoding.ser.JAFDataHandlerSerializerFactory");
- Class<DeserializerFactory> dsfClass =
- (Class<DeserializerFactory>)cl.loadClass
- ("org.apache.axis.encoding.ser.JAFDataHandlerDeserializerFactory");
- Constructor<SerializerFactory> sfCon = sfClass.getConstructor(Class.class, QName.class);
- Constructor<DeserializerFactory> dsfCon =
- dsfClass.getConstructor(Class.class, QName.class);
- SerializerFactory sf = sfCon.newInstance(type, q);
- DeserializerFactory dsf = dsfCon.newInstance(type, q);
- tm.register(type, q, sf, dsf);
- }
- catch(Exception e) {
- /*
- * FIXME jcolwell@bea.com 2004-Oct-08 -- log this
- * properly
- */
- e.printStackTrace();
- }
- }
+ At this all parent bean classes and their properties
+ (attributes) have been registered with typedecriptor and
+ type mapping. next regidster type for this class.
+ */
+ tm.register(type,
+ qname,
+ new EnhancedBeanSerializerFactory(type, qname, td),
+ new EnhancedBeanDeserializerFactory(type, qname, td));
+
/*
- * 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
+ now register the types for this bean properties (attributes)
+ Note: we have to consider the case that one of the properties may be XML bean
+ or a class that can deal with its own serialization.
*/
- else if(!Remote.class.isAssignableFrom(type) && !File.class.isAssignableFrom(type)) {
- TypeDesc td = TypeDesc.getTypeDescForClass(type);
- // if type was registered in a different namespace, then
- // ignore this and create a new td
- if(td != null && !td.getXmlType().getNamespaceURI().equals(q.getNamespaceURI())) {
- td = null;
- }
-
- TypeDesc superTd = null;
- BeanPropertyDescriptor[] superPd = null;
- // 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) {
- 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)) {
- configureTypeMapping(desc, supa, defaultNameSpace);
- }
- // 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
- superPd = superTd.getPropertyDescriptors();
- // this is mapping for all my super classes
- }
- td.setXmlType(q);
- TypeDesc.registerTypeDescForClass(type, td);
- // NOTE: this is partially finished td, so more
- // processing to follow that is why its td is not set to
- // null as it is
- // for the case when it is already provided (when td
- // !=null)
- }
- else {
- // we don't need type desc. any more this is a complete td
- td = null;
- }
- //
- // // At this all parent bean classes and their properties
- // // (attributes) have been registered with typedecriptor
- // and
- // // type mapping.
- // // next regidster type for this class.
- // tm.register(type, q, new BeanSerializerFactory(type, q),
- // /*
- // * NOTE jcolwell@bea.com 2004-Oct-11 -- should check that
- // * the type to deserialize has a default contructor but
- // with
- // * this setup there is no way to know if it is used only
- // in
- // * serialization.
- // */
- // new BeanDeserializerFactory(type, q));
-
- // At this all parent bean classes and their properties
- // (attributes) have been registered with typedecriptor and
- // type mapping.
- // next regidster type for this class.
- tm.register(type,
- q,
- new EnhancedBeanSerializerFactory(type, q, td),
- /*
- * NOTE jcolwell@bea.com 2004-Oct-11 -- should check that
- * the type to deserialize has a default contructor but with
- * this setup there is no way to know if it is used only in
- * serialization.
- */
- new EnhancedBeanDeSerializerFactory(type, q, td));
-
- // now register the types for this bean properties
- // (attributes)
- // Note: we have to consider the case that one of the
- // properties may be XML bean
- // or a class that can deal with its own serialization.
-
- // Note this is all of the bean properties
- Map serProps = BeanDeserializerFactory.getProperties(type, null);
- for(BeanPropertyDescriptor beanProps : (Collection<BeanPropertyDescriptor>)serProps.values()) {
- Class subType = beanProps.getType();
- // make sure the property type is configred with Type
- // mapping and its serializer information
- if(!(subType.isPrimitive() ||
- subType.getName().startsWith("java.") ||
- subType.getName().startsWith("javax."))) {
- configureTypeMapping(desc, subType, defaultNameSpace);
- // if this was XML bean this recursion would take care of it
- }
+ /* Note this is all of the bean properties */
+ Map serProps = BeanDeserializerFactory.getProperties(type, null);
+ for(BeanPropertyDescriptor beanProps : (Collection<BeanPropertyDescriptor>)serProps.values()) {
+ Class subType = beanProps.getType();
+ // make sure the property type is configred with Type
+ // mapping and its serializer information
+ if(!(subType.isPrimitive() ||
+ subType.getName().startsWith("java.") ||
+ subType.getName().startsWith("javax."))) {
+ configureTypeMapping(desc, subType, defaultNamespace);
+ // if this was XML bean this recursion would take care of it
+ }
- if(td != null) {
- // if I didn't have type descriptor when I came to this method... I
- // created partially filled one above now need to complete this.
- String ns = q.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 where the element came form (which
- // class) then you know the element's name space.
- if(superTd != null && superPd != null) {
- // if I had a parent
- for(int j = 0; j < superPd.length; j++) {
- if(beanProps.getName().equals(superPd[j].getName())) {
- ns = superTd.getXmlType().getNamespaceURI();
- break;
- }
+ if(td != null) {
+ /*
+ if I didn't have type descriptor when I came to this method... I
+ created partially filled one above now need to complete this.
+ */
+ 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
+ where the element came form (which class) then you know the element's name space.
+ */
+ if(superTd != null && superPd != null) {
+ for(int j = 0; j < superPd.length; j++) {
+ if(beanProps.getName().equals(superPd[j].getName())) {
+ ns = superTd.getXmlType().getNamespaceURI();
+ break;
}
}
- FieldDesc fd = new ElementDesc();
- fd.setJavaType(subType);
- fd.setFieldName(beanProps.getName());
- fd.setXmlName(new QName(ns, beanProps.getName()));
- // NOTE jcolwell@bea.com 2004-Oct-28 -- might need
- // to do more to ensure a useful type QName.
- fd.setXmlType(tm.getTypeQName(subType));
- ((ElementDesc)fd).setNillable(true);
- // mmerz@apache.com 2005-Mar-09: required since Axis
- // 1.2RC3 to allow for null values in complex
- // objects; note that there is no (JSR-181)
- // annotation that allows configuring this value.
- td.addFieldDesc(fd);
}
+ FieldDesc fd = new ElementDesc();
+ fd.setJavaType(subType);
+ fd.setFieldName(beanProps.getName());
+ fd.setXmlName(new QName(ns, beanProps.getName()));
+ // NOTE jcolwell@bea.com 2004-Oct-28 -- might need to do more to ensure a useful type QName.
+ fd.setXmlType(tm.getTypeQName(subType));
+ ((ElementDesc)fd).setNillable(true);
+ // mmerz@apache.com 2005-Mar-09: required since Axis 1.2RC3 to allow for null values in complex
+ // objects; note that there is no (JSR-181) annotation that allows configuring this value.
+ td.addFieldDesc(fd);
}
}
- else {
- throw new InvalidTypeMappingException("failed to register "
- + type.getName()
- + " as a valid web service datatype,"
- + " consider using a custom type mapping");
- }
}
- return q;
-
- }
- catch(RuntimeException e) {
- LOGGER.error("Error in type registeration", e);
- throw e;
+ else {
+ throw new InvalidTypeMappingException("Unable to register "
+ + type.getName()
+ + " as a valid web service datatype, consider using a custom type mapping");
+ }
}
+
+ return qname;
}
- protected static void configureSoapBinding(ServiceDesc sd, BeehiveWsSOAPBindingInfo sbi) {
+ private void configureSoapBinding(ServiceDesc sd, BeehiveWsSOAPBindingInfo 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;
@@ -599,28 +618,23 @@
if(use == javax.jws.soap.SOAPBinding.Use.ENCODED) {
sd.setUse(Use.ENCODED);
}
- else {
- sd.setUse(Use.LITERAL);
- }
+ else sd.setUse(Use.LITERAL);
}
else {
/*
- * since DOCUMENT ENCODED is not valid so force to use LITERAL
+ since DOCUMENT ENCODED is not valid so force to use LITERAL
*/
sd.setUse(Use.LITERAL);
// check if this is a wrapped document literal
- if(paramStyle == javax.jws.soap.SOAPBinding.ParameterStyle.WRAPPED) {
+ if(paramStyle == javax.jws.soap.SOAPBinding.ParameterStyle.WRAPPED)
sd.setStyle(Style.WRAPPED);
- }
- else {
- // just regular document style
- sd.setStyle(Style.DOCUMENT);
- }
+ /* else regular document style */
+ else sd.setStyle(Style.DOCUMENT);
}
}
- private static Class createClass(String className) {
+ private Class createClass(String className) {
if(className == null)
throw new RuntimeException("Encountered a null class name!");
@@ -634,7 +648,6 @@
* given class can't be in multiple name spaces. In this solution the factory
* gets the type descriptor in the constructor
*/
-
class EnhancedBeanSerializerFactory
extends BeanSerializerFactory {
@@ -643,18 +656,16 @@
this.typeDesc = typeDesc;
- if(typeDesc != null) {
+ if(typeDesc != null)
propertyDescriptor = typeDesc.getPropertyDescriptors();
- }
- else {
- propertyDescriptor = BeanUtils.getPd(javaType, null);
- }
+ else propertyDescriptor = BeanUtils.getPd(javaType, null);
}
}
-class EnhancedBeanDeSerializerFactory
+class EnhancedBeanDeserializerFactory
extends BeanDeserializerFactory {
- public EnhancedBeanDeSerializerFactory(Class javaType, QName xmlType, TypeDesc typeDesc) {
+
+ public EnhancedBeanDeserializerFactory(Class javaType, QName xmlType, TypeDesc typeDesc) {
super(javaType, xmlType);
this.typeDesc = typeDesc;
Propchange: beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/ServiceDescriptionFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/handlers/AnnotatedWebServiceDeploymentHandler.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/handlers/AnnotatedWebServiceDeploymentHandler.java?rev=344941&r1=344940&r2=344941&view=diff
==============================================================================
--- beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/handlers/AnnotatedWebServiceDeploymentHandler.java (original)
+++ beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/handlers/AnnotatedWebServiceDeploymentHandler.java Tue Nov 15 23:37:49 2005
@@ -37,7 +37,7 @@
import org.apache.axis.handlers.soap.SOAPService;
import org.apache.axis.providers.java.RPCProvider;
import org.apache.axis.utils.ClassUtils;
-import org.apache.beehive.wsm.axis.AxisHook;
+import org.apache.beehive.wsm.axis.ServiceDescriptionFactory;
import org.apache.beehive.wsm.axis.controls.ControlProvider;
import org.apache.beehive.wsm.model.BeehiveWsSOAPMessageHandlerInfo;
import org.apache.beehive.wsm.model.BeehiveWsTypeMetadata;
@@ -141,39 +141,37 @@
ss = new SOAPService(null, new ControlProvider(), null);
// Add jaxrpc handlers if there are any.
- HandlerInfoChainFactory jaxrpcChain;
- if(null != (jaxrpcChain = getJaxRPCHandlerChainFactory(wsm))) {
+ HandlerInfoChainFactory jaxrpcChain = getJaxRPCHandlerChainFactory(wsm);
+ if(jaxrpcChain != null)
ss.setOption(Constants.ATTR_HANDLERINFOCHAIN, jaxrpcChain);
- }
ss.setName(wsm.getName());
ss.setOption(RPCProvider.OPTION_CLASSNAME, cls.getName());
- // Take the setting for the scope option from the handler
- // parameter named "scope"
+ // Take the setting for the scope option from the handler parameter named "scope"
String scope = (String)getOption(RPCProvider.OPTION_SCOPE);
- if(null == scope) {
+ if(null == scope)
scope = "Request";
- }
+
ss.setOption(RPCProvider.OPTION_SCOPE, scope);
- ServiceDesc sd = AxisHook.createServiceDesc(wsm, cls.getClassLoader());
+ ServiceDesc sd = ServiceDescriptionFactory.getInstance().createServiceDescription(wsm, cls.getClassLoader());
ss.setServiceDescription(sd);
+
List allowedMethodNames = sd.getAllowedMethods();
- Iterator allowIt = allowedMethodNames.iterator();
+ Iterator allowedMethods = allowedMethodNames.iterator();
/*
todo: can StringBuilder be used here since there's no need for synchronization?
- todo: can the output String be cached? Presumably, the lsit of
- methods doesn't change for a single deploymentx
+ todo: can the output String be cached? Presumably, the list of methods doesn't change for a single deploymentx
*/
StringBuffer sb = new StringBuffer();
- boolean firstPass = true;
- while(allowIt.hasNext()) {
- if(firstPass) {
+ boolean first = true;
+ while(allowedMethods.hasNext()) {
+ if(!first)
sb.append(' ');
- firstPass = false;
- }
- sb.append(((String)allowIt.next()));
+ sb.append(allowedMethods.next());
+ first = false;
}
+
ss.setOption(RPCProvider.OPTION_ALLOWEDMETHODS, sb.toString());
ss.setOption(RPCProvider.OPTION_WSDL_PORTTYPE, wsm.getName());
ss.setOption(RPCProvider.OPTION_WSDL_SERVICEPORT, wsm.getName());
@@ -237,8 +235,7 @@
else
className = relativePath.substring(1, relativePath.length()).replaceAll("/", ".");
- // load class
- LOGGER.debug("trying to load web service class: " + className);
+ LOGGER.debug("attempt to load web service class: " + className);
Class clazz = Jsr181ObjectModelStore.loadWebServiceClass(className);
if(null == clazz)
Modified: beehive/trunk/wsm/test/build.xml
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/test/build.xml?rev=344941&r1=344940&r2=344941&view=diff
==============================================================================
--- beehive/trunk/wsm/test/build.xml (original)
+++ beehive/trunk/wsm/test/build.xml Tue Nov 15 23:37:49 2005
@@ -56,6 +56,7 @@
<path refid="commons-discovery.dependency.path"/>
<path refid="commons-logging.dependency.path"/>
<path refid="controls.dependency.path"/>
+ <path refid="log4j.dependency.path"/>
<pathelement location="../build/jars/beehive-jsr181.jar"/>
<pathelement location="../build/jars/beehive-wsdltypes.jar"/>
<pathelement location="../build/jars/beehive-wsm.jar"/>
Modified: beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/axis/wsdl/OnewayTest.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/axis/wsdl/OnewayTest.java?rev=344941&r1=344940&r2=344941&view=diff
==============================================================================
--- beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/axis/wsdl/OnewayTest.java (original)
+++ beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/axis/wsdl/OnewayTest.java Tue Nov 15 23:37:49 2005
@@ -26,6 +26,7 @@
import javax.wsdl.xml.WSDLReader;
import junit.framework.TestCase;
+import org.apache.beehive.wsm.test.util.Util;
/**
* Unit tests around the Oneway annotation.
Modified: beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/axis/wsdl/WebMethodActionTest.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/axis/wsdl/WebMethodActionTest.java?rev=344941&r1=344940&r2=344941&view=diff
==============================================================================
--- beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/axis/wsdl/WebMethodActionTest.java (original)
+++ beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/axis/wsdl/WebMethodActionTest.java Tue Nov 15 23:37:49 2005
@@ -27,6 +27,7 @@
import javax.wsdl.xml.WSDLReader;
import junit.framework.TestCase;
+import org.apache.beehive.wsm.test.util.Util;
/**
* Unit tests around the WebMethod action attribute.
Modified: beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/axis/wsdl/WebMethodOperationNameTest.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/axis/wsdl/WebMethodOperationNameTest.java?rev=344941&r1=344940&r2=344941&view=diff
==============================================================================
--- beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/axis/wsdl/WebMethodOperationNameTest.java (original)
+++ beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/axis/wsdl/WebMethodOperationNameTest.java Tue Nov 15 23:37:49 2005
@@ -26,6 +26,7 @@
import javax.wsdl.xml.WSDLReader;
import junit.framework.TestCase;
+import org.apache.beehive.wsm.test.util.Util;
/**
* Unit tests around the WebMethod operationName attribute.
Modified: beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/axis/wsdl/WebMethodOverrideTest.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/axis/wsdl/WebMethodOverrideTest.java?rev=344941&r1=344940&r2=344941&view=diff
==============================================================================
--- beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/axis/wsdl/WebMethodOverrideTest.java (original)
+++ beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/axis/wsdl/WebMethodOverrideTest.java Tue Nov 15 23:37:49 2005
@@ -26,6 +26,7 @@
import javax.wsdl.xml.WSDLReader;
import junit.framework.TestCase;
+import org.apache.beehive.wsm.test.util.Util;
/**
* Unit tests around the Web service implicit versus explicit Web methods.
Modified: beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/axis/wsdl/WebServiceNameTest.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/axis/wsdl/WebServiceNameTest.java?rev=344941&r1=344940&r2=344941&view=diff
==============================================================================
--- beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/axis/wsdl/WebServiceNameTest.java (original)
+++ beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/axis/wsdl/WebServiceNameTest.java Tue Nov 15 23:37:49 2005
@@ -24,6 +24,7 @@
import javax.wsdl.xml.WSDLReader;
import junit.framework.TestCase;
+import org.apache.beehive.wsm.test.util.Util;
/**
* Unit tests around the WebService name attribute.
Modified: beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/axis/wsdl/WebServiceServiceNameTest.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/axis/wsdl/WebServiceServiceNameTest.java?rev=344941&r1=344940&r2=344941&view=diff
==============================================================================
--- beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/axis/wsdl/WebServiceServiceNameTest.java (original)
+++ beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/axis/wsdl/WebServiceServiceNameTest.java Tue Nov 15 23:37:49 2005
@@ -22,6 +22,7 @@
import javax.wsdl.xml.WSDLReader;
import junit.framework.TestCase;
+import org.apache.beehive.wsm.test.util.Util;
/**
* Unit tests around the WebService serviceName attribute.
Modified: beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/axis/wsdl/WebServiceTargetNamespaceTest.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/axis/wsdl/WebServiceTargetNamespaceTest.java?rev=344941&r1=344940&r2=344941&view=diff
==============================================================================
--- beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/axis/wsdl/WebServiceTargetNamespaceTest.java (original)
+++ beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/axis/wsdl/WebServiceTargetNamespaceTest.java Tue Nov 15 23:37:49 2005
@@ -20,6 +20,7 @@
import javax.wsdl.xml.WSDLReader;
import junit.framework.TestCase;
+import org.apache.beehive.wsm.test.util.Util;
/**
* Unit tests around the WebService targetNamespace attribute.
Modified: beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/controls/SimpleControlsTest.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/controls/SimpleControlsTest.java?rev=344941&r1=344940&r2=344941&view=diff
==============================================================================
--- beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/controls/SimpleControlsTest.java (original)
+++ beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/controls/SimpleControlsTest.java Tue Nov 15 23:37:49 2005
@@ -24,6 +24,7 @@
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
+import org.apache.beehive.wsm.test.util.Util;
import junit.framework.TestCase;
@@ -37,7 +38,7 @@
throws Exception {
/* todo: replace with some SOAPTestCase infrastructure */
- String endpoint = "http://localhost:8080/wsmWeb/webservice/ControlTestService.jws";
+ String endpoint = Util.buildUrl("/webservice/ControlTestService.jws");
System.out.println("endpoint URL: " + endpoint);
Added: beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/misc/OverloadedOperationsTest.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/misc/OverloadedOperationsTest.java?rev=344941&view=auto
==============================================================================
--- beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/misc/OverloadedOperationsTest.java (added)
+++ beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/misc/OverloadedOperationsTest.java Tue Nov 15 23:37:49 2005
@@ -0,0 +1,88 @@
+/**
+ 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.test.misc;
+
+import java.util.Map;
+import java.util.List;
+import java.util.Iterator;
+import javax.wsdl.xml.WSDLReader;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.Definition;
+import javax.wsdl.Service;
+import javax.wsdl.PortType;
+import javax.wsdl.Operation;
+import javax.wsdl.Port;
+
+import junit.framework.TestCase;
+import org.apache.beehive.wsm.test.util.Util;
+
+/**
+ *
+ */
+public class OverloadedOperationsTest
+ extends TestCase {
+
+ private WSDLReader _wsdlReader = null;
+
+ public void setUp() {
+ try {
+ _wsdlReader = WSDLFactory.newInstance().newWSDLReader();
+ }
+ catch(Exception e) {
+ throw new IllegalStateException("Could not create WSDLReader. Cause: " + e, e);
+ }
+ }
+
+ public void testUsed()
+ throws Exception {
+ Definition wsdl = _wsdlReader.readWSDL(null, Util.buildUrl("/webservice/OverloadedOperations.jws?wsdl"));
+ assertOperationName(wsdl, "PingOneWay");
+ assertOperationName(wsdl, "PingTwoWay");
+ assertOperationName(wsdl, "SecurePing");
+ }
+
+ /**
+ * Assuming one service, port, and operation for the given WSDL, this
+ * verifies that the operation name is set as expected.
+ */
+ private static void assertOperationName(Definition wsdl, String operationName) {
+ Map services = wsdl.getServices();
+ assertNotNull("services", services);
+ assertEquals(1, services.size());
+ Service service = (Service)services.values().toArray()[0];
+
+ Map ports = service.getPorts();
+ assertNotNull("ports", ports);
+ assertEquals(1, ports.size());
+ PortType portType =
+ ((Port)ports.values().toArray()[0]).getBinding().getPortType();
+
+ List operations = portType.getOperations();
+ assertNotNull("operations", operations);
+ assertEquals(3, operations.size());
+
+ Iterator iterator = operations.iterator();
+ while(iterator.hasNext()) {
+ Operation op = (Operation)iterator.next();
+ if (op.getName().equals(operationName))
+ return;
+ }
+
+ fail("Could not find operation in WSDL with name: " + operationName);
+ }
+}
Propchange: beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/misc/OverloadedOperationsTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Copied: beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/util/Util.java (from r344375, beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/axis/wsdl/Util.java)
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/util/Util.java?p2=beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/util/Util.java&p1=beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/axis/wsdl/Util.java&r1=344375&r2=344941&rev=344941&view=diff
==============================================================================
--- beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/axis/wsdl/Util.java (original)
+++ beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/util/Util.java Tue Nov 15 23:37:49 2005
@@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.beehive.wsm.test.axis.wsdl;
+package org.apache.beehive.wsm.test.util;
/**
*/
-final class Util {
+public final class Util {
private static final String KEY_WSM_TEST_URL = "wsm.test.url";
@@ -29,7 +29,7 @@
else return url;
}
- static String buildUrl(String uri) {
+ public static String buildUrl(String uri) {
return getBaseUrl() + uri;
}
}
Propchange: beehive/trunk/wsm/test/src/junit-server/org/apache/beehive/wsm/test/util/Util.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/wsm/test/src/junit-services/org/apache/beehive/wsm/axis/FakeDocWebService.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/test/src/junit-services/org/apache/beehive/wsm/axis/FakeDocWebService.java?rev=344941&r1=344940&r2=344941&view=diff
==============================================================================
--- beehive/trunk/wsm/test/src/junit-services/org/apache/beehive/wsm/axis/FakeDocWebService.java (original)
+++ beehive/trunk/wsm/test/src/junit-services/org/apache/beehive/wsm/axis/FakeDocWebService.java Tue Nov 15 23:37:49 2005
@@ -27,10 +27,7 @@
import org.apache.beehive.wsm.axis.exceptions.ComplexUserDefinedException;
import org.apache.beehive.wsm.axis.exceptions.SimpleUserDefinedException;
-@WebService(
- name = "FakeDocName",
- serviceName = "FakeDocServiceName",
- targetNamespace = "http://fake.target.namespace/")
+@WebService(name = "FakeDocName", serviceName = "FakeDocServiceName", targetNamespace = "http://fake.target.namespace/")
@SOAPBinding(style = SOAPBinding.Style.DOCUMENT)
public class FakeDocWebService {
Added: beehive/trunk/wsm/test/src/junit/log4j.xml
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/test/src/junit/log4j.xml?rev=344941&view=auto
==============================================================================
--- beehive/trunk/wsm/test/src/junit/log4j.xml (added)
+++ beehive/trunk/wsm/test/src/junit/log4j.xml Tue Nov 15 23:37:49 2005
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+
+<!--
+ <appender name="LOGFILE" class="org.apache.log4j.RollingFileAppender">
+ <param name="File" value="c:/tmp/wsmdrt.log"/>
+-->
+ <appender name="LOGFILE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Append" value="true"/>
+ <param name="MaxFileSize" value="500000KB"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d{DATE} %-5p %-15c{1} [%x]: %m%n"/>
+ </layout>
+ </appender>
+
+ <category name="org.apache.axis">
+ <priority value="trace"/>
+ <appender-ref ref="LOGFILE"/>
+ </category>
+
+ <category name="org.apache.beehive.wsm">
+ <priority value="trace"/>
+ <appender-ref ref="LOGFILE"/>
+ </category>
+
+</log4j:configuration>
Propchange: beehive/trunk/wsm/test/src/junit/log4j.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/wsm/test/src/junit/org/apache/beehive/wsm/axis/handlers/FaultTest.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/test/src/junit/org/apache/beehive/wsm/axis/handlers/FaultTest.java?rev=344941&r1=344940&r2=344941&view=diff
==============================================================================
--- beehive/trunk/wsm/test/src/junit/org/apache/beehive/wsm/axis/handlers/FaultTest.java (original)
+++ beehive/trunk/wsm/test/src/junit/org/apache/beehive/wsm/axis/handlers/FaultTest.java Tue Nov 15 23:37:49 2005
@@ -33,15 +33,18 @@
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
-public class FaultTest extends TestCase {
- private SOAPService fakeSOAPService;
+public class FaultTest
+ extends TestCase {
+
+ private SOAPService _fakeSOAPService;
public void setUp()
throws Exception {
- final String classname = "org.apache.beehive.wsm.axis.FakeDocWebService";
+ String classname = "org.apache.beehive.wsm.axis.FakeDocWebService";
+
AnnotatedWebServiceDeploymentHandler hdlr = new AnnotatedWebServiceDeploymentHandler();
Class clazz = Class.forName(classname);
- fakeSOAPService = hdlr.getSOAPService(clazz);
+ _fakeSOAPService = hdlr.getSOAPService(clazz);
}
public void testSimpleUserDefinedExceptions()
@@ -51,31 +54,27 @@
SOAPEnvelope env = new SOAPEnvelope();
env.addBodyElement(new RPCElement("doThrowSimpleUserDefinedFault"));
mc.setRequestMessage(new Message(env));
- mc.setService(fakeSOAPService);
+ mc.setService(_fakeSOAPService);
+
try {
- fakeSOAPService.invoke(mc);
- fail("The Expected exception didn't happen!");
+ _fakeSOAPService.invoke(mc);
+ fail("Failed to receive an expected exception type!");
}
- catch (AxisFault e) {} // expected a fault
+ catch (AxisFault e) {/* expected a fault */}
Message msg = mc.getResponseMessage();
msg.saveChanges();
assertNotNull(msg);
- System.out.println(msg.toString());
-
- SOAPFault n = (SOAPFault) msg.getSOAPBody().getFirstChild();
+ SOAPFault n = (SOAPFault)msg.getSOAPBody().getFirstChild();
MessageElement detail = n.getChildElement(new QName("detail"));
- System.out.println("message detail: " + detail.getAsString());
-
for (Iterator it = detail.getChildElements(); it.hasNext();) {
Element de = (Element)it.next();
String localName = de.getLocalName();
String namespace = de.getNamespaceURI();
if (localName.equals("SimpleUserDefinedExceptionFault") && namespace.equals("http://fake.target.namespace/")) {
NodeList nl = de.getChildNodes();
- System.out.println("length: " + nl.getLength());
assertTrue(nl.getLength() == 0);
return;
}
@@ -83,76 +82,76 @@
fail("Didn't find the exception name in the Fault detail");
}
- public void testComplexUserDefinedExceptions() throws Exception {
+ public void testComplexUserDefinedExceptions()
+ throws Exception {
MessageContext mc = new MessageContext(new AxisServer());
SOAPEnvelope env = new SOAPEnvelope();
env.addBodyElement(new RPCElement("doThrowComplexUserDefinedFault"));
mc.setRequestMessage(new Message(env));
- mc.setService(fakeSOAPService);
+ mc.setService(_fakeSOAPService);
try {
- fakeSOAPService.invoke(mc);
+ _fakeSOAPService.invoke(mc);
fail("The Expected exception didn't happen!");
- } catch (AxisFault e) {
- } // expected a fault
+ }
+ catch (AxisFault e) {/* expected a fault */}
+
Message msg = mc.getResponseMessage();
msg.saveChanges();
assertNotNull(msg);
- if (null != msg) {
- SOAPFault n = (SOAPFault) msg.getSOAPBody().getFirstChild();
- MessageElement detail = n.getChildElement(new QName("detail"));
-
- for (Iterator it = detail.getChildElements(); it.hasNext();) {
- Element de = (Element) it.next();
- String localName = de.getLocalName();
- String namespace = de.getNamespaceURI();
- if (localName.equals("ComplexUserDefinedExceptionFault")
- && namespace.equals("http://fake.target.namespace/")) {
- NodeList nl = de.getChildNodes();
- assertTrue(nl.getLength() == 2);
-
- // make sure both nodes are on right namespace
- Node firstNode = nl.item(0);
- assertTrue(firstNode.getNamespaceURI().equals("http://fake.target.namespace/"));
-
- Node secondNode = nl.item(1);
- assertTrue(secondNode.getNamespaceURI().equals("http://fake.target.namespace/"));
-
- // make sure the both attributes of the exception is serialized
- assertTrue("msg1".equals(firstNode.getLocalName()) || "msg1".equals(secondNode.getLocalName()));
- assertTrue("msg2".equals(firstNode.getLocalName()) || "msg2".equals(secondNode.getLocalName()));
- return;
- }
- // TODO: Check the other elements in the fault
+ SOAPFault n = (SOAPFault) msg.getSOAPBody().getFirstChild();
+ MessageElement detail = n.getChildElement(new QName("detail"));
+
+ for (Iterator it = detail.getChildElements(); it.hasNext();) {
+ Element de = (Element) it.next();
+ String localName = de.getLocalName();
+ String namespace = de.getNamespaceURI();
+ if (localName.equals("ComplexUserDefinedExceptionFault") && namespace.equals("http://fake.target.namespace/")) {
+ NodeList nl = de.getChildNodes();
+ assertTrue(nl.getLength() == 2);
+
+ // make sure both nodes are on right namespace
+ Node firstNode = nl.item(0);
+ assertTrue(firstNode.getNamespaceURI().equals("http://fake.target.namespace/"));
+
+ Node secondNode = nl.item(1);
+ assertTrue(secondNode.getNamespaceURI().equals("http://fake.target.namespace/"));
+
+ // make sure the both attributes of the exception is serialized
+ assertTrue("msg1".equals(firstNode.getLocalName()) || "msg1".equals(secondNode.getLocalName()));
+ assertTrue("msg2".equals(firstNode.getLocalName()) || "msg2".equals(secondNode.getLocalName()));
+ return;
}
- fail("Didn't find the exception name in the Fault detail");
+ /* todo: Check the other elements in the fault */
}
+ fail("Didn't find the exception name in the Fault detail");
}
- public void testRuntimeExceptions() throws Exception {
+ public void testRuntimeExceptions()
+ throws Exception {
MessageContext mc = new MessageContext(new AxisServer());
SOAPEnvelope env = new SOAPEnvelope();
env.addBodyElement(new RPCElement("doThrowRuntimeException"));
mc.setRequestMessage(new Message(env));
- mc.setService(fakeSOAPService);
+ mc.setService(_fakeSOAPService);
try {
- fakeSOAPService.invoke(mc);
+ _fakeSOAPService.invoke(mc);
fail("The Expected exception didn't happen!");
- } catch (AxisFault e) {
- // expected a fault
}
+ catch (AxisFault e) {/* expected a fault */ }
+
Message msg = mc.getResponseMessage();
msg.saveChanges();
assertNotNull(msg);
- if (null != msg) {
- SOAPFault f = (SOAPFault) msg.getSOAPBody().getFirstChild();
- MessageElement faultString = f.getChildElement(new QName("faultstring"));
- // we should have
- // <faultstring>java.lang.NullPointerException</faultstring>
- //quick hack to validate the faultString is set correctly
- // at this point I can't seem to walk the xml tree properly
- // but the toString works on the element.
- "<faultstring>java.lang.NullPointerException</faultstring>".equals(faultString.toString());
- // TODO: Check the other elements in the fault
- }
+
+ SOAPFault f = (SOAPFault) msg.getSOAPBody().getFirstChild();
+ MessageElement faultString = f.getChildElement(new QName("faultstring"));
+ /*
+ we should have <faultstring>java.lang.NullPointerException</faultstring>
+ quick hack to validate the faultString is set correctly
+ at this point I can't seem to walk the xml tree properly
+ but the toString works on the element.
+ "<faultstring>java.lang.NullPointerException</faultstring>".equals(faultString.toString());
+ */
+ /* todo: check other elements in the fault */
}
-}
+}
\ No newline at end of file
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=344941&r1=344940&r2=344941&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 15 23:37:49 2005
@@ -20,7 +20,6 @@
package org.apache.beehive.wsm.test.axis;
import java.util.ArrayList;
-
import javax.jws.WebParam;
import javax.jws.soap.SOAPBinding;
import javax.wsdl.OperationType;
@@ -31,7 +30,7 @@
import org.apache.axis.description.OperationDesc;
import org.apache.axis.description.ParameterDesc;
import org.apache.axis.description.ServiceDesc;
-import org.apache.beehive.wsm.axis.AxisHook;
+import org.apache.beehive.wsm.axis.ServiceDescriptionFactory;
import org.apache.beehive.wsm.model.BeehiveWsMethodMetadata;
import org.apache.beehive.wsm.model.BeehiveWsParameterMetadata;
import org.apache.beehive.wsm.model.BeehiveWsSOAPBindingInfo;
@@ -44,56 +43,59 @@
/**
*
*/
-public class AxisHookTest extends TestCase {
+public class AxisHookTest
+ extends TestCase {
- public static final Class WS_CLASS = FakeWebService.class;
- public static final String WM_JAVAMETHODNAME = "fakeWebMethod";
- public static final String WM_JAVAONEWAYMETHODNAME = "fakeOneWayWebMethod";
- public static final String WM_JAVAMETHODWITHEXCEPIONNAME= "fakeWayWebMethodWithException";
- public static final String WS_NAME = "WebServiceName";
- public static final String WS_NAMESPACE = "http://web.service/namespace";
- public static final String WM_OPERATION = "OperationName";
- public static final String WM_ACTION = "Lights_Camera_Action!";
- public static final String WM_RESULT = "ResultName";
- public static final String WM_ONEWAY = "Oneway";
- public static final String WM_EXCEPTION = "WithException";
- public static final String WM_TWOWAYPARAM = "number";
- public static final String WM_ONEWAYPARAM = "text";
+ private static final Class WS_CLASS = FakeWebService.class;
+ private static final String WM_JAVAMETHODNAME = "fakeWebMethod";
+ private static final String WM_JAVAONEWAYMETHODNAME = "fakeOneWayWebMethod";
+ private static final String WM_JAVAMETHODWITHEXCEPIONNAME= "fakeWayWebMethodWithException";
+ private static final String WS_NAME = "WebServiceName";
+ private static final String WS_NAMESPACE = "http://web.service/namespace";
+ private static final String WM_OPERATION = "OperationName";
+ private static final String WM_ACTION = "Lights_Camera_Action!";
+ private static final String WM_RESULT = "ResultName";
+ private static final String WM_ONEWAY = "Oneway";
+ private static final String WM_EXCEPTION = "WithException";
+ private static final String WM_TWOWAYPARAM = "number";
+ private static final String WM_ONEWAYPARAM = "text";
- ServiceDesc sd;
+ private ServiceDesc _serviceDescription;
public void setUp() throws Exception {
BeehiveWsTypeMetadata wsm = makeFakeMetadata();
- sd = AxisHook.createServiceDesc(wsm, null);
- }
-
- public void tearDown() {
+ _serviceDescription = ServiceDescriptionFactory.getInstance().createServiceDescription(wsm, null);
}
- public void testName() throws Exception {
- assertEquals(WS_NAME, sd.getName());
+ public void testName()
+ throws Exception {
+ assertEquals(WS_NAME, _serviceDescription.getName());
}
- public void testNamespace() throws Exception {
- assertEquals(WS_NAMESPACE, sd.getDefaultNamespace());
+ public void testNamespace()
+ throws Exception {
+ assertEquals(WS_NAMESPACE, _serviceDescription.getDefaultNamespace());
}
- public void testUse() throws Exception {
- assertEquals(Use.LITERAL, sd.getUse());
+ public void testUse()
+ throws Exception {
+ assertEquals(Use.LITERAL, _serviceDescription.getUse());
}
- public void testStyle() throws Exception {
+ public void testStyle()
+ throws Exception {
/*
* NOTE jcolwell@bea.com 2004-Sep-13 --
* in AXIS, WRAPPED is considered a Style and overrides DOCUMENT
* rather than living next to it as ParameterStyle does in jsr-181
*/
- //assertTrue(EnumWrapper.DOCUMENT.equals(sd.getStyle()));
- assertEquals(Style.WRAPPED, sd.getStyle());
+ //assertTrue(EnumWrapper.DOCUMENT.equals(_serviceDescription.getStyle()));
+ assertEquals(Style.WRAPPED, _serviceDescription.getStyle());
}
- public void testTwoWayOperation() throws Exception {
- OperationDesc twoWayOp = sd.getOperationByName(WM_JAVAMETHODNAME);
+ public void testTwoWayOperation()
+ throws Exception {
+ OperationDesc twoWayOp = _serviceDescription.getOperationByName(WM_JAVAMETHODNAME);
assertNotNull(twoWayOp);
if (twoWayOp != null) {
assertEquals(WM_ACTION, twoWayOp.getSoapAction());
@@ -111,15 +113,17 @@
}
- public void testExceptions() throws Exception {
- OperationDesc opWithException = sd.getOperationByName(WM_JAVAMETHODWITHEXCEPIONNAME);
+ public void testExceptions()
+ throws Exception {
+ OperationDesc opWithException = _serviceDescription.getOperationByName(WM_JAVAMETHODWITHEXCEPIONNAME);
assertNotNull(opWithException);
ArrayList allFaults = opWithException.getFaults();
assertNotNull(allFaults);
assertTrue(allFaults.size() == 1 ); // note: it should ignore the javax.... exception.
}
- public void testOneWayOperation() throws Exception {
- OperationDesc oneWayOp = sd.getOperationByName(WM_JAVAONEWAYMETHODNAME);
+ public void testOneWayOperation()
+ throws Exception {
+ OperationDesc oneWayOp = _serviceDescription.getOperationByName(WM_JAVAONEWAYMETHODNAME);
assertNotNull(oneWayOp);
if (oneWayOp != null) {
assertEquals(WM_ONEWAY + WM_ACTION, oneWayOp.getSoapAction());
@@ -136,7 +140,8 @@
}
}
- protected BeehiveWsTypeMetadata makeFakeMetadata() throws Exception {
+ private BeehiveWsTypeMetadata makeFakeMetadata()
+ throws Exception {
BeehiveWsTypeMetadata wstm = new DefaultTypeMetadataImpl();
wstm.setServiceClassName(WS_CLASS.getName());
wstm.setName(WS_NAME);
@@ -153,7 +158,7 @@
return wstm;
}
- protected BeehiveWsMethodMetadata makeFakeOnewayMethod() {
+ private BeehiveWsMethodMetadata makeFakeOnewayMethod() {
BeehiveWsMethodMetadata wsmm = new DefaultMethodMetadataImpl();
wsmm.setJavaMethodName(WM_JAVAONEWAYMETHODNAME);
wsmm.setReturnType(void.class.getName());
@@ -168,7 +173,7 @@
return wsmm;
}
- protected BeehiveWsMethodMetadata makeFakeMethod() {
+ private BeehiveWsMethodMetadata makeFakeMethod() {
BeehiveWsMethodMetadata wsmm = new DefaultMethodMetadataImpl();
wsmm.setJavaMethodName(WM_JAVAMETHODNAME);
wsmm.setReturnType(String.class.getName());
@@ -184,7 +189,7 @@
return wsmm;
}
- protected BeehiveWsMethodMetadata makeFakeMethodWithException() {
+ private BeehiveWsMethodMetadata makeFakeMethodWithException() {
BeehiveWsMethodMetadata wsmm = new DefaultMethodMetadataImpl();
wsmm.setJavaMethodName(WM_JAVAMETHODWITHEXCEPIONNAME);
wsmm.setReturnType(String.class.getName());
@@ -200,7 +205,7 @@
return wsmm;
}
- protected BeehiveWsSOAPBindingInfo makeFakeSoapBinding() {
+ private BeehiveWsSOAPBindingInfo makeFakeSoapBinding() {
BeehiveWsSOAPBindingInfo sbi = new DefaultSOAPBindingInfoImpl();
sbi.setStyle(SOAPBinding.Style.DOCUMENT);
sbi.setUse(SOAPBinding.Use.LITERAL);
@@ -210,7 +215,7 @@
public static class FakeWebService {
- // a method with an exception just to test exception processing in AxisHook
+ // 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 + '!';
}
Added: beehive/trunk/wsm/test/webapp/src-ws/webservice/OverloadedOperations.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/test/webapp/src-ws/webservice/OverloadedOperations.java?rev=344941&view=auto
==============================================================================
--- beehive/trunk/wsm/test/webapp/src-ws/webservice/OverloadedOperations.java (added)
+++ beehive/trunk/wsm/test/webapp/src-ws/webservice/OverloadedOperations.java Tue Nov 15 23:37:49 2005
@@ -0,0 +1,51 @@
+/**
+ 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 webservice;
+
+import javax.jws.WebService;
+import javax.jws.WebMethod;
+import javax.jws.Oneway;
+import javax.jws.WebParam;
+import javax.jws.soap.SOAPBinding;
+
+import org.apache.beehive.wsm.test.documents.PingDocument;
+import org.apache.beehive.wsm.test.holders.PingDocumentHolder;
+import org.apache.beehive.wsm.test.headers.SecurityHeader;
+
+/**
+ *
+ */
+@WebService(targetNamespace="urn:jsr181-webmethod")
+@SOAPBinding(style= SOAPBinding.Style.RPC)
+public class OverloadedOperations {
+
+ @WebMethod(operationName="PingOneWay")
+ @Oneway
+ public void ping(@WebParam(name="Ping") PingDocument pingDocument) {
+ }
+
+ @WebMethod(operationName="PingTwoWay")
+ public void ping(@WebParam(name="Ping", mode=WebParam.Mode.INOUT) PingDocumentHolder p) {
+ }
+
+ @WebMethod(operationName="SecurePing")
+ @Oneway
+ public void ping(@WebParam(name="Ping")PingDocument pingDocument,
+ @WebParam(name="SecurityHeader", header=true) SecurityHeader securityHeader) {
+ }
+}
Propchange: beehive/trunk/wsm/test/webapp/src-ws/webservice/OverloadedOperations.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/wsm/test/webapp/src/org/apache/beehive/wsm/test/documents/PingDocument.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/test/webapp/src/org/apache/beehive/wsm/test/documents/PingDocument.java?rev=344941&view=auto
==============================================================================
--- beehive/trunk/wsm/test/webapp/src/org/apache/beehive/wsm/test/documents/PingDocument.java (added)
+++ beehive/trunk/wsm/test/webapp/src/org/apache/beehive/wsm/test/documents/PingDocument.java Tue Nov 15 23:37:49 2005
@@ -0,0 +1,34 @@
+/**
+ 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.test.documents;
+
+/**
+ *
+ */
+public class PingDocument {
+
+ private String _text;
+
+ public String getText() {
+ return _text;
+ }
+
+ public void setText(String text) {
+ _text = text;
+ }
+}
Propchange: beehive/trunk/wsm/test/webapp/src/org/apache/beehive/wsm/test/documents/PingDocument.java
------------------------------------------------------------------------------
svn:eol-style = native