You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by cs...@apache.org on 2005/12/09 17:22:27 UTC
svn commit: r355529 [4/4] - in /beehive/trunk: system-controls/
system-controls/external/webservice/
system-controls/src/ejb/org/apache/beehive/controls/system/ejb/
system-controls/src/webservice/org/apache/beehive/controls/system/webservice/
system-co...
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=355529&r1=355528&r2=355529&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 Fri Dec 9 08:21:32 2005
@@ -178,9 +178,17 @@
}
if (qn == null) {
- qn = configureTypeMapping(sd, returnType, meth.getWrTargetNamespace());
- od.setReturnType(qn);
- od.setReturnClass(returnType);
+
+ Class type = returnType;
+ if (type.isArray()) {
+ type = type.getComponentType();
+ }
+ // todo: don't mess with if image attachement
+ if (!java.awt.Image.class.isAssignableFrom(type)) {
+ qn = configureTypeMapping(sd, returnType, meth.getWrTargetNamespace());
+ od.setReturnType(qn);
+ od.setReturnClass(returnType);
+ }
}
if (wsm.getSoapBinding().getStyle() == SOAPBinding.Style.RPC && returnType.isArray())
@@ -264,34 +272,7 @@
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) {
- /*
- 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"));
- hasUserDefinedFaults = true;
- }
}
-
- if(hasUserDefinedFaults) {
- configureTypeMapping(sd, AxisFaultAdaptor.class, meth.getWrTargetNamespace());
- }
-
System.out.println("========= operation description ' " + od.getName() + "'\n" + od + "\n==========\n");
}
Modified: beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/controls/ControlProvider.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/controls/ControlProvider.java?rev=355529&r1=355528&r2=355529&view=diff
==============================================================================
--- beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/controls/ControlProvider.java (original)
+++ beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/controls/ControlProvider.java Fri Dec 9 08:21:32 2005
@@ -83,12 +83,12 @@
AxisFaultAdaptor is used to intercept the serialization process
and "do the right thing"
*/
- Throwable origExp = e.detail;
+// Throwable origExp = e.detail;
/* The original exception was AxisFault */
- if (origExp == null || origExp instanceof AxisFault || origExp instanceof RuntimeException)
+// if (origExp == null || origExp instanceof AxisFault || origExp instanceof RuntimeException)
throw e;
/* if we have a user defined exception then wrap it in an adaptor. */
- else throw new AxisFaultAdaptor(msgContext, origExp);
+// else throw new AxisFaultAdaptor(msgContext, origExp);
}
finally {
// clean up if this is a request scoped message
Modified: beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/databinding/AxisTypeLookup.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/databinding/AxisTypeLookup.java?rev=355529&r1=355528&r2=355529&view=diff
==============================================================================
--- beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/databinding/AxisTypeLookup.java (original)
+++ beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/databinding/AxisTypeLookup.java Fri Dec 9 08:21:32 2005
@@ -63,12 +63,40 @@
return null;
}
+ /*
+ If the type has the rpc encoded namespace, lookup the class it maps
+ to in the type mapping table for the rpc enc namespace. NOTE: Axis
+ appends '[]' to the end of the name if it is an array type, strip the
+ '[]' characters before doing the lookup.
+ */
if (Constants.URI_SOAP11_ENC.equals(qType.getNamespaceURI())) {
TypeMappingRegistry tmr = new TypeMappingRegistryImpl(true);
TypeMapping tm = (TypeMapping)tmr.getTypeMapping(Constants.URI_SOAP11_ENC);
+ qType = stripArrayDelimiters(qType);
+ return tm.getClassForQName(qType);
+ }
+
+ /*
+ If the type has one of the standard schema type namespaces, just look it up
+ in the type mapping table. NOTE: The type name may have '[]' appended to it
+ if it is an array, strip the '[]' before looking up.
+ */
+ if (Constants.URI_1999_SCHEMA_XSD.equals(qType.getNamespaceURI())
+ || Constants.URI_2000_SCHEMA_XSD.equals(qType.getNamespaceURI())
+ || Constants.URI_2001_SCHEMA_XSD.equals(qType.getNamespaceURI())) {
+
+ qType = stripArrayDelimiters(qType);
+ TypeMappingRegistry tmr = new TypeMappingRegistryImpl(true);
+ TypeMapping tm = (TypeMapping)tmr.getTypeMapping(qType.getNamespaceURI());
return tm.getClassForQName(qType);
}
+ // Special case for image attachments.
+ if (Constants.NS_URI_XMLSOAP.equals(qType.getNamespaceURI())
+ && ("Image".equals(qType.getLocalPart()) || "Image[]".equals(qType.getLocalPart()))) {
+ return java.awt.Image.class;
+ }
+
String packageName = getPackageNameFromQName(qType);
String className;
if(packageName != null && packageName.length() > 0)
@@ -96,6 +124,20 @@
*/
String packageName = Utils.makePackageName(qType.getNamespaceURI());
return normalizePackageName(packageName, '.');
+ }
+
+ /**
+ * If the type QName has been suffixed with '[]' strip the brackets
+ * and return the new QName.
+ * @param type QName to check.
+ * @return A new QName.
+ */
+ private QName stripArrayDelimiters(QName type) {
+ if (type.getLocalPart().endsWith("[]")) {
+ return new QName(type.getNamespaceURI(),
+ type.getLocalPart().substring(0, type.getLocalPart().length()-2));
+ }
+ return type;
}
private static String normalizePackageName(String pkg, char separator) {
Modified: beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/BeehiveWsTypeMetadata.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/BeehiveWsTypeMetadata.java?rev=355529&r1=355528&r2=355529&view=diff
==============================================================================
--- beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/BeehiveWsTypeMetadata.java (original)
+++ beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/BeehiveWsTypeMetadata.java Fri Dec 9 08:21:32 2005
@@ -48,6 +48,10 @@
public abstract BeehiveWsMethodMetadata getMethod(String methodName, String... paramTypes);
+ public abstract void setWsPortName(String wsPortName);
+
+ public abstract String getWsPortName();
+
public abstract void addMethod(BeehiveWsMethodMetadata method);
public abstract void setSOAPHandlers(List soapHandlers);
Modified: beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/impl/DefaultTypeMetadataImpl.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/impl/DefaultTypeMetadataImpl.java?rev=355529&r1=355528&r2=355529&view=diff
==============================================================================
--- beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/impl/DefaultTypeMetadataImpl.java (original)
+++ beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/impl/DefaultTypeMetadataImpl.java Fri Dec 9 08:21:32 2005
@@ -1,292 +1,301 @@
-/*
- * 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:$Factory
- */
-package org.apache.beehive.wsm.model.impl;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.LinkedList;
-import javax.jws.soap.SOAPBinding;
-
-import org.apache.beehive.wsm.model.BeehiveWsTypeMetadata;
-import org.apache.beehive.wsm.model.BeehiveWsMethodMetadata;
-import org.apache.beehive.wsm.model.BeehiveWsSOAPBindingInfo;
-import org.apache.beehive.wsm.model.BeehiveWsSOAPMessageHandlerInfo;
-import org.apache.beehive.wsm.exception.ValidationException;
-import org.apache.beehive.wsm.model.BeehiveWsParameterMetadata;
-
-/**
- *
- */
-public class DefaultTypeMetadataImpl
- extends BeehiveWsTypeMetadata
- implements java.io.Serializable {
-
- private static final long serialVersionUID = 1L;
-
- private String _wsName;
- private String _wsServiceName;
- private String _wsWsdlLocation;
- private String _wsTargetNamespace;
- private String _wsEndpointInterface;
- private String _className;
- private String _hcFileName;
- private String _hcName;
- private HashMap<String, BeehiveWsMethodMetadata> _methodMap;
- private Set<BeehiveWsMethodMetadata> _noDuplicateMethods;
- private List _soapHandlers;
- private BeehiveWsSOAPBindingInfo _soapBinding;
-
- /**
- * Default constructor.
- */
- public DefaultTypeMetadataImpl() {
- _methodMap = new HashMap<String, BeehiveWsMethodMetadata>();
- _soapHandlers = new LinkedList<BeehiveWsSOAPMessageHandlerInfo>();
- }
-
- /**
- */
- public String getHandlerChainFileName() {
- return _hcFileName;
- }
-
- /**
- */
- public void setHandlerChainFileName(String hcFileName) {
- _hcFileName = hcFileName;
- }
-
- /**
- */
- public String getHandlerChainName() {
- return _hcName;
- }
-
- /**
- */
- public void setHandlerChainName(String hcName) {
- _hcName = hcName;
- }
-
-/*
- public String getSiValue() {
- return _siValue;
- }
-
- public void setSiValue(String siValue) {
- _siValue = siValue;
- }
-*/
-
- /**
- * @return Returns the soapBinding.
- */
- public BeehiveWsSOAPBindingInfo getSoapBinding() {
- if(_soapBinding == null)
- _soapBinding = new DefaultSOAPBindingInfoImpl();
- return _soapBinding;
- }
-
- /**
- * @param soapBinding The soapBinding to set.
- */
- public void setSoapBinding(BeehiveWsSOAPBindingInfo soapBinding) {
- _soapBinding = soapBinding;
- }
-
- /**
- * @return Returns the wsName.
- */
- public String getName() {
- return _wsName;
- }
-
- /**
- * @param wsName The wsName to set.
- */
- public void setName(String wsName) {
- _wsName = wsName;
- }
-
- /**
- * @return Returns the wsServiceName.
- */
- public String getServiceName() {
- return _wsServiceName;
- }
-
- /**
- * @param wsServiceName The wsServiceName to set.
- */
- public void setServiceName(String wsServiceName) {
- _wsServiceName = wsServiceName;
- }
-
- /**
- * @return Returns the wsTargetNamespace.
- */
- public String getTargetNamespace() {
- return _wsTargetNamespace;
- }
-
- /**
- * @param wsTargetNamespace The wsTargetNamespace to set.
- */
- public void setTargetNamespace(String wsTargetNamespace) {
- _wsTargetNamespace = wsTargetNamespace;
- }
-
-
- public String[] getTargetNamespaceParts() {
- // strip the "http://" from the targetnamespace
- String namespace = getTargetNamespace().substring(7, getTargetNamespace().length());
- String[] beforeTranspose = namespace.split("[\\./]");
- String[] res = new String[beforeTranspose.length];
- for(int i = 0; i < res.length; i++)
- res[i] = beforeTranspose[res.length - i - 1];
- return res;
- }
-
- /**
- * @return Returns the wsEndpointInterface.
- */
- public String getWsEndpointInterface() {
- return _wsEndpointInterface;
- }
-
- /**
- * @param wsEndpointInterface The wsEndpointInterface to set.
- */
- public void setWsEndpointInterface(String wsEndpointInterface) {
- _wsEndpointInterface = wsEndpointInterface;
- }
-
- /**
- * @return Returns the _wsWsdlLocation.
- */
- public String getWsdlLocation() {
- return _wsWsdlLocation;
- }
-
- /**
- * @param wsWsdlLocation The _wsWsdlLocation to set.
- */
- public void setWsdlLocation(String wsWsdlLocation) {
- _wsWsdlLocation = wsWsdlLocation;
- }
-
- /**
- * @return Returns the methods.
- */
- public Collection<BeehiveWsMethodMetadata> getMethods() {
- if(_noDuplicateMethods == null)
- _noDuplicateMethods = Collections.unmodifiableSet(new HashSet<BeehiveWsMethodMetadata>(_methodMap.values()));
- return _noDuplicateMethods;
- }
-
- public BeehiveWsMethodMetadata getMethod(String methodName, String... paramTypes) {
- String sig = createCompleteMethodSignature(methodName, paramTypes);
-
- BeehiveWsMethodMetadata meta = _methodMap.get(sig);
- if(meta == null) {
- /*
- * NOTE jcolwell@bea.com 2004-Nov-29 --
- * this fallback may be a bad thing but it is nice to have if the
- * WSDLProcessor cannot map the Java types properly when used on the
- * client side.
- */
- meta = _methodMap.get(methodName + '(' + paramTypes.length + ')');
- }
- return meta;
- }
-
- public void addMethod(BeehiveWsMethodMetadata method) {
-
- // NOTE jcolwell@bea.com 2004-Nov-29 -- clear the Set that prevents
- // duplicates being returned from getMethods().
- _noDuplicateMethods = null;
- List<? extends BeehiveWsParameterMetadata> params = method.getParams();
- String[] paramTypes = new String[params.size()];
- int j = 0;
- for(BeehiveWsParameterMetadata param : params) {
- String javaType = param.getJavaType();
- if(null == javaType) {
- throw new ValidationException("<null> is not a valid parameter class");
- }
- paramTypes[j++] = javaType;
- }
- String opName = method.getWmOperationName();
- String sig = createCompleteMethodSignature(opName, paramTypes);
-
- if(_methodMap.containsKey(sig)) {
- throw new ValidationException(sig + " is already present in this Web Service and duplicate methods are not permitted");
- }
- else if(SOAPBinding.Style.DOCUMENT.equals(getSoapBinding().getStyle()) && _methodMap.containsKey(opName)) {
- throw new ValidationException("document-style does not allow duplicate methods: " + opName);
- }
- else {
- _methodMap.put(sig, method);
- _methodMap.put(opName + '(' + paramTypes.length + ')', method);
- }
- }
-
- public void setSOAPHandlers(List soapHandlers) {
- _soapHandlers = soapHandlers;
- }
-
- public List getSoapHandlers() {
- return Collections.unmodifiableList(_soapHandlers);
- }
-
- public void addSOAPHandler(BeehiveWsSOAPMessageHandlerInfo soapHandler) {
- if(_soapHandlers != null)
- _soapHandlers = new LinkedList();
-
- _soapHandlers.add(soapHandler);
- }
-
- public String getServiceClassName() {
- return _className;
- }
-
- public void setServiceClassName(String className) {
- _className = className;
- }
-
- /* todo: this needs to go, as it should really be in Jsr181MethodMetadataImpl!!! */
- private String createCompleteMethodSignature(String name, String... paramTypes) {
-
- StringBuilder sb = new StringBuilder(name);
- sb.append('(');
- boolean firstParam = true;
- if(paramTypes != null) {
- for(int i = 0; i < paramTypes.length; i++) {
- if(i > 0)
- firstParam = false;
- else sb.append(',');
- sb.append(paramTypes[i]);
- }
- }
- sb.append(')');
- return sb.toString();
- }
-}
+/*
+ * 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:$Factory
+ */
+package org.apache.beehive.wsm.model.impl;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.LinkedList;
+import javax.jws.soap.SOAPBinding;
+
+import org.apache.beehive.wsm.model.BeehiveWsTypeMetadata;
+import org.apache.beehive.wsm.model.BeehiveWsMethodMetadata;
+import org.apache.beehive.wsm.model.BeehiveWsSOAPBindingInfo;
+import org.apache.beehive.wsm.model.BeehiveWsSOAPMessageHandlerInfo;
+import org.apache.beehive.wsm.exception.ValidationException;
+import org.apache.beehive.wsm.model.BeehiveWsParameterMetadata;
+
+/**
+ *
+ */
+public class DefaultTypeMetadataImpl
+ extends BeehiveWsTypeMetadata
+ implements java.io.Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private String _wsName;
+ private String _wsServiceName;
+ private String _wsWsdlLocation;
+ private String _wsTargetNamespace;
+ private String _wsEndpointInterface;
+ private String _className;
+ private String _hcFileName;
+ private String _hcName;
+ private HashMap<String, BeehiveWsMethodMetadata> _methodMap;
+ private Set<BeehiveWsMethodMetadata> _noDuplicateMethods;
+ private List _soapHandlers;
+ private BeehiveWsSOAPBindingInfo _soapBinding;
+ private String wsPortName;
+
+ /**
+ * Default constructor.
+ */
+ public DefaultTypeMetadataImpl() {
+ _methodMap = new HashMap<String, BeehiveWsMethodMetadata>();
+ _soapHandlers = new LinkedList();
+ }
+
+ /**
+ */
+ public String getHandlerChainFileName() {
+ return _hcFileName;
+ }
+
+ /**
+ */
+ public void setHandlerChainFileName(String hcFileName) {
+ _hcFileName = hcFileName;
+ }
+
+ /**
+ */
+ public String getHandlerChainName() {
+ return _hcName;
+ }
+
+ /**
+ */
+ public void setHandlerChainName(String hcName) {
+ _hcName = hcName;
+ }
+
+/*
+ public String getSiValue() {
+ return _siValue;
+ }
+
+ public void setSiValue(String siValue) {
+ _siValue = siValue;
+ }
+*/
+
+ /**
+ * @return Returns the soapBinding.
+ */
+ public BeehiveWsSOAPBindingInfo getSoapBinding() {
+ if(_soapBinding == null)
+ _soapBinding = new DefaultSOAPBindingInfoImpl();
+ return _soapBinding;
+ }
+
+ /**
+ * @param soapBinding The soapBinding to set.
+ */
+ public void setSoapBinding(BeehiveWsSOAPBindingInfo soapBinding) {
+ _soapBinding = soapBinding;
+ }
+
+ /**
+ * @return Returns the wsName.
+ */
+ public String getName() {
+ return _wsName;
+ }
+
+ /**
+ * @param wsName The wsName to set.
+ */
+ public void setName(String wsName) {
+ _wsName = wsName;
+ }
+
+ /**
+ * @return Returns the wsServiceName.
+ */
+ public String getServiceName() {
+ return _wsServiceName;
+ }
+
+ /**
+ * @param wsServiceName The wsServiceName to set.
+ */
+ public void setServiceName(String wsServiceName) {
+ _wsServiceName = wsServiceName;
+ }
+
+ /**
+ * @return Returns the wsTargetNamespace.
+ */
+ public String getTargetNamespace() {
+ return _wsTargetNamespace;
+ }
+
+ /**
+ * @param wsTargetNamespace The wsTargetNamespace to set.
+ */
+ public void setTargetNamespace(String wsTargetNamespace) {
+ _wsTargetNamespace = wsTargetNamespace;
+ }
+
+
+ public String[] getTargetNamespaceParts() {
+ // strip the "http://" from the targetnamespace
+ String namespace = getTargetNamespace().substring(7, getTargetNamespace().length());
+ String[] beforeTranspose = namespace.split("[\\./]");
+ String[] res = new String[beforeTranspose.length];
+ for(int i = 0; i < res.length; i++)
+ res[i] = beforeTranspose[res.length - i - 1];
+ return res;
+ }
+
+ /**
+ * @return Returns the wsEndpointInterface.
+ */
+ public String getWsEndpointInterface() {
+ return _wsEndpointInterface;
+ }
+
+ /**
+ * @param wsEndpointInterface The wsEndpointInterface to set.
+ */
+ public void setWsEndpointInterface(String wsEndpointInterface) {
+ _wsEndpointInterface = wsEndpointInterface;
+ }
+
+ /**
+ * @return Returns the _wsWsdlLocation.
+ */
+ public String getWsdlLocation() {
+ return _wsWsdlLocation;
+ }
+
+ /**
+ * @param wsWsdlLocation The _wsWsdlLocation to set.
+ */
+ public void setWsdlLocation(String wsWsdlLocation) {
+ _wsWsdlLocation = wsWsdlLocation;
+ }
+
+ /**
+ * @return Returns the methods.
+ */
+ public Collection<BeehiveWsMethodMetadata> getMethods() {
+ if(_noDuplicateMethods == null)
+ _noDuplicateMethods = Collections.unmodifiableSet(new HashSet<BeehiveWsMethodMetadata>(_methodMap.values()));
+ return _noDuplicateMethods;
+ }
+
+ public BeehiveWsMethodMetadata getMethod(String methodName, String... paramTypes) {
+ String sig = createCompleteMethodSignature(methodName, paramTypes);
+
+ BeehiveWsMethodMetadata meta = _methodMap.get(sig);
+ if(meta == null) {
+ /*
+ * NOTE jcolwell@bea.com 2004-Nov-29 --
+ * this fallback may be a bad thing but it is nice to have if the
+ * WSDLProcessor cannot map the Java types properly when used on the
+ * client side.
+ */
+ meta = _methodMap.get(methodName + '(' + paramTypes.length + ')');
+ }
+ return meta;
+ }
+
+ public void addMethod(BeehiveWsMethodMetadata method) {
+
+ // NOTE jcolwell@bea.com 2004-Nov-29 -- clear the Set that prevents
+ // duplicates being returned from getMethods().
+ _noDuplicateMethods = null;
+ List<? extends BeehiveWsParameterMetadata> params = method.getParams();
+ String[] paramTypes = new String[params.size()];
+ int j = 0;
+ for(BeehiveWsParameterMetadata param : params) {
+ String javaType = param.getJavaType();
+ if(null == javaType) {
+ throw new ValidationException("<null> is not a valid parameter class");
+ }
+ paramTypes[j++] = javaType;
+ }
+ String opName = method.getWmOperationName();
+ String sig = createCompleteMethodSignature(opName, paramTypes);
+
+ if(_methodMap.containsKey(sig)) {
+ throw new ValidationException(sig + " is already present in this Web Service and duplicate methods are not permitted");
+ }
+ else if(SOAPBinding.Style.DOCUMENT.equals(getSoapBinding().getStyle()) && _methodMap.containsKey(opName)) {
+ throw new ValidationException("document-style does not allow duplicate methods: " + opName);
+ }
+ else {
+ _methodMap.put(sig, method);
+ _methodMap.put(opName + '(' + paramTypes.length + ')', method);
+ }
+ }
+
+ public List getSoapHandlers() {
+ return Collections.unmodifiableList(_soapHandlers);
+ }
+
+ public void setSOAPHandlers(List soapHandlers) {
+ _soapHandlers = soapHandlers;
+ }
+
+ public void addSOAPHandler(BeehiveWsSOAPMessageHandlerInfo soapHandler) {
+ if (_soapHandlers == null)
+ _soapHandlers = new LinkedList();
+
+ _soapHandlers.add(soapHandler);
+ }
+
+ public String getServiceClassName() {
+ return _className;
+ }
+
+ public void setServiceClassName(String className) {
+ _className = className;
+ }
+
+ public void setWsPortName(String wsPortName) {
+ this.wsPortName = wsPortName;
+ }
+
+ public String getWsPortName() {
+ return wsPortName;
+ }
+
+ /* todo: this needs to go, as it should really be in Jsr181MethodMetadataImpl!!! */
+ private String createCompleteMethodSignature(String name, String... paramTypes) {
+
+ StringBuilder sb = new StringBuilder(name);
+ sb.append('(');
+ boolean firstParam = true;
+ if(paramTypes != null) {
+ for(int i = 0; i < paramTypes.length; i++) {
+ if(i > 0)
+ firstParam = false;
+ else sb.append(',');
+ sb.append(paramTypes[i]);
+ }
+ }
+ sb.append(')');
+ return sb.toString();
+ }
+}
Modified: beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/wsdl/XmlBeanWSDLProcessor.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/wsdl/XmlBeanWSDLProcessor.java?rev=355529&r1=355528&r2=355529&view=diff
==============================================================================
--- beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/wsdl/XmlBeanWSDLProcessor.java (original)
+++ beehive/trunk/wsm/src/core/org/apache/beehive/wsm/model/wsdl/XmlBeanWSDLProcessor.java Fri Dec 9 08:21:32 2005
@@ -20,6 +20,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.LinkedHashMap;
import javax.jws.WebParam;
import javax.jws.soap.SOAPBinding;
import javax.xml.namespace.QName;
@@ -122,6 +123,7 @@
if(defs.sizeOfServiceArray() > 0) {
wsm.setServiceName(defs.getServiceArray(0).getName());
+ wsm.setWsPortName(defs.getServiceArray(0).getPortArray(0).getName());
}
if(defs.sizeOfMessageArray() > 0) {
@@ -234,7 +236,7 @@
}
if(paraMeta.length > 0) {
- outParamMap = new HashMap<String, BeehiveWsParameterMetadata>(paraMeta.length);
+ outParamMap = new LinkedHashMap<String, BeehiveWsParameterMetadata>(paraMeta.length);
for(BeehiveWsParameterMetadata cpm : paraMeta) {
outParamMap.put(cpm.getWpName(), cpm);
}
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=355529&r1=355528&r2=355529&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 Fri Dec 9 08:21:32 2005
@@ -30,6 +30,7 @@
import javax.jws.soap.SOAPBinding;
import javax.xml.namespace.QName;
import javax.xml.rpc.encoding.TypeMapping;
+import javax.xml.rpc.encoding.XMLType;
import javax.xml.rpc.holders.Holder;
import org.apache.beehive.wsm.databinding.BindingLookupService;
@@ -82,22 +83,16 @@
"Invalid registeration requestion qname is null");
if(cls.isArray()) {
- if(SOAPBinding.Use.ENCODED == use) {
-
- // The Qname modification was needed to run the GoogleThe qname of the array must be different from the qname of the element.
- // I don't think the qname really matters, as the array qname wont be in the message
- // The qname of the array is available in the WSDL, but at this point we don't
- // have the information, I have added "Array" at the end of the qname, it can
- // be anything else and the code seems to work (from the client side).
- // if this needs to be the real name of the array, somehow WSDL information
- // must be made available to this method.
- QName arrayQname = new QName(q.getNamespaceURI(), q.getLocalPart() + "Array");
-
- if(!classIsRegistered(cls, arrayQname))
- registerClassAsSoapEncodedArray(cls, arrayQname);
+ if (SOAPBinding.Use.ENCODED == use) {
+ if(!classIsRegistered(cls, q)) {
+ registerClassAsSoapEncodedArray(cls, q);
+ }
+ } else {
+ q = registerType(cls.getComponentType(), q, style, use);
+ if (SOAPBinding.Style.RPC == style) {
+ q = XMLType.SOAP_ARRAY;
+ }
}
- // incase of literal, or encoded register the class also
- q = registerType(cls.getComponentType(), q, style, use);
}
else if(!classIsRegistered(cls, q)) {
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=355529&r1=355528&r2=355529&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 Fri Dec 9 08:21:32 2005
@@ -20,6 +20,8 @@
import javax.xml.namespace.QName;
import junit.framework.TestCase;
+import junit.framework.Test;
+import junit.framework.TestSuite;
import org.apache.axis.AxisFault;
import org.apache.axis.Message;
import org.apache.axis.MessageContext;
@@ -73,7 +75,7 @@
Element de = (Element)it.next();
String localName = de.getLocalName();
String namespace = de.getNamespaceURI();
- if (localName.equals("SimpleUserDefinedExceptionFault") && namespace.equals("http://fake.target.namespace/")) {
+ if (localName.equals("SimpleUserDefinedException") && namespace.equals("http://fake.target.namespace/")) {
NodeList nl = de.getChildNodes();
assertTrue(nl.getLength() == 0);
return;
@@ -105,20 +107,16 @@
Element de = (Element) it.next();
String localName = de.getLocalName();
String namespace = de.getNamespaceURI();
- if (localName.equals("ComplexUserDefinedExceptionFault") && namespace.equals("http://fake.target.namespace/")) {
+ if (localName.equals("ComplexUserDefinedException") && namespace.equals("http://fake.target.namespace/")) {
NodeList nl = de.getChildNodes();
- assertTrue(nl.getLength() == 2);
+ assertTrue(nl.getLength() == 1);
// 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()));
+ assertTrue("msg1".equals(firstNode.getLocalName()));
return;
}
/* todo: Check the other elements in the fault */
@@ -145,6 +143,8 @@
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
@@ -154,4 +154,12 @@
*/
/* todo: check other elements in the fault */
}
-}
\ No newline at end of file
+
+ public static Test suite() {
+ return new TestSuite(FaultTest.class);
+ }
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(suite());
+ }
+}