JBossWS SVN: r1486 - trunk/src/main/java/org/jboss/ws/metadata
by jbossws-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2006-11-21 06:25:49 -0500 (Tue, 21 Nov 2006)
New Revision: 1486
Modified:
trunk/src/main/java/org/jboss/ws/metadata/ServiceMetaData.java
Log:
Remove duplicate type initialization
Modified: trunk/src/main/java/org/jboss/ws/metadata/ServiceMetaData.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/ServiceMetaData.java 2006-11-21 11:15:14 UTC (rev 1485)
+++ trunk/src/main/java/org/jboss/ws/metadata/ServiceMetaData.java 2006-11-21 11:25:49 UTC (rev 1486)
@@ -40,10 +40,6 @@
import org.jboss.ws.jaxrpc.TypeMappingImpl;
import org.jboss.ws.jaxrpc.TypeMappingRegistryImpl;
import org.jboss.ws.jaxrpc.Use;
-import org.jboss.ws.jaxrpc.encoding.SOAPArrayDeserializerFactory;
-import org.jboss.ws.jaxrpc.encoding.SOAPArraySerializerFactory;
-import org.jboss.ws.jbossxb.JBossXBDeserializerFactory;
-import org.jboss.ws.jbossxb.JBossXBSerializerFactory;
import org.jboss.ws.jbossxb.SchemaBindingBuilder;
import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
@@ -54,7 +50,6 @@
import org.jboss.ws.metadata.wsdl.WSDLUtils;
import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
import org.jboss.ws.metadata.wsse.WSSecurityConfiguration;
-import org.jboss.ws.utils.JavaUtils;
import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
/**
@@ -386,52 +381,6 @@
// Initialize jaxrpc-mapping data
getJavaWsdlMapping();
- // Initialize types
- TypeMappingImpl typeMapping = getTypeMapping();
- for (TypeMappingMetaData tmMetaData : types.getTypeMappings())
- {
- String javaTypeName = tmMetaData.getJavaTypeName();
- QName xmlType = tmMetaData.getXmlType();
- if (xmlType != null)
- {
- List<Class> registeredTypes = typeMapping.getJavaTypes(xmlType);
-
- boolean registered = false;
- for (Class current : registeredTypes) {
- if (current.getName().equals(javaTypeName))
- {
- registered = true;
- break;
- }
- }
-
- if (registered == false)
- {
- try
- {
- ClassLoader classLoader = wsMetaData.getClassLoader();
- Class javaType = JavaUtils.loadJavaType(javaTypeName, classLoader);
-
- if (JavaUtils.isPrimitive(javaTypeName))
- javaType = JavaUtils.getWrapperType(javaType);
-
- if (getEncodingStyle() == Use.ENCODED && javaType.isArray())
- {
- typeMapping.register(javaType, xmlType, new SOAPArraySerializerFactory(), new SOAPArrayDeserializerFactory());
- }
- else
- {
- typeMapping.register(javaType, xmlType, new JBossXBSerializerFactory(), new JBossXBDeserializerFactory());
- }
- }
- catch (ClassNotFoundException e)
- {
- log.warn("Cannot load class for type: " + xmlType + "," + javaTypeName);
- }
- }
- }
- }
-
// Initialize endpoints
for (EndpointMetaData epMetaData : endpoints.values())
epMetaData.eagerInitialize();
17 years, 11 months
JBossWS SVN: r1485 - in trunk/src: main/java/org/jboss/ws/jaxrpc main/java/org/jboss/ws/jaxrpc/handler main/java/org/jboss/ws/metadata main/java/org/jboss/ws/tools/metadata test/ant test/java/org/jboss/test/ws/jaxrpc/samples/dynamichandler test/java/org/jboss/test/ws/jaxrpc/wsse test/resources/jaxrpc/jbws1121/WEB-INF test/resources/jaxrpc/samples/wssecurity/WEB-INF test/resources/jaxrpc/wsse/rpc test/resources/jaxrpc/wsse/rpc/META-INF-no-wsse
by jbossws-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2006-11-21 06:15:14 -0500 (Tue, 21 Nov 2006)
New Revision: 1485
Added:
trunk/src/test/resources/jaxrpc/jbws1121/WEB-INF/jboss-web.xml
trunk/src/test/resources/jaxrpc/samples/wssecurity/WEB-INF/jboss-web.xml
trunk/src/test/resources/jaxrpc/wsse/rpc/META-INF-no-wsse/
trunk/src/test/resources/jaxrpc/wsse/rpc/META-INF-no-wsse/jboss-client.xml
Removed:
trunk/src/test/resources/jaxrpc/wsse/rpc/META-INF-no-wsse/jboss-client.xml
Modified:
trunk/src/main/java/org/jboss/ws/jaxrpc/ServiceObjectFactory.java
trunk/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerDelegateJAXRPC.java
trunk/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/FaultMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/HandlerMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/HandlerMetaDataJAXRPC.java
trunk/src/main/java/org/jboss/ws/metadata/OperationMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/ParameterMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/ServiceMetaData.java
trunk/src/main/java/org/jboss/ws/tools/metadata/ReflectiveMetaDataBuilder.java
trunk/src/test/ant/build-jars-jaxrpc.xml
trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/dynamichandler/DynamicHandlerTestCase.java
trunk/src/test/java/org/jboss/test/ws/jaxrpc/wsse/NotEncodedTestCase.java
Log:
[JBWS-979] Security config not in sync with handler config
Modified: trunk/src/main/java/org/jboss/ws/jaxrpc/ServiceObjectFactory.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxrpc/ServiceObjectFactory.java 2006-11-21 10:49:43 UTC (rev 1484)
+++ trunk/src/main/java/org/jboss/ws/jaxrpc/ServiceObjectFactory.java 2006-11-21 11:15:14 UTC (rev 1485)
@@ -291,8 +291,6 @@
HandlerMetaDataJAXRPC jaxrpcMetaData = (HandlerMetaDataJAXRPC)handlerMetaData;
handlerRoles.addAll(jaxrpcMetaData.getSoapRoles());
- Class hClass = jaxrpcMetaData.getHandlerClass();
-
HashMap hConfig = new HashMap();
for (HandlerInitParam param : jaxrpcMetaData.getInitParams())
{
@@ -303,6 +301,7 @@
QName[] headerArr = new QName[headers.size()];
headers.toArray(headerArr);
+ Class hClass = jaxrpcMetaData.getHandlerClass();
hConfig.put(HandlerType.class.getName(), jaxrpcMetaData.getHandlerType());
HandlerInfo info = new HandlerInfo(hClass, hConfig, headerArr);
Modified: trunk/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerDelegateJAXRPC.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerDelegateJAXRPC.java 2006-11-21 10:49:43 UTC (rev 1484)
+++ trunk/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerDelegateJAXRPC.java 2006-11-21 11:15:14 UTC (rev 1485)
@@ -23,23 +23,27 @@
// $Id$
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.handler.HandlerChain;
+import javax.xml.rpc.handler.HandlerInfo;
+
import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.xop.XOPContext;
import org.jboss.ws.metadata.HandlerMetaData;
-import org.jboss.ws.metadata.HandlerMetaData.HandlerInitParam;
-import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
import org.jboss.ws.metadata.HandlerMetaDataJAXRPC;
import org.jboss.ws.metadata.ServerEndpointMetaData;
+import org.jboss.ws.metadata.HandlerMetaData.HandlerInitParam;
+import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
import org.jboss.ws.server.HandlerDelegate;
import org.jboss.ws.server.ServiceEndpointInfo;
import org.jboss.ws.soap.MessageContextAssociation;
+import org.jboss.ws.xop.XOPContext;
-import javax.xml.namespace.QName;
-import javax.xml.rpc.handler.HandlerChain;
-import javax.xml.rpc.handler.HandlerInfo;
-import java.util.*;
-
/** Delegates to JAXRPC handlers
*
* @author Thomas.Diesler(a)jboss.org
@@ -153,19 +157,6 @@
HandlerMetaDataJAXRPC jaxrpcMetaData = (HandlerMetaDataJAXRPC)handlerMetaData;
handlerRoles.addAll(jaxrpcMetaData.getSoapRoles());
- Class hClass;
- String handlerClass = jaxrpcMetaData.getHandlerClassName();
- try
- {
- // Load the handler class using the deployments top level CL
- ClassLoader classLoader = sepMetaData.getClassLoader();
- hClass = classLoader.loadClass(handlerClass);
- }
- catch (ClassNotFoundException e)
- {
- throw new WSException("Cannot load handler class: " + handlerClass);
- }
-
HashMap<String, Object> hConfig = new HashMap<String, Object>();
for (HandlerInitParam param : jaxrpcMetaData.getInitParams())
{
@@ -176,6 +167,7 @@
QName[] headerArr = new QName[headers.size()];
headers.toArray(headerArr);
+ Class hClass = jaxrpcMetaData.getHandlerClass();
hConfig.put(HandlerType.class.getName(), jaxrpcMetaData.getHandlerType());
HandlerInfo info = new HandlerInfo(hClass, hConfig, headerArr);
Modified: trunk/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java 2006-11-21 10:49:43 UTC (rev 1484)
+++ trunk/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java 2006-11-21 11:15:14 UTC (rev 1485)
@@ -492,7 +492,7 @@
for (OperationMetaData opMetaData : operations)
opMetaData.validate();
}
-
+
/**
* @see UnifiedMetaData#eagerInitialize()
*/
@@ -503,6 +503,10 @@
private void initializeInternal()
{
+ // Initialize handlers
+ for (HandlerMetaData handler : handlers)
+ handler.eagerInitialize();
+
eagerInitializeOperations();
eagerInitializeTypes();
}
Modified: trunk/src/main/java/org/jboss/ws/metadata/FaultMetaData.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/FaultMetaData.java 2006-11-21 10:49:43 UTC (rev 1484)
+++ trunk/src/main/java/org/jboss/ws/metadata/FaultMetaData.java 2006-11-21 11:15:14 UTC (rev 1485)
@@ -125,6 +125,16 @@
return tmpJavaType;
}
+ public String getFaultBeanName()
+ {
+ return faultBeanName;
+ }
+
+ public void setFaultBeanName(String faultBeanName)
+ {
+ this.faultBeanName = faultBeanName;
+ }
+
public Class getFaultBean()
{
Class tmpFaultBean = faultBean;
@@ -143,16 +153,11 @@
return tmpFaultBean;
}
- public String getFaultBeanName()
+ public void validate()
{
- return faultBeanName;
+ // nothing to do
}
-
- public void setFaultBeanName(String faultBeanName)
- {
- this.faultBeanName = faultBeanName;
- }
-
+
public void eagerInitialize()
{
ClassLoader loader = opMetaData.getEndpointMetaData().getClassLoader();
Modified: trunk/src/main/java/org/jboss/ws/metadata/HandlerMetaData.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/HandlerMetaData.java 2006-11-21 10:49:43 UTC (rev 1484)
+++ trunk/src/main/java/org/jboss/ws/metadata/HandlerMetaData.java 2006-11-21 11:15:14 UTC (rev 1485)
@@ -21,7 +21,7 @@
*/
package org.jboss.ws.metadata;
-// $Id$
+// $Id:HandlerMetaData.java 915 2006-09-08 08:40:45Z thomas.diesler(a)jboss.com $
import java.io.Serializable;
import java.util.ArrayList;
@@ -43,7 +43,7 @@
public abstract class HandlerMetaData implements Serializable
{
// provide logging
- private static final Logger log = Logger.getLogger(HandlerMetaData.class);
+ private final Logger log = Logger.getLogger(HandlerMetaData.class);
public enum HandlerType
{
@@ -126,7 +126,7 @@
{
return handlerType;
}
-
+
public void setSoapHeaders(Set<QName> soapHeaders)
{
this.soapHeaders = soapHeaders;
Modified: trunk/src/main/java/org/jboss/ws/metadata/HandlerMetaDataJAXRPC.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/HandlerMetaDataJAXRPC.java 2006-11-21 10:49:43 UTC (rev 1484)
+++ trunk/src/main/java/org/jboss/ws/metadata/HandlerMetaDataJAXRPC.java 2006-11-21 11:15:14 UTC (rev 1485)
@@ -21,7 +21,7 @@
*/
package org.jboss.ws.metadata;
-//$Id$
+//$Id:HandlerMetaDataJAXRPC.java 915 2006-09-08 08:40:45Z thomas.diesler(a)jboss.com $
import java.util.HashSet;
import java.util.Set;
@@ -73,7 +73,7 @@
StringBuffer buffer = new StringBuffer("\nHandlerMetaDataJAXRPC:");
buffer.append("\n type=" + getHandlerType());
buffer.append("\n name=" + getHandlerName());
- buffer.append("\n class=" + getHandlerClass());
+ buffer.append("\n class=" + getHandlerClassName());
buffer.append("\n params=" + getInitParams());
buffer.append("\n headers=" + getSoapHeaders());
buffer.append("\n roles=" + getSoapRoles());
Modified: trunk/src/main/java/org/jboss/ws/metadata/OperationMetaData.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/OperationMetaData.java 2006-11-21 10:49:43 UTC (rev 1484)
+++ trunk/src/main/java/org/jboss/ws/metadata/OperationMetaData.java 2006-11-21 11:15:14 UTC (rev 1485)
@@ -389,11 +389,6 @@
assertOneWayOperation();
}
- public void validate()
- {
- assertBare();
- }
-
// A JSR-181 processor is REQUIRED to report an error if an
// operation marked @Oneway has a return value, declares any checked exceptions or has any
// INOUT or OUT parameters.
@@ -415,7 +410,7 @@
}
}
- private void assertBare()
+ public void assertDocumentBare()
{
if (isDocumentBare())
{
@@ -443,6 +438,15 @@
}
}
+ public void validate()
+ {
+ for (ParameterMetaData parameter : parameters)
+ parameter.validate();
+
+ for (FaultMetaData fault : faults)
+ fault.validate();
+ }
+
/**
* @see UnifiedMetaData#eagerInitialize()
*/
@@ -490,7 +494,9 @@
buffer.append("\n javaName=" + javaName);
buffer.append("\n style=" + getStyle() + "/" + getUse());
if (getStyle() == Style.DOCUMENT)
+ {
buffer.append("/" + getParameterStyle());
+ }
buffer.append("\n oneWay=" + oneWay);
buffer.append("\n soapAction=" + soapAction);
for (ParameterMetaData param : parameters)
Modified: trunk/src/main/java/org/jboss/ws/metadata/ParameterMetaData.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/ParameterMetaData.java 2006-11-21 10:49:43 UTC (rev 1484)
+++ trunk/src/main/java/org/jboss/ws/metadata/ParameterMetaData.java 2006-11-21 11:15:14 UTC (rev 1485)
@@ -336,6 +336,11 @@
this.partName = partName;
}
+ public void validate()
+ {
+ // nothing to do
+ }
+
/**
* @see UnifiedMetaData#eagerInitialize()
*/
Modified: trunk/src/main/java/org/jboss/ws/metadata/ServiceMetaData.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/ServiceMetaData.java 2006-11-21 10:49:43 UTC (rev 1484)
+++ trunk/src/main/java/org/jboss/ws/metadata/ServiceMetaData.java 2006-11-21 11:15:14 UTC (rev 1485)
@@ -40,6 +40,10 @@
import org.jboss.ws.jaxrpc.TypeMappingImpl;
import org.jboss.ws.jaxrpc.TypeMappingRegistryImpl;
import org.jboss.ws.jaxrpc.Use;
+import org.jboss.ws.jaxrpc.encoding.SOAPArrayDeserializerFactory;
+import org.jboss.ws.jaxrpc.encoding.SOAPArraySerializerFactory;
+import org.jboss.ws.jbossxb.JBossXBDeserializerFactory;
+import org.jboss.ws.jbossxb.JBossXBSerializerFactory;
import org.jboss.ws.jbossxb.SchemaBindingBuilder;
import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
@@ -50,6 +54,7 @@
import org.jboss.ws.metadata.wsdl.WSDLUtils;
import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
import org.jboss.ws.metadata.wsse.WSSecurityConfiguration;
+import org.jboss.ws.utils.JavaUtils;
import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
/**
@@ -381,11 +386,57 @@
// Initialize jaxrpc-mapping data
getJavaWsdlMapping();
- // init the endpoints
+ // Initialize types
+ TypeMappingImpl typeMapping = getTypeMapping();
+ for (TypeMappingMetaData tmMetaData : types.getTypeMappings())
+ {
+ String javaTypeName = tmMetaData.getJavaTypeName();
+ QName xmlType = tmMetaData.getXmlType();
+ if (xmlType != null)
+ {
+ List<Class> registeredTypes = typeMapping.getJavaTypes(xmlType);
+
+ boolean registered = false;
+ for (Class current : registeredTypes) {
+ if (current.getName().equals(javaTypeName))
+ {
+ registered = true;
+ break;
+ }
+ }
+
+ if (registered == false)
+ {
+ try
+ {
+ ClassLoader classLoader = wsMetaData.getClassLoader();
+ Class javaType = JavaUtils.loadJavaType(javaTypeName, classLoader);
+
+ if (JavaUtils.isPrimitive(javaTypeName))
+ javaType = JavaUtils.getWrapperType(javaType);
+
+ if (getEncodingStyle() == Use.ENCODED && javaType.isArray())
+ {
+ typeMapping.register(javaType, xmlType, new SOAPArraySerializerFactory(), new SOAPArrayDeserializerFactory());
+ }
+ else
+ {
+ typeMapping.register(javaType, xmlType, new JBossXBSerializerFactory(), new JBossXBDeserializerFactory());
+ }
+ }
+ catch (ClassNotFoundException e)
+ {
+ log.warn("Cannot load class for type: " + xmlType + "," + javaTypeName);
+ }
+ }
+ }
+ }
+
+ // Initialize endpoints
for (EndpointMetaData epMetaData : endpoints.values())
epMetaData.eagerInitialize();
- // init schema binding
+ // Initialize schema binding
getSchemaBinding();
}
Modified: trunk/src/main/java/org/jboss/ws/tools/metadata/ReflectiveMetaDataBuilder.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/tools/metadata/ReflectiveMetaDataBuilder.java 2006-11-21 10:49:43 UTC (rev 1484)
+++ trunk/src/main/java/org/jboss/ws/tools/metadata/ReflectiveMetaDataBuilder.java 2006-11-21 11:15:14 UTC (rev 1485)
@@ -236,7 +236,7 @@
if (! remoteExceptionFound)
throw new WSException(m.getName() + " does not throw RemoteException.");
- om.validate();
+ om.assertDocumentBare();
tmd.addOperation(om);
}
}
Modified: trunk/src/test/ant/build-jars-jaxrpc.xml
===================================================================
--- trunk/src/test/ant/build-jars-jaxrpc.xml 2006-11-21 10:49:43 UTC (rev 1484)
+++ trunk/src/test/ant/build-jars-jaxrpc.xml 2006-11-21 11:15:14 UTC (rev 1485)
@@ -600,8 +600,9 @@
<webinf dir="${build.test.dir}/resources/jaxrpc/jbws1121/WEB-INF">
<include name="webservices.xml"/>
<include name="jaxrpc-mapping.xml"/>
+ <include name="jboss-wsse-server.xml"/>
+ <include name="jboss-web.xml"/>
<include name="wsdl/*"/>
- <include name="jboss-wsse-server.xml"/>
</webinf>
<webinf dir="${build.test.dir}/resources/jaxrpc/jbws1121">
<include name="wsse.keystore"/>
@@ -716,7 +717,7 @@
</metainf>
</jar>
- <!-- jbossws-jbws1186 -->
+ <!-- jaxrpcws-jbws1186 -->
<war warfile="${build.test.dir}/libs/jaxrpc-jbws1186.war" webxml="${build.test.dir}/resources/jaxrpc/jbws1186/WEB-INF/web.xml">
<classes dir="${build.test.dir}/classes">
<include name="org/jboss/test/ws/jaxrpc/jbws1186/TestEndpointImpl.class"/>
@@ -730,7 +731,7 @@
</webinf>
</war>
- <!-- jbossws-jbws1205 -->
+ <!-- jaxrpcws-jbws1205 -->
<war warfile="${build.test.dir}/libs/jaxrpc-jbws1205-simple.war" webxml="${build.test.dir}/resources/jaxrpc/jbws1205/SimpleEndpoint/WEB-INF/web.xml">
<classes dir="${build.test.dir}/classes">
<include name="org/jboss/test/ws/jaxrpc/jbws1205/SimpleEndpointImpl.class"/>
@@ -1382,6 +1383,7 @@
<webinf dir="${build.test.dir}/resources/jaxrpc/samples/wssecurity/WEB-INF">
<include name="jaxrpc-mapping.xml"/>
<include name="webservices.xml"/>
+ <include name="jboss-web.xml"/>
<include name="wsdl/**"/>
</webinf>
<webinf dir="${build.test.dir}/resources/jaxrpc/samples/wssecurity/simple-sign">
@@ -1418,6 +1420,7 @@
<webinf dir="${build.test.dir}/resources/jaxrpc/samples/wssecurity/WEB-INF">
<include name="webservices.xml"/>
<include name="jaxrpc-mapping.xml"/>
+ <include name="jboss-web.xml"/>
<include name="wsdl/**"/>
</webinf>
<webinf dir="${build.test.dir}/resources/jaxrpc/samples/wssecurity/simple-encrypt">
@@ -1612,7 +1615,7 @@
</webinf>
</war>
- <!-- jboss-wsse-account-signup-client.jar -->
+ <!-- jaxrpc-wsse-account-signup-client.jar -->
<jar jarfile="${build.test.dir}/libs/jaxrpc-wsse-account-signup-client.jar">
<fileset dir="${build.test.dir}/classes">
<include name="org/jboss/test/ws/jaxrpc/wsse/signup/AccountInfo.class"/>
@@ -1652,7 +1655,7 @@
</webinf>
</war>
- <!-- jboss-wsse-rpc-client.jar -->
+ <!-- jaxrpc-wsse-rpc-client.jar -->
<jar jarfile="${build.test.dir}/libs/jaxrpc-wsse-rpc-client.jar">
<fileset dir="${build.test.dir}/classes">
<include name="org/jboss/test/ws/jaxrpc/wsse/Hello.class"/>
@@ -1670,8 +1673,8 @@
</metainf>
</jar>
- <!-- jboss-wsse-rpc-noconfig-client -->
- <jar jarfile="${build.test.dir}/libs/jaxrpc-wsse-rpc-noconfig-client.jar">
+ <!-- jaxrpc-wsse-rpc-none-client -->
+ <jar jarfile="${build.test.dir}/libs/jaxrpc-wsse-rpc-none-client.jar">
<fileset dir="${build.test.dir}/classes">
<include name="org/jboss/test/ws/jaxrpc/wsse/Hello.class"/>
<include name="org/jboss/test/ws/jaxrpc/wsse/HelloException.class"/>
@@ -1679,6 +1682,8 @@
</fileset>
<metainf dir="${build.test.dir}/resources/jaxrpc/wsse/rpc/META-INF">
<include name="application-client.xml"/>
+ </metainf>
+ <metainf dir="${build.test.dir}/resources/jaxrpc/wsse/rpc/META-INF-no-wsse">
<include name="jboss-client.xml"/>
</metainf>
<metainf dir="${build.test.dir}/resources/jaxrpc/wsse/rpc/WEB-INF">
@@ -1710,7 +1715,7 @@
</webinf>
</war>
- <!-- jboss-wsse-simple-encrypt-client.jar -->
+ <!-- jaxrpc-wsse-simple-encrypt-client.jar -->
<jar jarfile="${build.test.dir}/libs/jaxrpc-wsse-simple-sign-encrypt-client.jar">
<fileset dir="${build.test.dir}/classes">
<include name="org/jboss/test/ws/jaxrpc/wsse/Hello.class"/>
@@ -1753,7 +1758,7 @@
</webinf>
</war>
- <!-- jboss-wsse-sign-fault-client.jar -->
+ <!-- jaxrpc-wsse-sign-fault-client.jar -->
<jar jarfile="${build.test.dir}/libs/jaxrpc-wsse-sign-fault-client.jar">
<fileset dir="${build.test.dir}/classes">
<include name="org/jboss/test/ws/jaxrpc/wsse/Hello.class"/>
@@ -1796,7 +1801,7 @@
</webinf>
</war>
- <!-- jboss-wsse-sign-encrypt-fault-client.jar -->
+ <!-- jaxrpc-wsse-sign-encrypt-fault-client.jar -->
<jar jarfile="${build.test.dir}/libs/jaxrpc-wsse-sign-encrypt-fault-client.jar">
<fileset dir="${build.test.dir}/classes">
<include name="org/jboss/test/ws/jaxrpc/wsse/Hello.class"/>
@@ -1841,7 +1846,7 @@
</webinf>
</war>
- <!-- jboss-wsse-store-pass-encrypt-class-cmd-client.jar -->
+ <!-- jaxrpc-wsse-store-pass-encrypt-class-cmd-client.jar -->
<jar jarfile="${build.test.dir}/libs/jaxrpc-wsse-store-pass-encrypt-class-cmd-client.jar">
<fileset dir="${build.test.dir}/classes">
<include name="org/jboss/test/ws/jaxrpc/wsse/Hello.class"/>
Modified: trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/dynamichandler/DynamicHandlerTestCase.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/dynamichandler/DynamicHandlerTestCase.java 2006-11-21 10:49:43 UTC (rev 1484)
+++ trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/dynamichandler/DynamicHandlerTestCase.java 2006-11-21 11:15:14 UTC (rev 1485)
@@ -33,11 +33,11 @@
import junit.framework.Test;
-import org.jboss.mx.util.ObjectNameFactory;
import org.jboss.test.ws.JBossWSTest;
import org.jboss.test.ws.JBossWSTestSetup;
import org.jboss.ws.jaxrpc.ServiceExt;
import org.jboss.ws.metadata.HandlerMetaData;
+import org.jboss.ws.utils.ObjectNameFactory;
/**
* Test dynamic handlers
Modified: trunk/src/test/java/org/jboss/test/ws/jaxrpc/wsse/NotEncodedTestCase.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jaxrpc/wsse/NotEncodedTestCase.java 2006-11-21 10:49:43 UTC (rev 1484)
+++ trunk/src/test/java/org/jboss/test/ws/jaxrpc/wsse/NotEncodedTestCase.java 2006-11-21 11:15:14 UTC (rev 1485)
@@ -45,7 +45,7 @@
/** Deploy the test */
public static Test suite() throws Exception
{
- return JBossWSTestSetup.newTestSetup(NotEncodedTestCase.class, "jaxrpc-wsse-rpc.war, jaxrpc-wsse-rpc-noconfig-client.jar");
+ return JBossWSTestSetup.newTestSetup(NotEncodedTestCase.class, "jaxrpc-wsse-rpc.war, jaxrpc-wsse-rpc-none-client.jar");
}
/**
Copied: trunk/src/test/resources/jaxrpc/jbws1121/WEB-INF/jboss-web.xml (from rev 1187, branches/jbossws-1.0/src/test/resources/jaxrpc/jbws1121/WEB-INF/jboss-web.xml)
Copied: trunk/src/test/resources/jaxrpc/samples/wssecurity/WEB-INF/jboss-web.xml (from rev 1187, branches/jbossws-1.0/src/test/resources/jaxrpc/samples/wssecurity/WEB-INF/jboss-web.xml)
Copied: trunk/src/test/resources/jaxrpc/wsse/rpc/META-INF-no-wsse (from rev 1187, branches/jbossws-1.0/src/test/resources/jaxrpc/wsse/rpc/META-INF-no-wsse)
Deleted: trunk/src/test/resources/jaxrpc/wsse/rpc/META-INF-no-wsse/jboss-client.xml
===================================================================
--- branches/jbossws-1.0/src/test/resources/jaxrpc/wsse/rpc/META-INF-no-wsse/jboss-client.xml 2006-10-10 13:47:37 UTC (rev 1187)
+++ trunk/src/test/resources/jaxrpc/wsse/rpc/META-INF-no-wsse/jboss-client.xml 2006-11-21 11:15:14 UTC (rev 1485)
@@ -1,15 +0,0 @@
-<?xml version='1.0' encoding='UTF-8' ?>
-
-<!DOCTYPE jboss-client PUBLIC
- "-//JBoss//DTD Application Client 4.0//EN"
- "http://www.jboss.org/j2ee/dtd/jboss-client_4_0.dtd">
-
-<jboss-client>
- <jndi-name>jbossws-client</jndi-name>
-
- <service-ref>
- <service-ref-name>service/HelloService</service-ref-name>
- <wsdl-override>http://@jbosstest.host.name@:8080/jaxrpc-wsse-rpc?wsdl</wsdl-override>
- </service-ref>
-
-</jboss-client>
Copied: trunk/src/test/resources/jaxrpc/wsse/rpc/META-INF-no-wsse/jboss-client.xml (from rev 1187, branches/jbossws-1.0/src/test/resources/jaxrpc/wsse/rpc/META-INF-no-wsse/jboss-client.xml)
17 years, 11 months
JBossWS SVN: r1484 - in trunk/src: main/java/org/jboss/ws/common main/java/org/jboss/ws/jaxrpc main/java/org/jboss/ws/jaxrpc/handler main/java/org/jboss/ws/jaxws main/java/org/jboss/ws/jaxws/handler main/java/org/jboss/ws/metadata main/java/org/jboss/ws/metadata/j2ee main/java/org/jboss/ws/server main/java/org/jboss/ws/soap main/java/org/jboss/ws/tools/metadata test/java/org/jboss/test/ws/jaxrpc/samples/dynamichandler test/java/org/jboss/test/ws/jaxws/jbws860 test/java/org/jboss/test/ws/ja
by jbossws-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2006-11-21 05:49:43 -0500 (Tue, 21 Nov 2006)
New Revision: 1484
Modified:
trunk/src/main/java/org/jboss/ws/common/CommonClient.java
trunk/src/main/java/org/jboss/ws/jaxrpc/CallProxy.java
trunk/src/main/java/org/jboss/ws/jaxrpc/MetaDataSynchronization.java
trunk/src/main/java/org/jboss/ws/jaxrpc/ServiceObjectFactory.java
trunk/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerDelegateJAXRPC.java
trunk/src/main/java/org/jboss/ws/jaxws/DynamicWrapperGenerator.java
trunk/src/main/java/org/jboss/ws/jaxws/handler/HandlerResolverImpl.java
trunk/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/FaultMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/HandlerMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/OperationMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/ParameterMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/ServiceMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/UnifiedMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedHandlerMetaData.java
trunk/src/main/java/org/jboss/ws/server/ServiceEndpoint.java
trunk/src/main/java/org/jboss/ws/soap/SOAPBodyImpl.java
trunk/src/main/java/org/jboss/ws/soap/SOAPContentElement.java
trunk/src/main/java/org/jboss/ws/tools/metadata/ToolsUnifiedMetaDataBuilder.java
trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/dynamichandler/DynamicHandlerTestCase.java
trunk/src/test/java/org/jboss/test/ws/jaxws/jbws860/JBWS860TestCase.java
trunk/src/test/java/org/jboss/test/ws/jaxws/jbws944/EJB3Bean01.java
trunk/src/test/java/org/jboss/test/ws/jaxws/jbws944/JBWS944TestCase.java
trunk/src/test/resources/jaxws/samples/jsr181ejb/wstools-config.xml
trunk/src/test/resources/jaxws/samples/jsr181pojo/wstools-config.xml
trunk/src/test/resources/jaxws/samples/wsaddressing/wstools-config.xml
trunk/src/test/resources/jaxws/wsaddressing/replyto/Initial-META-INF/jaxrpc-mapping.xml
trunk/src/test/resources/jaxws/wsaddressing/replyto/Initial-META-INF/wstools-config.xml
trunk/src/test/resources/jaxws/wsaddressing/replyto/ReplyTo-META-INF/wstools-config.xml
Log:
[JBWS-1113] Improve performance of Service.getPort()
Modified: trunk/src/main/java/org/jboss/ws/common/CommonClient.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/common/CommonClient.java 2006-11-21 10:46:14 UTC (rev 1483)
+++ trunk/src/main/java/org/jboss/ws/common/CommonClient.java 2006-11-21 10:49:43 UTC (rev 1484)
@@ -55,7 +55,6 @@
import org.jboss.ws.soap.SOAPBodyImpl;
import org.jboss.ws.soap.SOAPConnectionImpl;
import org.jboss.ws.utils.HolderUtils;
-import org.jboss.ws.utils.JavaUtils;
/**
* Provides support for the dynamic invocation of a service endpoint.
@@ -181,6 +180,8 @@
if (epMetaData == null)
{
UnifiedMetaData wsMetaData = new UnifiedMetaData();
+ wsMetaData.setClassLoader(Thread.currentThread().getContextClassLoader());
+
ServiceMetaData serviceMetaData = new ServiceMetaData(wsMetaData, new QName(Constants.NS_JBOSSWS_URI, "AnonymousService"));
wsMetaData.addService(serviceMetaData);
Modified: trunk/src/main/java/org/jboss/ws/jaxrpc/CallProxy.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxrpc/CallProxy.java 2006-11-21 10:46:14 UTC (rev 1483)
+++ trunk/src/main/java/org/jboss/ws/jaxrpc/CallProxy.java 2006-11-21 10:49:43 UTC (rev 1484)
@@ -33,7 +33,6 @@
import java.util.Map;
import java.util.Set;
-import javax.xml.rpc.Call;
import javax.xml.rpc.JAXRPCException;
import javax.xml.rpc.Stub;
import javax.xml.rpc.soap.SOAPFaultException;
Modified: trunk/src/main/java/org/jboss/ws/jaxrpc/MetaDataSynchronization.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxrpc/MetaDataSynchronization.java 2006-11-21 10:46:14 UTC (rev 1483)
+++ trunk/src/main/java/org/jboss/ws/jaxrpc/MetaDataSynchronization.java 2006-11-21 10:49:43 UTC (rev 1484)
@@ -49,6 +49,7 @@
if (epMetaData.getServiceEndpointInterface() != seiClass)
throw new IllegalArgumentException("Endpoint meta data SEI missmatch, expected: " + epMetaData.getServiceEndpointInterfaceName());
+ /*
Method[] methods = seiClass.getMethods();
for (int i = 0; i < methods.length; i++)
{
@@ -63,5 +64,6 @@
if (opMetaData == null)
throw new ServiceException("Cannot obtain operation meta data for method: " + method);
}
+ */
}
}
Modified: trunk/src/main/java/org/jboss/ws/jaxrpc/ServiceObjectFactory.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxrpc/ServiceObjectFactory.java 2006-11-21 10:46:14 UTC (rev 1483)
+++ trunk/src/main/java/org/jboss/ws/jaxrpc/ServiceObjectFactory.java 2006-11-21 10:49:43 UTC (rev 1484)
@@ -180,22 +180,6 @@
QName serviceName = serviceRefMetaData.getServiceQName();
JavaWsdlMapping javaWsdlMapping = (JavaWsdlMapping)serviceRefMetaData.getJavaWsdlMapping();
jaxrpcService = new ServiceImpl(serviceName, wsdlURL, javaWsdlMapping, securityConfig, serviceRefMetaData);
-
- // Setup endpoint meta data
- ServiceMetaData serviceMetaData = jaxrpcService.getServiceMetaData();
- for (UnifiedPortComponentRefMetaData pcRefMetaData : serviceRefMetaData.getPortComponentRefs())
- {
- String seiName = pcRefMetaData.getServiceEndpointInterface();
- for (EndpointMetaData epMetaData : serviceMetaData.getEndpoints())
- {
- String epSEIName = epMetaData.getServiceEndpointInterfaceName();
- if (seiName.equals(epSEIName) || epSEIName == null)
- {
- epMetaData.setServiceEndpointInterfaceName(seiName);
- epMetaData.setProperties(pcRefMetaData.getCallProperties());
- }
- }
- }
}
else
{
@@ -307,8 +291,7 @@
HandlerMetaDataJAXRPC jaxrpcMetaData = (HandlerMetaDataJAXRPC)handlerMetaData;
handlerRoles.addAll(jaxrpcMetaData.getSoapRoles());
- ClassLoader cl = epMetaData.getClassLoader();
- Class hClass = cl.loadClass(jaxrpcMetaData.getHandlerClass());
+ Class hClass = jaxrpcMetaData.getHandlerClass();
HashMap hConfig = new HashMap();
for (HandlerInitParam param : jaxrpcMetaData.getInitParams())
Modified: trunk/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerDelegateJAXRPC.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerDelegateJAXRPC.java 2006-11-21 10:46:14 UTC (rev 1483)
+++ trunk/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerDelegateJAXRPC.java 2006-11-21 10:49:43 UTC (rev 1484)
@@ -154,7 +154,7 @@
handlerRoles.addAll(jaxrpcMetaData.getSoapRoles());
Class hClass;
- String handlerClass = jaxrpcMetaData.getHandlerClass();
+ String handlerClass = jaxrpcMetaData.getHandlerClassName();
try
{
// Load the handler class using the deployments top level CL
Modified: trunk/src/main/java/org/jboss/ws/jaxws/DynamicWrapperGenerator.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxws/DynamicWrapperGenerator.java 2006-11-21 10:46:14 UTC (rev 1483)
+++ trunk/src/main/java/org/jboss/ws/jaxws/DynamicWrapperGenerator.java 2006-11-21 10:49:43 UTC (rev 1484)
@@ -119,12 +119,16 @@
public void generate(FaultMetaData fmd)
{
+ // If a wrapper already present, no need to generate one
String faultBeanName = fmd.getFaultBeanName();
if (faultBeanName == null || JavaUtils.isLoaded(faultBeanName, loader))
return;
+ log.debug("Generating fault bean: " + faultBeanName);
+
+ QName xmlType = fmd.getXmlType();
+
Class exception = fmd.getJavaType();
-
try
{
SortedMap<String, Class<?>> properties = getExceptionProperties(exception);
@@ -142,8 +146,12 @@
}
catch (Exception e)
{
- throw new WSException("Could not generate wrapper type: " + faultBeanName, e);
+ throw new WSException("Could not generate fault wrapper bean: " + faultBeanName, e);
}
+
+ // Add the generated type to the types meta data
+ TypesMetaData types = fmd.getOperationMetaData().getEndpointMetaData().getServiceMetaData().getTypesMetaData();
+ types.addTypeMapping(new TypeMappingMetaData(types, xmlType, faultBeanName));
}
private static String getterPrefix(CtClass type)
Modified: trunk/src/main/java/org/jboss/ws/jaxws/handler/HandlerResolverImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxws/handler/HandlerResolverImpl.java 2006-11-21 10:46:14 UTC (rev 1483)
+++ trunk/src/main/java/org/jboss/ws/jaxws/handler/HandlerResolverImpl.java 2006-11-21 10:49:43 UTC (rev 1484)
@@ -135,7 +135,7 @@
{
HandlerMetaDataJAXWS jaxwsMetaData = (HandlerMetaDataJAXWS)handlerMetaData;
String handlerName = jaxwsMetaData.getHandlerName();
- String className = jaxwsMetaData.getHandlerClass();
+ String className = jaxwsMetaData.getHandlerClassName();
Set<QName> soapHeaders = jaxwsMetaData.getSoapHeaders();
try
Modified: trunk/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java 2006-11-21 10:46:14 UTC (rev 1483)
+++ trunk/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java 2006-11-21 10:49:43 UTC (rev 1484)
@@ -24,8 +24,8 @@
// $Id$
import java.lang.reflect.Method;
-import java.net.URLClassLoader;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -37,8 +37,8 @@
import javax.xml.ws.Service.Mode;
import org.jboss.logging.Logger;
+import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
-import org.jboss.ws.Constants;
import org.jboss.ws.common.CommonSOAPBinding;
import org.jboss.ws.jaxrpc.Style;
import org.jboss.ws.jaxrpc.TypeMappingImpl;
@@ -70,7 +70,7 @@
}
// The parent meta data.
- private ServiceMetaData service;
+ private ServiceMetaData serviceMetaData;
// The REQUIRED endpoint config
protected WSCommonConfig endpointConfig;
@@ -89,6 +89,8 @@
private String endpointAddress;
// The endpoint interface name
private String seiName;
+ // The endpoint interface
+ private Class seiClass;
// The optional authentication method
private String authMethod;
// The optional transport guarantee
@@ -111,12 +113,12 @@
private List<HandlerMetaData> handlers = new ArrayList<HandlerMetaData>();
// True if the handlers are initialized
private boolean handlersInitialized;
- // The operation meta data cache
- private transient Map<Method,OperationMetaData> methodCache = new HashMap<Method,OperationMetaData>();
+ // Maps the java method to the operation meta data
+ private Map<Method, OperationMetaData> opMetaDataCache = new HashMap<Method, OperationMetaData>();
public EndpointMetaData(ServiceMetaData service, QName qname, QName interfaceQName, Type type)
{
- this.service = service;
+ this.serviceMetaData = service;
this.portName = qname;
this.interfaceQName = interfaceQName;
this.type = type;
@@ -127,7 +129,7 @@
public ServiceMetaData getServiceMetaData()
{
- return service;
+ return serviceMetaData;
}
public QName getQName()
@@ -148,6 +150,7 @@
public void setConfigFile(String configFile)
{
this.configFile = configFile;
+ this.endpointConfig = null;
}
public String getConfigName()
@@ -158,6 +161,7 @@
public void setConfigName(String configName)
{
this.configName = configName;
+ this.endpointConfig = null;
}
public abstract Object getEndpointConfig();
@@ -189,9 +193,20 @@
return seiName;
}
- public void setServiceEndpointInterfaceName(String endpointInterfaceName)
+ public void setServiceEndpointInterfaceName(String seiName)
{
- this.seiName = endpointInterfaceName;
+ this.seiName = seiName;
+ this.seiClass = null;
+
+ UnifiedMetaData wsMetaData = serviceMetaData.getUnifiedMetaData();
+ if (wsMetaData.isEagerInitialized())
+ {
+ if (UnifiedMetaData.isFinalRelease() == false)
+ log.warn("Set SEI name after eager initialization", new IllegalStateException());
+
+ // reinitialize
+ initializeInternal();
+ }
}
/** Get the class loader associated with the endpoint meta data */
@@ -201,28 +216,31 @@
return classLoader;
}
- /** Lazily load the SEI. The SEI class loader may not be available at creation time.
+ /**
+ * Load the service endpoint interface.
+ * It should only be cached during eager initialization.
*/
public Class getServiceEndpointInterface()
{
- String seiName = getServiceEndpointInterfaceName();
- if (seiName == null)
- throw new WSException("ServiceEndpointInterface name not available");
-
- Class seiClass = null;
- try
+ Class tmpClass = seiClass;
+ if (tmpClass == null && seiName != null)
{
- ClassLoader classLoader = getClassLoader();
- if (classLoader == null)
- throw new WSException("Class loader not available");
-
- seiClass = classLoader.loadClass(seiName);
+ try
+ {
+ ClassLoader classLoader = getClassLoader();
+ tmpClass = classLoader.loadClass(seiName);
+ if (serviceMetaData.getUnifiedMetaData().isEagerInitialized())
+ {
+ log.warn("Loading SEI after eager initialization");
+ seiClass = tmpClass;
+ }
+ }
+ catch (ClassNotFoundException ex)
+ {
+ throw new WSException("Cannot load service endpoint interface: " + seiName, ex);
+ }
}
- catch (ClassNotFoundException ex)
- {
- throw new WSException("Cannot load SEI: " + seiName, ex);
- }
- return seiClass;
+ return tmpClass;
}
public Use getEncodingStyle()
@@ -385,7 +403,14 @@
public OperationMetaData getOperation(Method method)
{
- OperationMetaData opMetaData = methodCache.get(method);
+ if (opMetaDataCache.size() == 0)
+ {
+ // This can happen when the SEI mapping was not found
+ log.warn("Access to empty operation meta data cache, reinitializing");
+ initializeInternal();
+ }
+
+ OperationMetaData opMetaData = opMetaDataCache.get(method);
if (opMetaData == null)
{
for (OperationMetaData aux : operations)
@@ -402,7 +427,7 @@
if (doesMatch)
{
- methodCache.put(method, aux);
+ opMetaDataCache.put(method, aux);
opMetaData = aux;
break;
}
@@ -459,25 +484,63 @@
this.handlersInitialized = flag;
}
+ public void validate()
+ {
+ for (HandlerMetaData handler : handlers)
+ handler.validate();
+
+ for (OperationMetaData opMetaData : operations)
+ opMetaData.validate();
+ }
+
/**
* @see UnifiedMetaData#eagerInitialize()
*/
public void eagerInitialize()
{
- for (OperationMetaData operation : operations)
- operation.eagerInitialize();
+ initializeInternal();
+ }
- TypeMappingImpl typeMapping = service.getTypeMapping();
- for (TypeMappingMetaData tmMetaData : service.getTypesMetaData().getTypeMappings())
+ private void initializeInternal()
+ {
+ eagerInitializeOperations();
+ eagerInitializeTypes();
+ }
+
+ private void eagerInitializeOperations()
+ {
+ seiClass = getServiceEndpointInterface();
+ if (seiClass != null)
{
+ List<Method> unsynchronizedMethods = new ArrayList<Method>();
+ unsynchronizedMethods.addAll(Arrays.asList(seiClass.getMethods()));
+
+ for (OperationMetaData opMetaData : operations)
+ {
+ opMetaData.eagerInitialize(unsynchronizedMethods);
+ Method method = opMetaData.getJavaMethod();
+ if (method != null)
+ {
+ opMetaDataCache.put(method, opMetaData);
+ unsynchronizedMethods.remove(method);
+ }
+ }
+ }
+ }
+
+ private void eagerInitializeTypes()
+ {
+ TypeMappingImpl typeMapping = serviceMetaData.getTypeMapping();
+ for (TypeMappingMetaData tmMetaData : serviceMetaData.getTypesMetaData().getTypeMappings())
+ {
String javaTypeName = tmMetaData.getJavaTypeName();
QName xmlType = tmMetaData.getXmlType();
if (xmlType != null)
{
- List<Class> classes = typeMapping.getJavaTypes(xmlType);
+ List<Class> registeredTypes = typeMapping.getJavaTypes(xmlType);
boolean registered = false;
- for (Class current : classes) {
+ for (Class current : registeredTypes) {
if (current.getName().equals(javaTypeName))
{
registered = true;
@@ -487,13 +550,11 @@
if (registered == false)
{
- ClassLoader classLoader = service.getUnifiedMetaData().getClassLoader();
- if (classLoader == null)
- throw new WSException("ClassLoader not available in meta data");
-
try
{
+ ClassLoader classLoader = getClassLoader();
Class javaType = JavaUtils.loadJavaType(javaTypeName, classLoader);
+
if (JavaUtils.isPrimitive(javaTypeName))
javaType = JavaUtils.getWrapperType(javaType);
Modified: trunk/src/main/java/org/jboss/ws/metadata/FaultMetaData.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/FaultMetaData.java 2006-11-21 10:46:14 UTC (rev 1483)
+++ trunk/src/main/java/org/jboss/ws/metadata/FaultMetaData.java 2006-11-21 10:49:43 UTC (rev 1484)
@@ -25,6 +25,7 @@
import javax.xml.namespace.QName;
+import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
import org.jboss.ws.jaxws.DynamicWrapperGenerator;
import org.jboss.ws.utils.JavaUtils;
@@ -38,8 +39,11 @@
*/
public class FaultMetaData
{
+ // provide logging
+ private final Logger log = Logger.getLogger(FaultMetaData.class);
+
// The parent operation
- private OperationMetaData operation;
+ private OperationMetaData opMetaData;
private QName xmlName;
private QName xmlType;
@@ -61,14 +65,14 @@
if (javaTypeName == null)
throw new IllegalArgumentException("Invalid null javaTypeName argument, for: " + xmlName);
- this.operation = operation;
+ this.opMetaData = operation;
this.xmlName = xmlName;
this.javaTypeName = javaTypeName;
}
public OperationMetaData getOperationMetaData()
{
- return operation;
+ return opMetaData;
}
public QName getXmlName()
@@ -94,59 +98,51 @@
return javaTypeName;
}
+ /** Load the java type.
+ * It should only be cached during eager initialization.
+ */
public Class getJavaType()
{
- if (javaTypeName == null)
- return null;
-
- ClassLoader loader = getClassLoader();
-
- if (javaType == null || (!javaType.isPrimitive() && javaType.getClassLoader() != loader))
+ Class tmpJavaType = javaType;
+ if (tmpJavaType == null && javaTypeName != null)
{
try
{
- javaType = JavaUtils.loadJavaType(javaTypeName, loader);
+ ClassLoader loader = opMetaData.getEndpointMetaData().getClassLoader();
+ tmpJavaType = JavaUtils.loadJavaType(javaTypeName, loader);
+
+ if (opMetaData.getEndpointMetaData().getServiceMetaData().getUnifiedMetaData().isEagerInitialized())
+ {
+ log.warn("Loading java type after eager initialization");
+ javaType = tmpJavaType;
+ }
}
catch (ClassNotFoundException ex)
{
throw new WSException("Cannot load java type: " + javaTypeName, ex);
}
}
-
- return javaType;
+ return tmpJavaType;
}
public Class getFaultBean()
{
- if (faultBeanName == null)
- return null;
-
- ClassLoader loader = getClassLoader();
-
- if (faultBean == null || (!faultBean.isPrimitive() && faultBean.getClassLoader() != loader))
+ Class tmpFaultBean = faultBean;
+ if (tmpFaultBean == null && faultBeanName != null)
{
try
{
- faultBean = JavaUtils.loadJavaType(faultBeanName, loader);
+ ClassLoader loader = opMetaData.getEndpointMetaData().getClassLoader();
+ tmpFaultBean = JavaUtils.loadJavaType(faultBeanName, loader);
}
catch (ClassNotFoundException ex)
{
throw new WSException("Cannot load fault bean: " + faultBeanName, ex);
}
}
-
- return faultBean;
+ return tmpFaultBean;
}
- private ClassLoader getClassLoader()
- {
- ClassLoader loader = operation.getEndpointMetaData().getServiceMetaData().getUnifiedMetaData().getClassLoader();
- if (loader == null)
- throw new WSException("ClassLoader not available");
-
- return loader;
- }
-
public String getFaultBeanName()
{
return faultBeanName;
@@ -159,10 +155,15 @@
public void eagerInitialize()
{
- (new DynamicWrapperGenerator(getClassLoader())).generate(this);
+ ClassLoader loader = opMetaData.getEndpointMetaData().getClassLoader();
+ new DynamicWrapperGenerator(loader).generate(this);
+
// Initialize the cache
- getJavaType();
- getFaultBean();
+ javaType = getJavaType();
+ if (javaType == null)
+ throw new WSException("Cannot load java type: " + javaTypeName);
+
+ faultBean = getFaultBean();
}
public String toString()
Modified: trunk/src/main/java/org/jboss/ws/metadata/HandlerMetaData.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/HandlerMetaData.java 2006-11-21 10:46:14 UTC (rev 1483)
+++ trunk/src/main/java/org/jboss/ws/metadata/HandlerMetaData.java 2006-11-21 10:49:43 UTC (rev 1484)
@@ -31,6 +31,9 @@
import javax.xml.namespace.QName;
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+
/**
* The common metdata data for a handler element
*
@@ -39,38 +42,43 @@
*/
public abstract class HandlerMetaData implements Serializable
{
+ // provide logging
+ private static final Logger log = Logger.getLogger(HandlerMetaData.class);
+
public enum HandlerType
{
PRE, ENDPOINT, POST, ALL
};
- private transient EndpointMetaData endpointMetaData;
+ private transient EndpointMetaData epMetaData;
// The required <handler-name> element
private String handlerName;
// The required <handler-class> element
- private String handlerClass;
+ private String handlerClassName;
// The required handler type
private HandlerType handlerType;
// The optional <soap-header> elements
private Set<QName> soapHeaders = new HashSet<QName>();
// The optional <init-param> elements
private List<HandlerInitParam> initParams = new ArrayList<HandlerInitParam>();
+ // The cached handler class
+ private Class handlerClass;
- public HandlerMetaData(EndpointMetaData endpointMetaData, HandlerType type)
+ public HandlerMetaData(EndpointMetaData epMetaData, HandlerType type)
{
- this.endpointMetaData = endpointMetaData;
+ this.epMetaData = epMetaData;
this.handlerType = type;
}
- public void setEndpointMetaData(EndpointMetaData endpointMetaData)
+ public void setEndpointMetaData(EndpointMetaData epMetaData)
{
- this.endpointMetaData = endpointMetaData;
+ this.epMetaData = epMetaData;
}
public EndpointMetaData getEndpointMetaData()
{
- return endpointMetaData;
+ return epMetaData;
}
public void setHandlerName(String value)
@@ -83,16 +91,37 @@
return handlerName;
}
- public void setHandlerClass(String handlerClass)
+ public void setHandlerClassName(String handlerClass)
{
- this.handlerClass = handlerClass;
+ this.handlerClassName = handlerClass;
}
- public String getHandlerClass()
+ public String getHandlerClassName()
{
- return handlerClass;
+ return handlerClassName;
}
+ public Class getHandlerClass()
+ {
+ if (handlerClassName == null)
+ throw new IllegalStateException("Handler class name cannot be null");
+
+ Class localClass = handlerClass;
+ if (localClass == null)
+ {
+ try
+ {
+ ClassLoader loader = epMetaData.getClassLoader();
+ localClass = loader.loadClass(handlerClassName);
+ }
+ catch (ClassNotFoundException ex)
+ {
+ throw new WSException("Cannot load handler: " + handlerClassName, ex);
+ }
+ }
+ return localClass;
+ }
+
public HandlerType getHandlerType()
{
return handlerType;
@@ -118,8 +147,30 @@
return initParams;
}
- public static class HandlerInitParam
+ public void validate()
{
+ List<String> securityHandlers = new ArrayList<String>();
+ securityHandlers.add(org.jboss.ws.wsse.jaxrpc.WSSecurityHandlerInbound.class.getName());
+ securityHandlers.add(org.jboss.ws.wsse.jaxrpc.WSSecurityHandlerOutbound.class.getName());
+ securityHandlers.add(org.jboss.ws.wsse.jaxws.WSSecurityHandlerInbound.class.getName());
+ securityHandlers.add(org.jboss.ws.wsse.jaxws.WSSecurityHandlerOutbound.class.getName());
+
+ if (securityHandlers.contains(handlerClassName))
+ {
+ if (epMetaData.getServiceMetaData().getSecurityConfiguration() == null)
+ log.warn("WS-Security requires security configuration");
+ }
+ }
+
+ public void eagerInitialize()
+ {
+ handlerClass = getHandlerClass();
+ }
+
+ public static class HandlerInitParam implements Serializable
+ {
+ private static final long serialVersionUID = -8687875291620457318L;
+
// The required <handler-name> element
private String paramName;
// The required <handler-class> element
@@ -135,7 +186,6 @@
this.paramName = paramName;
}
-
public String getParamValue()
{
return paramValue;
Modified: trunk/src/main/java/org/jboss/ws/metadata/OperationMetaData.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/OperationMetaData.java 2006-11-21 10:46:14 UTC (rev 1483)
+++ trunk/src/main/java/org/jboss/ws/metadata/OperationMetaData.java 2006-11-21 10:49:43 UTC (rev 1484)
@@ -155,63 +155,70 @@
{
return javaName;
}
-
- /** Lazily load the java method. The SEI class loader may not be available at creation time
- */
+
public Method getJavaMethod()
{
- ClassLoader loader = getEndpointMetaData().getServiceMetaData().getUnifiedMetaData().getClassLoader();
- if (javaMethod == null || javaMethod.getDeclaringClass().getClassLoader().equals(loader) == false)
+ Method tmpMethod = javaMethod;
+ Class seiClass = epMetaData.getServiceEndpointInterface();
+ if (tmpMethod == null && seiClass != null)
{
- javaMethod = null;
- try
+ for (Method method : seiClass.getMethods())
{
- Class seiClass = epMetaData.getServiceEndpointInterface();
- if (seiClass == null)
- throw new WSException("ServiceEndpointInterface not available");
-
- for (Method method : seiClass.getMethods())
+ if (isJavaMethod(method))
{
- String methodName = method.getName();
-
- if (javaName.equals(methodName))
+ tmpMethod = method;
+
+ UnifiedMetaData wsMetaData = epMetaData.getServiceMetaData().getUnifiedMetaData();
+ if (wsMetaData.isEagerInitialized())
{
- log.trace("Found java method: " + method);
+ if (UnifiedMetaData.isFinalRelease() == false)
+ log.warn("Loading java method after eager initialization", new IllegalStateException());
+
+ javaMethod = method;
+ }
+
+ break;
+ }
+ }
+
+ if (tmpMethod == null)
+ throw new WSException("Cannot find java method: " + javaName);
+ }
+ return tmpMethod;
+ }
- // compare params by java type name
- if (matchParameters(method, true))
- {
- log.debug("Found best matching java method: " + method);
- javaMethod = method;
- break;
- }
+ public boolean isJavaMethod(Method method)
+ {
+ boolean isJavaMethod = method.equals(javaMethod);
+ if (isJavaMethod == false)
+ {
+ String methodName = method.getName();
+ if (javaName.equals(methodName))
+ {
+ log.trace("Found java method: " + method);
- // compare params by assignability
- if (matchParameters(method, false))
- {
- log.debug("Found possible matching java method: " + method);
- javaMethod = method;
- // continue on, in case there is a better matching method
- }
- }
+ // compare params by java type name
+ if (matchParameters(method, true))
+ {
+ log.debug("Found best matching java method: " + method);
+ isJavaMethod = true;
}
- if (javaMethod == null)
- throw new WSException("Cannot find java method: " + javaName);
+ // compare params by assignability
+ if (!isJavaMethod && matchParameters(method, false))
+ {
+ log.debug("Found possible matching java method: " + method);
+ isJavaMethod = true;
+ }
}
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new WSException("Cannot load java method: " + javaName);
- }
}
-
- return javaMethod;
+
+ if (log.isTraceEnabled())
+ log.trace("Synchronized java method:\n" + method + "\nwith: " + toString());
+
+ return isJavaMethod;
}
-
+
private boolean matchParameters(Method method, boolean exact)
{
Class[] paramTypes = method.getParameterTypes();
@@ -439,8 +446,11 @@
/**
* @see UnifiedMetaData#eagerInitialize()
*/
- public void eagerInitialize()
+ public void eagerInitialize(List<Method> unsynchronizedMethods)
{
+ // reset java method
+ javaMethod = null;
+
for (ParameterMetaData parameter : parameters)
parameter.eagerInitialize();
@@ -449,6 +459,28 @@
for (FaultMetaData fault : faults)
fault.eagerInitialize();
+
+ // Method initialization
+ for (Method method : unsynchronizedMethods)
+ {
+ if (isJavaMethod(method))
+ {
+ javaMethod = method;
+ break;
+ }
+ }
+
+ // Report unsynchronized java method
+ if (javaMethod == null)
+ {
+ StringBuilder errMsg = new StringBuilder("Cannot synchronize to any of these methods:");
+ for (Method method : unsynchronizedMethods)
+ {
+ errMsg.append("\n" + method);
+ }
+ errMsg.append("\n" + toString());
+ throw new IllegalStateException(errMsg.toString());
+ }
}
public String toString()
Modified: trunk/src/main/java/org/jboss/ws/metadata/ParameterMetaData.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/ParameterMetaData.java 2006-11-21 10:46:14 UTC (rev 1483)
+++ trunk/src/main/java/org/jboss/ws/metadata/ParameterMetaData.java 2006-11-21 10:49:43 UTC (rev 1484)
@@ -52,8 +52,9 @@
*/
public class ParameterMetaData
{
- private static Logger log = Logger.getLogger(ParameterMetaData.class);
-
+ // provide logging
+ private final Logger log = Logger.getLogger(ParameterMetaData.class);
+
// The parent operation
private OperationMetaData opMetaData;
@@ -170,31 +171,42 @@
return javaTypeName;
}
- public void setJavaTypeName(String javaTypeName)
+ public void setJavaTypeName(String typeName)
{
- this.javaTypeName = javaTypeName;
+ // Warn if this is called after eager initialization
+ UnifiedMetaData wsMetaData = opMetaData.getEndpointMetaData().getServiceMetaData().getUnifiedMetaData();
+ if (wsMetaData.isEagerInitialized() && UnifiedMetaData.isFinalRelease() == false)
+ log.warn("Set java type name after eager initialization", new IllegalStateException());
+
+ javaTypeName = typeName;
+ javaType = null;
}
+ /** Load the java type.
+ * It should only be cached during eager initialization.
+ */
public Class getJavaType()
{
- ClassLoader loader = getClassLoader();
-
- if (javaTypeName == null)
- return null;
-
- if (javaType == null || ((!javaType.isPrimitive()) && javaType.getClassLoader() != loader))
+ Class tmpJavaType = javaType;
+ if (tmpJavaType == null && javaTypeName != null)
{
try
{
- javaType = JavaUtils.loadJavaType(javaTypeName, loader);
+ ClassLoader loader = opMetaData.getEndpointMetaData().getClassLoader();
+ tmpJavaType = JavaUtils.loadJavaType(javaTypeName, loader);
+
+ if (opMetaData.getEndpointMetaData().getServiceMetaData().getUnifiedMetaData().isEagerInitialized())
+ {
+ // This should not happen, see the warning in setJavaTypeName
+ javaType = tmpJavaType;
+ }
}
catch (ClassNotFoundException ex)
{
throw new WSException("Cannot load java type: " + javaTypeName, ex);
}
}
-
- return javaType;
+ return tmpJavaType;
}
public ParameterMode getMode()
@@ -341,8 +353,9 @@
wrapped.setAccessor(factory.create(wrapped));
}
- // Initialize the cache
- getJavaType();
+ javaType = getJavaType();
+ if (javaType == null)
+ throw new WSException("Cannot load java type: " + javaTypeName);
}
private ClassLoader getClassLoader()
Modified: trunk/src/main/java/org/jboss/ws/metadata/ServiceMetaData.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/ServiceMetaData.java 2006-11-21 10:46:14 UTC (rev 1483)
+++ trunk/src/main/java/org/jboss/ws/metadata/ServiceMetaData.java 2006-11-21 10:49:43 UTC (rev 1484)
@@ -41,6 +41,7 @@
import org.jboss.ws.jaxrpc.TypeMappingRegistryImpl;
import org.jboss.ws.jaxrpc.Use;
import org.jboss.ws.jbossxb.SchemaBindingBuilder;
+import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMappingFactory;
import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
@@ -339,6 +340,26 @@
return schemaBinding;
}
+ public void validate()
+ {
+ // Validate that there is at least one handler configured
+ // if we have a security configuration
+ if (securityConfiguration != null)
+ {
+ int handlerCount = 0;
+ for (EndpointMetaData epMetaData : endpoints.values())
+ {
+ handlerCount += epMetaData.getHandlerMetaData(HandlerType.ALL).size();
+ }
+ if (handlerCount == 0)
+ log.warn("WS-Security requires a security handler to be configured");
+ }
+
+ // Validate endpoints
+ for (EndpointMetaData epMetaData : endpoints.values())
+ epMetaData.validate();
+ }
+
/**
* @see UnifiedMetaData#eagerInitialize()
*/
@@ -351,7 +372,7 @@
WSDLTypes types = definitions.getWsdlTypes();
if (types != null)
{
- JBossXSModel model = WSDLUtils.getSchemaModel(types);;
+ JBossXSModel model = WSDLUtils.getSchemaModel(types);
if (model != null)
model.eagerInitialize();
}
Modified: trunk/src/main/java/org/jboss/ws/metadata/UnifiedMetaData.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/UnifiedMetaData.java 2006-11-21 10:46:14 UTC (rev 1483)
+++ trunk/src/main/java/org/jboss/ws/metadata/UnifiedMetaData.java 2006-11-21 10:49:43 UTC (rev 1484)
@@ -29,6 +29,7 @@
import java.util.Map;
import java.util.StringTokenizer;
+import org.jboss.logging.Logger;
import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
import org.jboss.ws.server.ServiceEndpointManager;
@@ -49,6 +50,9 @@
*/
public class UnifiedMetaData
{
+ // provide logging
+ private static Logger log = Logger.getLogger(UnifiedMetaData.class);
+
// The canonical deployment name
private String deploymentName;
// The modules class loader
@@ -58,7 +62,7 @@
// The implementation version
private static String implementationVersion;
// True if this is a final release
- private static boolean isDevRelease;
+ private static boolean isFinalRelease;
// Map<String, WSDLDefinitions> the wsdl-file to the wsdl Document
// Note the same wsdl can be used in multiple webservice descriptions
Map<String, WSDLDefinitions> wsdlMap = new HashMap<String, WSDLDefinitions>();
@@ -67,20 +71,11 @@
Map<String, JavaWsdlMapping> jaxrpcMap = new HashMap<String, JavaWsdlMapping>();
// The list of service meta data
private List<ServiceMetaData> services = new ArrayList<ServiceMetaData>();
-
// Used by eager initialization
- private boolean initialized = false;
+ private boolean eagerInitialized;
+ // Used by validate
+ private boolean validated;
- public String getDeploymentName()
- {
- return deploymentName;
- }
-
- public void setDeploymentName(String deploymentName)
- {
- this.deploymentName = deploymentName;
- }
-
public UnifiedMetaData()
{
this.classLoader = Thread.currentThread().getContextClassLoader();
@@ -88,6 +83,9 @@
public ClassLoader getClassLoader()
{
+ if (classLoader == null)
+ throw new IllegalStateException ("Class loader not available");
+
return classLoader;
}
@@ -96,6 +94,16 @@
this.classLoader = classLoader;
}
+ public String getDeploymentName()
+ {
+ return deploymentName;
+ }
+
+ public void setDeploymentName(String deploymentName)
+ {
+ this.deploymentName = deploymentName;
+ }
+
public String getSecurityDomain()
{
return securityDomain;
@@ -140,6 +148,23 @@
return jaxrpcMap.get(jaxrpcFile);
}
+ public void validate()
+ {
+ if (validated == false)
+ {
+ for (ServiceMetaData service : services)
+ {
+ service.validate();
+ }
+ validated = true;
+ }
+ }
+
+ public boolean isEagerInitialized()
+ {
+ return eagerInitialized;
+ }
+
/**
* Eagerly initialize all cache values that are normally lazy-loaded. This
* allows for concurrent read-only access to a <code>UnifiedMetaData</code>
@@ -147,12 +172,14 @@
*/
public void eagerInitialize()
{
- if (initialized == false)
+ if (eagerInitialized == false)
{
+ log.debug("Eagerly initialize the meta data model");
for (ServiceMetaData service : services)
+ {
service.eagerInitialize();
-
- initialized = true;
+ }
+ eagerInitialized = true;
}
}
@@ -161,15 +188,16 @@
if (implementationVersion == null)
{
implementationVersion = ServiceEndpointManager.class.getPackage().getImplementationVersion();
- isDevRelease = new StringTokenizer(implementationVersion).nextToken().endsWith(".DEV");
+ if (implementationVersion != null)
+ isFinalRelease = new StringTokenizer(implementationVersion).nextToken().endsWith(".GA");
}
return implementationVersion;
}
- public static boolean isDevRelease()
+ public static boolean isFinalRelease()
{
getImplementationVersion();
- return isDevRelease;
+ return isFinalRelease;
}
public String toString()
@@ -188,4 +216,4 @@
}
return buffer.toString();
}
-}
\ No newline at end of file
+}
Modified: trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedHandlerMetaData.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedHandlerMetaData.java 2006-11-21 10:46:14 UTC (rev 1483)
+++ trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedHandlerMetaData.java 2006-11-21 10:49:43 UTC (rev 1484)
@@ -147,7 +147,7 @@
{
HandlerMetaDataJAXRPC hmd = new HandlerMetaDataJAXRPC(epMetaData, type);
hmd.setHandlerName(getHandlerName());
- hmd.setHandlerClass(getHandlerClass());
+ hmd.setHandlerClassName(getHandlerClass());
hmd.seiInitParams(getInitParams());
hmd.setSoapHeaders(getSoapHeaders());
hmd.setSoapRoles(getSoapRoles());
@@ -159,7 +159,7 @@
{
HandlerMetaDataJAXWS hmd = new HandlerMetaDataJAXWS(epMetaData, type);
hmd.setHandlerName(getHandlerName());
- hmd.setHandlerClass(getHandlerClass());
+ hmd.setHandlerClassName(getHandlerClass());
hmd.seiInitParams(getInitParams());
hmd.setProtocolBindings(getProtocolBindings());
hmd.setServiceNamePattern(getServiceNamePattern());
Modified: trunk/src/main/java/org/jboss/ws/server/ServiceEndpoint.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/server/ServiceEndpoint.java 2006-11-21 10:46:14 UTC (rev 1483)
+++ trunk/src/main/java/org/jboss/ws/server/ServiceEndpoint.java 2006-11-21 10:49:43 UTC (rev 1484)
@@ -36,7 +36,6 @@
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPMessage;
-import org.jboss.kernel.Kernel;
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
import org.jboss.ws.binding.BindingException;
@@ -105,7 +104,7 @@
ServerEndpointMetaData epMetaData = seInfo.getServerEndpointMetaData();
UnifiedMetaData wsMetaData = epMetaData.getServiceMetaData().getUnifiedMetaData();
wsMetaData.eagerInitialize();
-
+
seMetrics.start();
seInfo.setState(State.STARTED);
}
Modified: trunk/src/main/java/org/jboss/ws/soap/SOAPBodyImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/soap/SOAPBodyImpl.java 2006-11-21 10:46:14 UTC (rev 1483)
+++ trunk/src/main/java/org/jboss/ws/soap/SOAPBodyImpl.java 2006-11-21 10:49:43 UTC (rev 1484)
@@ -284,7 +284,7 @@
// DOM expansion should only happen when a handler accesses the DOM API.
// We do not allow DOM expansion on a dev release.
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
- if (msgContext != null && UnifiedMetaData.isDevRelease())
+ if (msgContext != null && UnifiedMetaData.isFinalRelease() == false)
{
Boolean allowExpand = (Boolean)msgContext.getProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM);
if (Boolean.TRUE.equals(allowExpand) == false)
Modified: trunk/src/main/java/org/jboss/ws/soap/SOAPContentElement.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/soap/SOAPContentElement.java 2006-11-21 10:46:14 UTC (rev 1483)
+++ trunk/src/main/java/org/jboss/ws/soap/SOAPContentElement.java 2006-11-21 10:49:43 UTC (rev 1484)
@@ -811,7 +811,7 @@
// DOM expansion should only happen when a handler accesses the DOM API.
// We do not allow DOM expansion on a dev release.
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
- if (msgContext != null && UnifiedMetaData.isDevRelease())
+ if (msgContext != null && UnifiedMetaData.isFinalRelease() == false)
{
Boolean allowExpand = (Boolean)msgContext.getProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM);
if (Boolean.TRUE.equals(allowExpand) == false)
Modified: trunk/src/main/java/org/jboss/ws/tools/metadata/ToolsUnifiedMetaDataBuilder.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/tools/metadata/ToolsUnifiedMetaDataBuilder.java 2006-11-21 10:46:14 UTC (rev 1483)
+++ trunk/src/main/java/org/jboss/ws/tools/metadata/ToolsUnifiedMetaDataBuilder.java 2006-11-21 10:49:43 UTC (rev 1484)
@@ -84,6 +84,7 @@
throw new WSException("A service endpoint interface should extend Remote");
um = new UnifiedMetaData();
+ um.setClassLoader(Thread.currentThread().getContextClassLoader());
String seiName = WSDLUtils.getInstance().getJustClassName(seiClass.getName());
if (serviceName == null)
Modified: trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/dynamichandler/DynamicHandlerTestCase.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/dynamichandler/DynamicHandlerTestCase.java 2006-11-21 10:46:14 UTC (rev 1483)
+++ trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/dynamichandler/DynamicHandlerTestCase.java 2006-11-21 10:49:43 UTC (rev 1484)
@@ -106,7 +106,7 @@
while (it.hasNext())
{
HandlerMetaData handlerMetaData = it.next();
- if (handlerMetaData.getHandlerClass().equals(ServerSideHandler.class.getName()))
+ if (handlerMetaData.getHandlerClassName().equals(ServerSideHandler.class.getName()))
it.remove();
}
server.invoke(oname, "stopServiceEndpoint", new Object[]{serviceID}, new String[]{"javax.management.ObjectName"});
Modified: trunk/src/test/java/org/jboss/test/ws/jaxws/jbws860/JBWS860TestCase.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jaxws/jbws860/JBWS860TestCase.java 2006-11-21 10:46:14 UTC (rev 1483)
+++ trunk/src/test/java/org/jboss/test/ws/jaxws/jbws860/JBWS860TestCase.java 2006-11-21 10:49:43 UTC (rev 1484)
@@ -57,7 +57,7 @@
assertNotNull(wsdlDef);
}
- public void testHervletAccess() throws Exception
+ public void testServletAccess() throws Exception
{
HttpURLConnection con = (HttpURLConnection)new URL("http://" + getServerHost() + ":8080/test/TestServlet").openConnection();
BufferedReader isr = new BufferedReader(new InputStreamReader(con.getInputStream()));
Modified: trunk/src/test/java/org/jboss/test/ws/jaxws/jbws944/EJB3Bean01.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jaxws/jbws944/EJB3Bean01.java 2006-11-21 10:46:14 UTC (rev 1483)
+++ trunk/src/test/java/org/jboss/test/ws/jaxws/jbws944/EJB3Bean01.java 2006-11-21 10:49:43 UTC (rev 1484)
@@ -31,9 +31,11 @@
@WebService(name = "EJB3Bean", targetNamespace = "http://org.jboss.ws/jbws944")
@SOAPBinding(style = SOAPBinding.Style.RPC)
+
@Remote(EJB3RemoteInterface.class)
@RemoteBinding(jndiBinding = "/ejb3/EJB3EndpointInterface")
@Stateless(name = "FooBean01")
+
public class EJB3Bean01 implements EJB3RemoteInterface
{
@WebMethod
Modified: trunk/src/test/java/org/jboss/test/ws/jaxws/jbws944/JBWS944TestCase.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jaxws/jbws944/JBWS944TestCase.java 2006-11-21 10:46:14 UTC (rev 1483)
+++ trunk/src/test/java/org/jboss/test/ws/jaxws/jbws944/JBWS944TestCase.java 2006-11-21 10:49:43 UTC (rev 1484)
@@ -36,7 +36,9 @@
import org.jboss.ws.metadata.wsdl.WSDLDefinitionsFactory;
/**
- * Tests JBWS-944
+ * EJB3 jmx name is incorrectly derrived
+ *
+ * http://jira.jboss.org/jira/browse/JBWS-944
*
* @author Thomas.Diesler(a)jboss.org
* @author Jason.Greene(a)jboss.com
Modified: trunk/src/test/resources/jaxws/samples/jsr181ejb/wstools-config.xml
===================================================================
--- trunk/src/test/resources/jaxws/samples/jsr181ejb/wstools-config.xml 2006-11-21 10:46:14 UTC (rev 1483)
+++ trunk/src/test/resources/jaxws/samples/jsr181ejb/wstools-config.xml 2006-11-21 10:49:43 UTC (rev 1484)
@@ -8,6 +8,9 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.jboss.org/jbossws-tools http://www.jboss.org/jbossws-tools/schema/jbossws-tool_1_0.xsd">
+ <global>
+ <package-namespace package="org.jboss.test.ws.jaxws.samples.jsr181ejb" namespace="http://org.jboss.ws/samples/jsr181ejb"/>
+ </global>
<wsdl-java file="resources/jaxws/samples/jsr181ejb/META-INF/wsdl/TestService.wsdl">
<mapping file="jaxrpc-mapping.xml" />
</wsdl-java>
Modified: trunk/src/test/resources/jaxws/samples/jsr181pojo/wstools-config.xml
===================================================================
--- trunk/src/test/resources/jaxws/samples/jsr181pojo/wstools-config.xml 2006-11-21 10:46:14 UTC (rev 1483)
+++ trunk/src/test/resources/jaxws/samples/jsr181pojo/wstools-config.xml 2006-11-21 10:49:43 UTC (rev 1484)
@@ -8,6 +8,9 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.jboss.org/jbossws-tools http://www.jboss.org/jbossws-tools/schema/jbossws-tool_1_0.xsd">
+ <global>
+ <package-namespace package="org.jboss.test.ws.jaxws.samples.jsr181pojo" namespace="http://org.jboss.ws/samples/jsr181pojo"/>
+ </global>
<wsdl-java file="resources/jaxws/samples/jsr181pojo/META-INF/wsdl/TestService.wsdl">
<mapping file="jaxrpc-mapping.xml" />
</wsdl-java>
Modified: trunk/src/test/resources/jaxws/samples/wsaddressing/wstools-config.xml
===================================================================
--- trunk/src/test/resources/jaxws/samples/wsaddressing/wstools-config.xml 2006-11-21 10:46:14 UTC (rev 1483)
+++ trunk/src/test/resources/jaxws/samples/wsaddressing/wstools-config.xml 2006-11-21 10:49:43 UTC (rev 1484)
@@ -8,6 +8,9 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.jboss.org/jbossws-tools http://www.jboss.org/jbossws-tools/schema/jbossws-tool_1_0.xsd">
+ <global>
+ <package-namespace package="org.jboss.test.ws.jaxws.samples.wsaddressing" namespace="http://org.jboss.ws/samples/wsaddressing"/>
+ </global>
<wsdl-java file="resources/jaxws/samples/wsaddressing/META-INF/wsdl/TestService.wsdl">
<mapping file="jaxrpc-mapping.xml"/>
</wsdl-java>
Modified: trunk/src/test/resources/jaxws/wsaddressing/replyto/Initial-META-INF/jaxrpc-mapping.xml
===================================================================
--- trunk/src/test/resources/jaxws/wsaddressing/replyto/Initial-META-INF/jaxrpc-mapping.xml 2006-11-21 10:46:14 UTC (rev 1483)
+++ trunk/src/test/resources/jaxws/wsaddressing/replyto/Initial-META-INF/jaxrpc-mapping.xml 2006-11-21 10:49:43 UTC (rev 1484)
@@ -1,10 +1,10 @@
<?xml version='1.0' encoding='UTF-8'?><java-wsdl-mapping version='1.1' xmlns='http://java.sun.com/xml/ns/j2ee' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://java.sun.com/xml/ns/j2ee http://www.ibm.com/webservices/xsd/j2ee_jaxrpc_mapping_1_1.xsd'>
<package-mapping>
- <package-type>ws.jboss.org.addressing.replyto</package-type>
+ <package-type>org.jboss.test.ws.jaxws.wsaddressing.replyto</package-type>
<namespaceURI>http://org.jboss.ws/addressing/replyto</namespaceURI>
</package-mapping>
<service-interface-mapping>
- <service-interface>ws.jboss.org.addressing.replyto.InitialEndpointService</service-interface>
+ <service-interface>org.jboss.test.ws.jaxws.wsaddressing.replyto.InitialEndpointService</service-interface>
<wsdl-service-name xmlns:serviceNS='http://org.jboss.ws/addressing/replyto'>serviceNS:InitialEndpointService</wsdl-service-name>
<port-mapping>
<port-name>InitialEndpointPort</port-name>
@@ -12,7 +12,7 @@
</port-mapping>
</service-interface-mapping>
<service-endpoint-interface-mapping>
- <service-endpoint-interface>ws.jboss.org.addressing.replyto.InitialEndpoint</service-endpoint-interface>
+ <service-endpoint-interface>org.jboss.test.ws.jaxws.wsaddressing.replyto.InitialEndpoint</service-endpoint-interface>
<wsdl-port-type xmlns:portTypeNS='http://org.jboss.ws/addressing/replyto'>portTypeNS:InitialEndpoint</wsdl-port-type>
<wsdl-binding xmlns:bindingNS='http://org.jboss.ws/addressing/replyto'>bindingNS:InitialEndpointBinding</wsdl-binding>
<service-endpoint-method-mapping>
Modified: trunk/src/test/resources/jaxws/wsaddressing/replyto/Initial-META-INF/wstools-config.xml
===================================================================
--- trunk/src/test/resources/jaxws/wsaddressing/replyto/Initial-META-INF/wstools-config.xml 2006-11-21 10:46:14 UTC (rev 1483)
+++ trunk/src/test/resources/jaxws/wsaddressing/replyto/Initial-META-INF/wstools-config.xml 2006-11-21 10:49:43 UTC (rev 1484)
@@ -8,6 +8,9 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.jboss.org/jbossws-tools http://www.jboss.org/jbossws-tools/schema/jbossws-tool_1_0.xsd">
+ <global>
+ <package-namespace package="org.jboss.test.ws.jaxws.wsaddressing.replyto" namespace="http://org.jboss.ws/addressing/replyto"/>
+ </global>
<wsdl-java file="http://localhost:8080/jaxws-wsaddressing-initial/InitialService?wsdl">
<mapping file="jaxrpc-mapping.xml" />
</wsdl-java>
Modified: trunk/src/test/resources/jaxws/wsaddressing/replyto/ReplyTo-META-INF/wstools-config.xml
===================================================================
--- trunk/src/test/resources/jaxws/wsaddressing/replyto/ReplyTo-META-INF/wstools-config.xml 2006-11-21 10:46:14 UTC (rev 1483)
+++ trunk/src/test/resources/jaxws/wsaddressing/replyto/ReplyTo-META-INF/wstools-config.xml 2006-11-21 10:49:43 UTC (rev 1484)
@@ -8,6 +8,9 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.jboss.org/jbossws-tools http://www.jboss.org/jbossws-tools/schema/jbossws-tool_1_0.xsd">
+ <global>
+ <package-namespace package="org.jboss.test.ws.jaxws.wsaddressing.replyto" namespace="http://org.jboss.ws/addressing/replyto"/>
+ </global>
<wsdl-java file="http://localhost:8080/jaxws-wsaddressing-replyto/ReplyToService?wsdl">
<mapping file="jaxrpc-mapping.xml" />
</wsdl-java>
17 years, 11 months
JBossWS SVN: r1483 - in trunk/src: main/java/org/jboss/ws/addressing main/java/org/jboss/ws/soap main/java/org/jboss/ws/utils test/java/org/jboss/test/ws/common/soap test/java/org/jboss/test/ws/common/utils test/java/org/jboss/test/ws/jaxrpc/wsse test/java/org/jboss/test/ws/jaxws/wsaddressing
by jbossws-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2006-11-21 05:46:14 -0500 (Tue, 21 Nov 2006)
New Revision: 1483
Modified:
trunk/src/main/java/org/jboss/ws/addressing/EndpointReferenceImpl.java
trunk/src/main/java/org/jboss/ws/soap/SOAPContentElement.java
trunk/src/main/java/org/jboss/ws/soap/SOAPHeaderElementImpl.java
trunk/src/main/java/org/jboss/ws/utils/DOMWriter.java
trunk/src/test/java/org/jboss/test/ws/common/soap/SOAPHeaderElementTestCase.java
trunk/src/test/java/org/jboss/test/ws/common/utils/DOMWriterTestCase.java
trunk/src/test/java/org/jboss/test/ws/jaxrpc/wsse/MicrosoftInteropTestCase.java
trunk/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/EndpointReferenceTestCase.java
trunk/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/SOAPAddressingPropertiesTestCase.java
Log:
[JBWS-1130] Consolidate namespace declarations
Modified: trunk/src/main/java/org/jboss/ws/addressing/EndpointReferenceImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/addressing/EndpointReferenceImpl.java 2006-11-21 10:44:00 UTC (rev 1482)
+++ trunk/src/main/java/org/jboss/ws/addressing/EndpointReferenceImpl.java 2006-11-21 10:46:14 UTC (rev 1483)
@@ -24,6 +24,7 @@
//$Id$
import java.io.IOException;
+import java.io.StringWriter;
import java.net.URI;
import java.util.Iterator;
import java.util.List;
@@ -38,10 +39,10 @@
import javax.xml.ws.addressing.ReferenceParameters;
import javax.xml.ws.addressing.soap.SOAPAddressingBuilder;
+import org.jboss.ws.WSException;
+import org.jboss.ws.addressing.soap.SOAPAddressingBuilderImpl;
import org.jboss.ws.utils.DOMUtils;
import org.jboss.ws.utils.DOMWriter;
-import org.jboss.ws.WSException;
-import org.jboss.ws.addressing.soap.SOAPAddressingBuilderImpl;
import org.w3c.dom.Element;
/**
@@ -267,7 +268,10 @@
{
if (obj instanceof Element)
{
- String xmlFragment = DOMWriter.printNode((Element)obj, false);
+ StringWriter strwr = new StringWriter();
+ DOMWriter domWriter = new DOMWriter(strwr).setCompleteNamespaces(false);
+ domWriter.print((Element)obj);
+ String xmlFragment = strwr.toString();
xmlBuffer.append(xmlFragment);
}
else if (obj instanceof String)
Modified: trunk/src/main/java/org/jboss/ws/soap/SOAPContentElement.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/soap/SOAPContentElement.java 2006-11-21 10:44:00 UTC (rev 1482)
+++ trunk/src/main/java/org/jboss/ws/soap/SOAPContentElement.java 2006-11-21 10:46:14 UTC (rev 1483)
@@ -23,6 +23,18 @@
// $Id$
+import java.io.IOException;
+import java.io.Writer;
+import java.lang.reflect.Array;
+import java.lang.reflect.Method;
+import java.util.Iterator;
+
+import javax.activation.DataHandler;
+import javax.xml.namespace.QName;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
@@ -41,19 +53,14 @@
import org.jboss.ws.utils.DOMWriter;
import org.jboss.ws.utils.JavaUtils;
import org.jboss.ws.xop.XOPContext;
-import org.w3c.dom.*;
+import org.w3c.dom.Attr;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.TypeInfo;
-import javax.activation.DataHandler;
-import javax.xml.namespace.QName;
-import javax.xml.soap.Name;
-import javax.xml.soap.SOAPElement;
-import javax.xml.soap.SOAPException;
-import java.io.IOException;
-import java.io.Writer;
-import java.lang.reflect.Array;
-import java.lang.reflect.Method;
-import java.util.Iterator;
-
/**
* A SOAPElement that gives access to its content as XML fragment or Java object.
*
@@ -126,7 +133,7 @@
{
return getParamMetaData().getJavaType();
}
-
+
public boolean isDOMValid()
{
return isDOMValid;
@@ -965,24 +972,17 @@
}
}
- public void writeElement(Writer writer) {
- try
+ public void writeElement(Writer writer) throws IOException
+ {
+ handleMTOMTransitions();
+
+ if (isDOMValid)
{
- handleMTOMTransitions();
-
- if(isDOMValid)
- {
- new DOMWriter(writer).print(this);
- }
- else
- {
- writer.write( getXMLFragment() );
- }
-
+ new DOMWriter(writer).print(this);
}
- catch (Exception e)
+ else
{
- throw new WSException("Failed to write SOAPContentElement ", e);
+ writer.write(getXMLFragment());
}
}
@@ -998,11 +998,12 @@
* it's needs to be decided wether or not the <code>xop:Include</code> should be restored.
* This as well depends upon the message context property.
*/
- public void handleMTOMTransitions() {
+ public void handleMTOMTransitions()
+ {
boolean mtomEnabled = isXOPParameter() && XOPContext.isMTOMEnabled();
- if( paramMetaData != null && mtomEnabled == false )
+ if (paramMetaData != null && mtomEnabled == false)
{
// If MTOM is disabled, we force dom expansion.
// This will inline any XOP include element
@@ -1014,7 +1015,7 @@
msgContext.setProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM, Boolean.TRUE);
expandToDOM();
}
- else if(isDOMValid && mtomEnabled )
+ else if (isDOMValid && mtomEnabled)
{
// When the DOM representation is valid,
// and MTOM is enabled we need to convert the inlined
@@ -1030,7 +1031,9 @@
{
return paramMetaData != null && paramMetaData.isXOP();
}
- public void accept(SAAJVisitor visitor) {
+
+ public void accept(SAAJVisitor visitor)
+ {
visitor.visitSOAPContentElement(this);
}
}
Modified: trunk/src/main/java/org/jboss/ws/soap/SOAPHeaderElementImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/soap/SOAPHeaderElementImpl.java 2006-11-21 10:44:00 UTC (rev 1482)
+++ trunk/src/main/java/org/jboss/ws/soap/SOAPHeaderElementImpl.java 2006-11-21 10:46:14 UTC (rev 1483)
@@ -21,8 +21,16 @@
*/
package org.jboss.ws.soap;
+import java.io.IOException;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
import javax.xml.soap.Name;
import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPHeader;
import javax.xml.soap.SOAPHeaderElement;
@@ -87,4 +95,48 @@
super.setParentElement(parent);
}
+
+ @Override
+ public void writeElement(Writer writer) throws IOException
+ {
+ StringWriter strwr = new StringWriter(256);
+ super.writeElement(strwr);
+
+ SOAPHeader soapHeader = (SOAPHeader)getParentElement();
+ SOAPEnvelope soapEnvelope = (SOAPEnvelope)soapHeader.getParentElement();
+
+ // Find known namespace declarations
+ List<String> knownNamespaces = new ArrayList<String>();
+ Iterator prefixes = soapEnvelope.getNamespacePrefixes();
+ while (prefixes.hasNext())
+ {
+ String prefix = (String)prefixes.next();
+ String nsURI = soapEnvelope.getNamespaceURI(prefix);
+ String xmlns = " xmlns:" + prefix + "='" + nsURI + "'";
+ knownNamespaces.add(xmlns);
+ }
+ prefixes = soapHeader.getNamespacePrefixes();
+ while (prefixes.hasNext())
+ {
+ String prefix = (String)prefixes.next();
+ String nsURI = soapHeader.getNamespaceURI(prefix);
+ String xmlns = " xmlns:" + prefix + "='" + nsURI + "'";
+ knownNamespaces.add(xmlns);
+ }
+
+ // Remove known namespace declarations
+ String xmlFragment = strwr.toString();
+ for (String xmlns : knownNamespaces)
+ {
+ int start = xmlFragment.indexOf(xmlns);
+ while (start > 0)
+ {
+ int end = start + xmlns.length();
+ xmlFragment = xmlFragment.substring(0, start) + xmlFragment.substring(end);
+ start = xmlFragment.indexOf(xmlns);
+ }
+ }
+
+ writer.write(xmlFragment);
+ }
}
Modified: trunk/src/main/java/org/jboss/ws/utils/DOMWriter.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/utils/DOMWriter.java 2006-11-21 10:44:00 UTC (rev 1482)
+++ trunk/src/main/java/org/jboss/ws/utils/DOMWriter.java 2006-11-21 10:46:14 UTC (rev 1483)
@@ -98,7 +98,9 @@
private boolean wroteXMLDeclaration;
// The node that started the write
private Node rootNode;
-
+ // True if we want namespace completion
+ private boolean completeNamespaces = true;
+
public DOMWriter(Writer w)
{
this.out = new PrintWriter(w);
@@ -157,6 +159,17 @@
return this;
}
+ /**
+ * Set wheter subelements should have their namespaces completed.
+ * Setting this to false may lead to invalid XML fragments.
+ * The default is true.
+ */
+ public DOMWriter setCompleteNamespaces(boolean complete)
+ {
+ this.completeNamespaces = complete;
+ return this;
+ }
+
public boolean isPrettyprint()
{
return prettyprint;
@@ -232,7 +245,7 @@
break;
}
- // print element with attributes
+ // print element with attributes
case Node.ELEMENT_NODE:
{
Element element = (Element)node;
@@ -247,7 +260,7 @@
out.print('<');
out.print(nodeName);
-
+
Map nsMap = new HashMap();
String elPrefix = node.getPrefix();
if (elPrefix != null)
@@ -255,7 +268,7 @@
String nsURI = getNamespaceURI(elPrefix, element, rootNode);
nsMap.put(elPrefix, nsURI);
}
-
+
Attr attrs[] = sortAttributes(node.getAttributes());
for (int i = 0; i < attrs.length; i++)
{
@@ -263,7 +276,7 @@
String atPrefix = attr.getPrefix();
String atName = attr.getNodeName();
String atValue = normalize(attr.getNodeValue());
-
+
if (atPrefix != null && !atPrefix.equals("xmlns") && !atPrefix.equals("xml"))
{
String nsURI = getNamespaceURI(atPrefix, element, rootNode);
@@ -277,20 +290,23 @@
nsMap.put(typePrefix, typeURI);
}
}
-
+
out.print(" " + atName + "='" + atValue + "'");
}
-
+
// Add missing namespace declaration
- Iterator itPrefix = nsMap.keySet().iterator();
- while (itPrefix.hasNext())
+ if (completeNamespaces)
{
- String prefix = (String)itPrefix.next();
- String nsURI = (String)nsMap.get(prefix);
- if (nsURI == null)
+ Iterator itPrefix = nsMap.keySet().iterator();
+ while (itPrefix.hasNext())
{
- nsURI = getNamespaceURI(prefix, element, null);
- out.print(" xmlns:" + prefix + "='" + nsURI + "'");
+ String prefix = (String)itPrefix.next();
+ String nsURI = (String)nsMap.get(prefix);
+ if (nsURI == null)
+ {
+ nsURI = getNamespaceURI(prefix, element, null);
+ out.print(" xmlns:" + prefix + "='" + nsURI + "'");
+ }
}
}
Modified: trunk/src/test/java/org/jboss/test/ws/common/soap/SOAPHeaderElementTestCase.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/common/soap/SOAPHeaderElementTestCase.java 2006-11-21 10:44:00 UTC (rev 1482)
+++ trunk/src/test/java/org/jboss/test/ws/common/soap/SOAPHeaderElementTestCase.java 2006-11-21 10:46:14 UTC (rev 1483)
@@ -22,6 +22,7 @@
package org.jboss.test.ws.common.soap;
import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.Name;
@@ -33,6 +34,7 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.ws.soap.MessageFactoryImpl;
import org.jboss.ws.soap.NameImpl;
+import org.jboss.ws.utils.DOMUtils;
/**
* Test the SOAPHeaderElement
@@ -97,18 +99,15 @@
*/
public void testSetMustUnderstand() throws Exception
{
- String envStr =
+ String expEnv =
"<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" +
- " <env:Header>" +
- " <ns2:Bar xmlns:ns2='http://org.jboss.ws/header2' env:mustUnderstand='1'>SomeOtherValue</ns2:Bar>" +
- " </env:Header>" +
- " <env:Body/>" +
+ "<env:Header>" +
+ "<ns2:Bar xmlns:ns2='http://org.jboss.ws/header2' env:mustUnderstand='1'>SomeOtherValue</ns2:Bar>" +
+ "</env:Header>" +
+ "<env:Body/>" +
"</env:Envelope>";
MessageFactory factory = new MessageFactoryImpl();
- SOAPMessage expSoapMessage = factory.createMessage(null, new ByteArrayInputStream(envStr.getBytes()));
- SOAPEnvelope expSoapEnv = expSoapMessage.getSOAPPart().getEnvelope();
-
SOAPMessage soapMessage = factory.createMessage();
SOAPEnvelope soapEnv = soapMessage.getSOAPPart().getEnvelope();
SOAPHeader soapHeader = soapEnv.getHeader();
@@ -118,7 +117,10 @@
soapHeaderElement.setMustUnderstand(true);
soapHeaderElement.addTextNode("SomeOtherValue");
- System.out.println("FIXME: [JBWS-1130] Consolidate namespace declarations");
- // assertEquals(expSoapEnv, soapEnv);
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ soapMessage.writeTo(baos);
+ String wasEnv = new String(baos.toByteArray());
+
+ assertEquals(DOMUtils.parse(expEnv), DOMUtils.parse(wasEnv));
}
}
Modified: trunk/src/test/java/org/jboss/test/ws/common/utils/DOMWriterTestCase.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/common/utils/DOMWriterTestCase.java 2006-11-21 10:44:00 UTC (rev 1482)
+++ trunk/src/test/java/org/jboss/test/ws/common/utils/DOMWriterTestCase.java 2006-11-21 10:46:14 UTC (rev 1483)
@@ -22,9 +22,9 @@
package org.jboss.test.ws.common.utils;
import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
import javax.xml.soap.MessageFactory;
-import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPMessage;
import org.jboss.test.ws.JBossWSTest;
@@ -150,7 +150,7 @@
public void testEnvelopeWriter() throws Exception
{
- String xmlEnv = "<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>"
+ String expEnv = "<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>"
+ " <env:Header xmlns:wsa='http://www.w3.org/2005/08/addressing'>"
+ " <wsa:To>http://fabrikam123.example/Purchasing</wsa:To>"
+ " <wsa:ReplyTo>"
@@ -166,10 +166,12 @@
+ "</env:Envelope>";
MessageFactory factory = MessageFactory.newInstance();
- SOAPMessage msgOut = factory.createMessage(null, new ByteArrayInputStream(xmlEnv.getBytes()));
- SOAPEnvelope soapEnv = msgOut.getSOAPPart().getEnvelope();
+ SOAPMessage soapMessage = factory.createMessage(null, new ByteArrayInputStream(expEnv.getBytes()));
- System.out.println("FIXME: [JBWS-1130] Consolidate namespace declarations");
- //assertEquals(DOMUtils.parse(xmlEnv), soapEnv);
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ soapMessage.writeTo(baos);
+ String wasEnv = new String(baos.toByteArray());
+
+ assertEquals(DOMUtils.parse(expEnv), DOMUtils.parse(wasEnv));
}
}
Modified: trunk/src/test/java/org/jboss/test/ws/jaxrpc/wsse/MicrosoftInteropTestCase.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jaxrpc/wsse/MicrosoftInteropTestCase.java 2006-11-21 10:44:00 UTC (rev 1482)
+++ trunk/src/test/java/org/jboss/test/ws/jaxrpc/wsse/MicrosoftInteropTestCase.java 2006-11-21 10:46:14 UTC (rev 1483)
@@ -21,6 +21,7 @@
*/
package org.jboss.test.ws.jaxrpc.wsse;
+import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Calendar;
@@ -32,7 +33,7 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.ws.soap.MessageFactoryImpl;
-import org.jboss.ws.utils.DOMWriter;
+import org.jboss.ws.utils.DOMUtils;
import org.jboss.ws.wsse.Constants;
import org.jboss.ws.wsse.SecurityDecoder;
import org.jboss.ws.wsse.SecurityStore;
@@ -52,7 +53,7 @@
/** Test that we can build an envelope from InputStream */
public void testMicrosoftRequest() throws Exception
{
- String envStr =
+ String expEnv =
"<?xml version='1.0' encoding='UTF-8'?>" +
"<soap:Envelope" +
" xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'" +
@@ -65,7 +66,7 @@
" <wsa:ReplyTo>" +
" <wsa:Address>http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous</wsa:Address>" +
" </wsa:ReplyTo>" +
- " <wsa:To>http://draught:8081/jaxrpc-jaxrpc-jse</wsa:To>" +
+ " <wsa:To>http://draught:8081/jbossws-jaxrpc-jse</wsa:To>" +
" </soap:Header>" +
" <soap:Body>" +
" <echoString xmlns='http://org.jboss.ws/jaxrpc/types'>" +
@@ -79,8 +80,7 @@
MessageFactory factory = new MessageFactoryImpl();
SOAPMessage soapMsg = factory.createMessage(null, inputStream);
- SOAPEnvelope env = soapMsg.getSOAPPart().getEnvelope();
- Document doc = env.getOwnerDocument();
+ SOAPEnvelope soapEnv = soapMsg.getSOAPPart().getEnvelope();
// The Microsoft WSE message is timestamp protected like so:
// <wsu:Timestamp wsu:Id="Timestamp-9e3e6632-f2a1-4b26-a682-9301a75003a7">
@@ -97,16 +97,16 @@
cal.set(Calendar.SECOND, 25);
SecurityDecoder decoder = new SecurityDecoder(new SecurityStore(), cal);
- decoder.decode(doc);
+ decoder.decode(soapEnv.getOwnerDocument());
decoder.complete();
- cleanupWsuIds(doc.getDocumentElement());
+ cleanupWsuIds(soapEnv);
- String decodedString = DOMWriter.printNode(doc, true);
- log.debug("Decoded message:" + decodedString);
-
- System.out.println("FIXME: [JBWS-1130] Consolidate namespace declarations");
- // assertEquals(DOMUtils.parse(envStr), doc.getDocumentElement());
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ soapMsg.writeTo(baos);
+ String wasEnv = new String(baos.toByteArray());
+
+ assertEquals(DOMUtils.parse(expEnv), DOMUtils.parse(wasEnv));
}
// WS-Security leaves wsu:id attributes arround on elements which are not cleaned
Modified: trunk/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/EndpointReferenceTestCase.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/EndpointReferenceTestCase.java 2006-11-21 10:44:00 UTC (rev 1482)
+++ trunk/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/EndpointReferenceTestCase.java 2006-11-21 10:46:14 UTC (rev 1483)
@@ -63,7 +63,6 @@
EndpointReferenceImpl epr = new EndpointReferenceImpl(inElement);
Element outElement = epr.toElement();
- System.out.println("FIXME: [JBWS-1130] Consolidate namespace declarations");
- //assertEquals(inElement, outElement);
+ assertEquals(inElement, outElement);
}
}
Modified: trunk/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/SOAPAddressingPropertiesTestCase.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/SOAPAddressingPropertiesTestCase.java 2006-11-21 10:44:00 UTC (rev 1482)
+++ trunk/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/SOAPAddressingPropertiesTestCase.java 2006-11-21 10:46:14 UTC (rev 1483)
@@ -25,16 +25,17 @@
// Exp $
import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
import java.net.URI;
import javax.xml.soap.MessageFactory;
-import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPMessage;
import javax.xml.ws.addressing.AddressingBuilder;
import javax.xml.ws.addressing.soap.SOAPAddressingBuilder;
import javax.xml.ws.addressing.soap.SOAPAddressingProperties;
import org.jboss.test.ws.JBossWSTest;
+import org.jboss.util.xml.DOMUtils;
/**
* Test the SOAPAddressingProperties
@@ -94,15 +95,19 @@
public void testWriteHeaders() throws Exception
{
MessageFactory factory = MessageFactory.newInstance();
- SOAPMessage soapMessage = factory.createMessage();
- addrProps.writeHeaders(soapMessage);
- SOAPEnvelope wasEnv = soapMessage.getSOAPPart().getEnvelope();
+ SOAPMessage wasMsg = factory.createMessage();
+ addrProps.writeHeaders(wasMsg);
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ wasMsg.writeTo(baos);
+ String wasEnv = new String(baos.toByteArray());
- SOAPMessage msgOut = factory.createMessage(null, new ByteArrayInputStream(reqEnvStr.getBytes()));
- SOAPEnvelope expEnv = msgOut.getSOAPPart().getEnvelope();
+ SOAPMessage expMsg = factory.createMessage(null, new ByteArrayInputStream(reqEnvStr.getBytes()));
+ baos = new ByteArrayOutputStream();
+ expMsg.writeTo(baos);
+ String expEnv = new String(baos.toByteArray());
- System.out.println("FIXME: [JBWS-1130] Consolidate namespace declarations");
- //assertEquals(expEnv, wasEnv);
+ assertEquals(DOMUtils.parse(expEnv), DOMUtils.parse(wasEnv));
}
public void testReplyToHeaders() throws Exception
@@ -113,14 +118,18 @@
replyProps.setAction(addrBuilder.newURI("http://fabrikam123.example/ReplyPO"));
MessageFactory factory = MessageFactory.newInstance();
- SOAPMessage soapMessage = factory.createMessage();
- replyProps.writeHeaders(soapMessage);
- SOAPEnvelope wasEnv = soapMessage.getSOAPPart().getEnvelope();
+ SOAPMessage wasMsg = factory.createMessage();
+ replyProps.writeHeaders(wasMsg);
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ wasMsg.writeTo(baos);
+ String wasEnv = new String(baos.toByteArray());
- SOAPMessage msgOut = factory.createMessage(null, new ByteArrayInputStream(resEnvStr.getBytes()));
- SOAPEnvelope expEnv = msgOut.getSOAPPart().getEnvelope();
-
- System.out.println("FIXME: [JBWS-1130] Consolidate namespace declarations");
- //assertEquals(expEnv, wasEnv);
+ SOAPMessage expMsg = factory.createMessage(null, new ByteArrayInputStream(resEnvStr.getBytes()));
+ baos = new ByteArrayOutputStream();
+ expMsg.writeTo(baos);
+ String expEnv = new String(baos.toByteArray());
+
+ assertEquals(DOMUtils.parse(expEnv), DOMUtils.parse(wasEnv));
}
}
17 years, 11 months
JBossWS SVN: r1482 - in trunk/src: main/java/org/jboss/ws/annotation main/java/org/jboss/ws/integration/jboss50 main/java/org/jboss/ws/jaxrpc main/java/org/jboss/ws/jaxrpc/handler main/java/org/jboss/ws/jaxws/handler main/java/org/jboss/ws/metadata main/java/org/jboss/ws/server test/java/org/jboss/test/ws/jaxws/jbws1178 test/resources/jaxws/jbws1178/WEB-INF
by jbossws-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2006-11-21 05:44:00 -0500 (Tue, 21 Nov 2006)
New Revision: 1482
Modified:
trunk/src/main/java/org/jboss/ws/annotation/PortComponent.java
trunk/src/main/java/org/jboss/ws/integration/jboss50/JBossServiceEndpointServlet.java
trunk/src/main/java/org/jboss/ws/jaxrpc/ServiceObjectFactory.java
trunk/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerDelegateJAXRPC.java
trunk/src/main/java/org/jboss/ws/jaxws/handler/HandlerResolverImpl.java
trunk/src/main/java/org/jboss/ws/metadata/ClientEndpointMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/ServerEndpointMetaData.java
trunk/src/main/java/org/jboss/ws/server/ServiceEndpointManager.java
trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1178/JBWS1178TestCase.java
trunk/src/test/resources/jaxws/jbws1178/WEB-INF/web.xml
Log:
[JBWS-864] soap:address in wsdl ignores <url-pattern>
Modified: trunk/src/main/java/org/jboss/ws/annotation/PortComponent.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/annotation/PortComponent.java 2006-11-21 10:41:18 UTC (rev 1481)
+++ trunk/src/main/java/org/jboss/ws/annotation/PortComponent.java 2006-11-21 10:44:00 UTC (rev 1482)
@@ -47,6 +47,13 @@
String contextRoot() default "";
/**
+ * The virtual hosts that the web service endpoint is deployed to.
+ *
+ * Applies to server side port components only.
+ */
+ String[] virtualHosts() default {};
+
+ /**
* Relative path that is appended to the contextRoot to form fully qualified
* endpoint address for the web service endpoint.
*
Modified: trunk/src/main/java/org/jboss/ws/integration/jboss50/JBossServiceEndpointServlet.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/integration/jboss50/JBossServiceEndpointServlet.java 2006-11-21 10:41:18 UTC (rev 1481)
+++ trunk/src/main/java/org/jboss/ws/integration/jboss50/JBossServiceEndpointServlet.java 2006-11-21 10:44:00 UTC (rev 1482)
@@ -68,7 +68,7 @@
sepMetaData.setConfigName(configName);
sepMetaData.setConfigFile(configFile);
- List<HandlerMetaData> sepHandlers = sepMetaData.getHandlers(HandlerType.ENDPOINT);
+ List<HandlerMetaData> sepHandlers = sepMetaData.getHandlerMetaData(HandlerType.ENDPOINT);
sepMetaData.clearHandlers();
// Add pre handlers
Modified: trunk/src/main/java/org/jboss/ws/jaxrpc/ServiceObjectFactory.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxrpc/ServiceObjectFactory.java 2006-11-21 10:41:18 UTC (rev 1481)
+++ trunk/src/main/java/org/jboss/ws/jaxrpc/ServiceObjectFactory.java 2006-11-21 10:44:00 UTC (rev 1482)
@@ -302,7 +302,7 @@
Set<String> handlerRoles = new HashSet<String>();
ArrayList handlerInfos = new ArrayList();
- for (HandlerMetaData handlerMetaData : epMetaData.getHandlers(HandlerType.ALL))
+ for (HandlerMetaData handlerMetaData : epMetaData.getHandlerMetaData(HandlerType.ALL))
{
HandlerMetaDataJAXRPC jaxrpcMetaData = (HandlerMetaDataJAXRPC)handlerMetaData;
handlerRoles.addAll(jaxrpcMetaData.getSoapRoles());
Modified: trunk/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerDelegateJAXRPC.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerDelegateJAXRPC.java 2006-11-21 10:41:18 UTC (rev 1481)
+++ trunk/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerDelegateJAXRPC.java 2006-11-21 10:44:00 UTC (rev 1482)
@@ -148,7 +148,7 @@
List<HandlerInfo> hInfos = new ArrayList<HandlerInfo>();
ServerEndpointMetaData sepMetaData = seInfo.getServerEndpointMetaData();
- for (HandlerMetaData handlerMetaData : sepMetaData.getHandlers(type))
+ for (HandlerMetaData handlerMetaData : sepMetaData.getHandlerMetaData(type))
{
HandlerMetaDataJAXRPC jaxrpcMetaData = (HandlerMetaDataJAXRPC)handlerMetaData;
handlerRoles.addAll(jaxrpcMetaData.getSoapRoles());
Modified: trunk/src/main/java/org/jboss/ws/jaxws/handler/HandlerResolverImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxws/handler/HandlerResolverImpl.java 2006-11-21 10:41:18 UTC (rev 1481)
+++ trunk/src/main/java/org/jboss/ws/jaxws/handler/HandlerResolverImpl.java 2006-11-21 10:44:00 UTC (rev 1482)
@@ -131,7 +131,7 @@
public void initHandlerChain(EndpointMetaData epMetaData, HandlerType type)
{
log.debug("initHandlerChain: " + type);
- for (HandlerMetaData handlerMetaData : epMetaData.getHandlers(type))
+ for (HandlerMetaData handlerMetaData : epMetaData.getHandlerMetaData(type))
{
HandlerMetaDataJAXWS jaxwsMetaData = (HandlerMetaDataJAXWS)handlerMetaData;
String handlerName = jaxwsMetaData.getHandlerName();
Modified: trunk/src/main/java/org/jboss/ws/metadata/ClientEndpointMetaData.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/ClientEndpointMetaData.java 2006-11-21 10:41:18 UTC (rev 1481)
+++ trunk/src/main/java/org/jboss/ws/metadata/ClientEndpointMetaData.java 2006-11-21 10:44:00 UTC (rev 1482)
@@ -168,7 +168,7 @@
{
buffer.append("\n" + opMetaData);
}
- for (HandlerMetaData hdlMetaData : getHandlers(HandlerType.ALL))
+ for (HandlerMetaData hdlMetaData : getHandlerMetaData(HandlerType.ALL))
{
buffer.append("\n" + hdlMetaData);
}
Modified: trunk/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java 2006-11-21 10:41:18 UTC (rev 1481)
+++ trunk/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java 2006-11-21 10:44:00 UTC (rev 1482)
@@ -438,7 +438,7 @@
handlersInitialized = false;
}
- public List<HandlerMetaData> getHandlers(HandlerType type)
+ public List<HandlerMetaData> getHandlerMetaData(HandlerType type)
{
List<HandlerMetaData> typeHandlers = new ArrayList<HandlerMetaData>();
for (HandlerMetaData hmd : handlers)
Modified: trunk/src/main/java/org/jboss/ws/metadata/ServerEndpointMetaData.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/ServerEndpointMetaData.java 2006-11-21 10:41:18 UTC (rev 1481)
+++ trunk/src/main/java/org/jboss/ws/metadata/ServerEndpointMetaData.java 2006-11-21 10:44:00 UTC (rev 1482)
@@ -64,6 +64,8 @@
private ObjectName sepID;
// The HTTP context root
private String contextRoot;
+ // The HTTP virtual hosts
+ private String[] virtualHosts;
// The HTTP url parttern
private String urlPattern;
// The bean that registers with the ServiceEndpointManager
@@ -139,6 +141,16 @@
this.contextRoot = contextRoot;
}
+ public String[] getVirtualHosts()
+ {
+ return virtualHosts;
+ }
+
+ public void setVirtualHosts(String[] virtualHosts)
+ {
+ this.virtualHosts = virtualHosts;
+ }
+
public String getURLPattern()
{
return urlPattern;
@@ -267,7 +279,7 @@
{
buffer.append("\n" + opMetaData);
}
- for (HandlerMetaData hdlMetaData : getHandlers(HandlerType.ALL))
+ for (HandlerMetaData hdlMetaData : getHandlerMetaData(HandlerType.ALL))
{
buffer.append("\n" + hdlMetaData);
}
Modified: trunk/src/main/java/org/jboss/ws/server/ServiceEndpointManager.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/server/ServiceEndpointManager.java 2006-11-21 10:41:18 UTC (rev 1481)
+++ trunk/src/main/java/org/jboss/ws/server/ServiceEndpointManager.java 2006-11-21 10:44:00 UTC (rev 1482)
@@ -508,7 +508,7 @@
if (wsEndpoint != null)
{
ServerEndpointMetaData sepMetaData = wsEndpoint.getServiceEndpointInfo().getServerEndpointMetaData();
- handlers = sepMetaData.getHandlers(HandlerType.ALL);
+ handlers = sepMetaData.getHandlerMetaData(HandlerType.ALL);
}
return handlers;
}
Modified: trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1178/JBWS1178TestCase.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1178/JBWS1178TestCase.java 2006-11-21 10:41:18 UTC (rev 1481)
+++ trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1178/JBWS1178TestCase.java 2006-11-21 10:44:00 UTC (rev 1482)
@@ -37,9 +37,8 @@
import org.jboss.ws.jaxrpc.CallImpl;
/**
- * Multiple virtual host and soap:address problem
- *
- * http://jira.jboss.org/jira/browse/JBWS-1178
+ * [JBWS-1178] Multiple virtual host and soap:address problem
+ * [JBWS-864] soap:address in wsdl ignores <url-pattern>
*
* @author Thomas.Diesler(a)jboss.com
* @since 05-Oct-2006
@@ -70,7 +69,7 @@
public void testHostAddress() throws Exception
{
InetAddress inetAddr = InetAddress.getByName(getServerHost());
- URL wsdlURL = new URL("http://" + inetAddr.getHostAddress() + ":8080/jaxws-jbws1178?wsdl");
+ URL wsdlURL = new URL("http://" + inetAddr.getHostAddress() + ":8080/jaxws-jbws1178/testpattern?wsdl");
ServiceFactory factory = ServiceFactory.newInstance();
QName serviceName = new QName("http://org.jboss.ws/jbws1178", "TestEndpointService");
@@ -85,7 +84,7 @@
public void testHostName() throws Exception
{
InetAddress inetAddr = InetAddress.getByName(getServerHost());
- URL wsdlURL = new URL("http://" + inetAddr.getHostName() + ":8080/jaxws-jbws1178?wsdl");
+ URL wsdlURL = new URL("http://" + inetAddr.getHostName() + ":8080/jaxws-jbws1178/testpattern?wsdl");
ServiceFactory factory = ServiceFactory.newInstance();
QName serviceName = new QName("http://org.jboss.ws/jbws1178", "TestEndpointService");
Modified: trunk/src/test/resources/jaxws/jbws1178/WEB-INF/web.xml
===================================================================
--- trunk/src/test/resources/jaxws/jbws1178/WEB-INF/web.xml 2006-11-21 10:41:18 UTC (rev 1481)
+++ trunk/src/test/resources/jaxws/jbws1178/WEB-INF/web.xml 2006-11-21 10:44:00 UTC (rev 1482)
@@ -10,6 +10,7 @@
<servlet-mapping>
<servlet-name>TestEndpoint</servlet-name>
- <url-pattern>/*</url-pattern>
+ <!-- [JBWS-864] soap:address in wsdl ignores <url-pattern> -->
+ <url-pattern>/testpattern</url-pattern>
</servlet-mapping>
</web-app>
\ No newline at end of file
17 years, 11 months
JBossWS SVN: r1481 - in trunk: . src/main/java/org/jboss/ws/server src/main/resources/jbossws.beans/META-INF src/test/ant src/test/java/org/jboss/test/ws/jaxws src/test/java/org/jboss/test/ws/jaxws/jbws1178 src/test/resources/jaxws src/test/resources/jaxws/jbws1178 src/test/resources/jaxws/jbws1178/WEB-INF
by jbossws-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2006-11-21 05:41:18 -0500 (Tue, 21 Nov 2006)
New Revision: 1481
Added:
trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1178/
trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1178/JBWS1178TestCase.java
trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1178/TestEndpoint.java
trunk/src/test/resources/jaxws/jbws1178/
trunk/src/test/resources/jaxws/jbws1178/WEB-INF/
trunk/src/test/resources/jaxws/jbws1178/WEB-INF/web.xml
Removed:
trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1178/JBWS1178TestCase.java
trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1178/TestEndpoint.java
trunk/src/test/resources/jaxws/jbws1178/WEB-INF/
trunk/src/test/resources/jaxws/jbws1178/WEB-INF/web.xml
Modified:
trunk/.classpath
trunk/src/main/java/org/jboss/ws/server/ServiceEndpoint.java
trunk/src/main/java/org/jboss/ws/server/ServiceEndpointManager.java
trunk/src/main/java/org/jboss/ws/server/ServiceEndpointManagerMBean.java
trunk/src/main/java/org/jboss/ws/server/WSDLRequestHandler.java
trunk/src/main/resources/jbossws.beans/META-INF/jboss-beans.xml
trunk/src/test/ant/build-jars-jaxws.xml
Log:
[JBWS-1178] Multiple virtual host and soap:address problem
Modified: trunk/.classpath
===================================================================
--- trunk/.classpath 2006-11-21 10:39:06 UTC (rev 1480)
+++ trunk/.classpath 2006-11-21 10:41:18 UTC (rev 1481)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src/main/java"/>
+ <classpathentry excluding="org/jboss/ws/integration/jboss50/ServiceRefHandler.java" kind="src" path="src/main/java"/>
<classpathentry excluding="org/jboss/test/ws/interop/" kind="src" path="src/test/java"/>
<classpathentry kind="lib" path="thirdparty/activation.jar"/>
<classpathentry kind="lib" path="thirdparty/mailapi.jar"/>
Modified: trunk/src/main/java/org/jboss/ws/server/ServiceEndpoint.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/server/ServiceEndpoint.java 2006-11-21 10:39:06 UTC (rev 1480)
+++ trunk/src/main/java/org/jboss/ws/server/ServiceEndpoint.java 2006-11-21 10:41:18 UTC (rev 1481)
@@ -36,6 +36,7 @@
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPMessage;
+import org.jboss.kernel.Kernel;
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
import org.jboss.ws.binding.BindingException;
@@ -123,17 +124,23 @@
/** Handle a WSDL request or a request for an included resource
*/
- public void handleWSDLRequest(OutputStream outStream, URL requestURL, String resourcePath) throws IOException
+ public void handleWSDLRequest(OutputStream outStream, URL reqURL, String resPath) throws IOException
{
ServiceEndpointInfo sepInfo = getServiceEndpointInfo();
EndpointMetaData epMetaData = sepInfo.getServerEndpointMetaData();
- String urlString = requestURL.toExternalForm();
- String requestURI = requestURL.getPath();
- String hostPath = urlString.substring(0, urlString.indexOf(requestURI));
-
+ String wsdlHost = reqURL.getHost();
+
+ ServiceEndpointManagerFactory factory = ServiceEndpointManagerFactory.getInstance();
+ ServiceEndpointManager epManager = factory.getServiceEndpointManager();
+ if (epManager.getWebServiceHost().equals(ServiceEndpointManager.UNDEFINED_HOSTNAME) == false)
+ {
+ wsdlHost = epManager.getWebServiceHost();
+ }
+ log.debug("WSDL request, using host: " + wsdlHost);
+
WSDLRequestHandler wsdlRequestHandler = new WSDLRequestHandler(epMetaData);
- Document document = wsdlRequestHandler.getDocumentForPath(hostPath, requestURI, resourcePath);
+ Document document = wsdlRequestHandler.getDocumentForPath(reqURL, wsdlHost, resPath);
OutputStreamWriter writer = new OutputStreamWriter(outStream);
new DOMWriter(writer).setPrettyprint(true).print(document.getDocumentElement());
Modified: trunk/src/main/java/org/jboss/ws/server/ServiceEndpointManager.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/server/ServiceEndpointManager.java 2006-11-21 10:39:06 UTC (rev 1480)
+++ trunk/src/main/java/org/jboss/ws/server/ServiceEndpointManager.java 2006-11-21 10:41:18 UTC (rev 1481)
@@ -85,14 +85,16 @@
// provide logging
private static final Logger log = Logger.getLogger(ServiceEndpointManager.class);
- // default bean name
+ // Default bean name
public static final String BEAN_NAME = "ServiceEndpointManager";
+ // The host name that is returned if there is no other defined
+ public static String UNDEFINED_HOSTNAME = "jbossws.undefined.host";
// maps serviceID to EndpointInfo
private Map<ObjectName, ServiceEndpoint> registry = new ConcurrentHashMap<ObjectName, ServiceEndpoint>();
// The webservice host name that will be used when updating the wsdl
- private String webServiceHost;
+ private String webServiceHost = UNDEFINED_HOSTNAME;
// The webservice port that will be used when updating the wsdl
private int webServicePort;
// The webservice port that will be used when updating the wsdl
@@ -128,21 +130,19 @@
return alwaysModifySOAPAddress;
}
- public void setWebServiceHost(String host)
+ public void setWebServiceHost(String host) throws UnknownHostException
{
+ if (host == null || host.trim().length() == 0)
+ {
+ log.debug("Using undefined host: " + UNDEFINED_HOSTNAME);
+ host = UNDEFINED_HOSTNAME;
+ }
if ("0.0.0.0".equals(host))
{
- try
- {
- InetAddress localHost = InetAddress.getLocalHost();
- host = localHost.getHostName();
- }
- catch (UnknownHostException e)
- {
- log.error("Cannot map host: " + host, e);
- }
+ InetAddress localHost = InetAddress.getLocalHost();
+ log.debug("Using local host: " + localHost.getHostName());
+ host = localHost.getHostName();
}
-
this.webServiceHost = host;
}
Modified: trunk/src/main/java/org/jboss/ws/server/ServiceEndpointManagerMBean.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/server/ServiceEndpointManagerMBean.java 2006-11-21 10:39:06 UTC (rev 1480)
+++ trunk/src/main/java/org/jboss/ws/server/ServiceEndpointManagerMBean.java 2006-11-21 10:41:18 UTC (rev 1481)
@@ -21,6 +21,7 @@
*/
package org.jboss.ws.server;
+import java.net.UnknownHostException;
import java.util.List;
import javax.management.ObjectName;
@@ -38,7 +39,7 @@
static final ObjectName OBJECT_NAME = ObjectNameFactory.create("jboss.ws:service=ServiceEndpointManager");
String getWebServiceHost();
- void setWebServiceHost(String host);
+ void setWebServiceHost(String host) throws UnknownHostException;
int getWebServicePort();
void setWebServicePort(int port);
Modified: trunk/src/main/java/org/jboss/ws/server/WSDLRequestHandler.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/server/WSDLRequestHandler.java 2006-11-21 10:39:06 UTC (rev 1480)
+++ trunk/src/main/java/org/jboss/ws/server/WSDLRequestHandler.java 2006-11-21 10:41:18 UTC (rev 1481)
@@ -25,11 +25,12 @@
import java.io.File;
import java.io.IOException;
+import java.net.MalformedURLException;
import java.net.URL;
import org.jboss.logging.Logger;
+import org.jboss.ws.metadata.EndpointMetaData;
import org.jboss.ws.utils.DOMUtils;
-import org.jboss.ws.metadata.EndpointMetaData;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -64,10 +65,10 @@
* <p/>
* Use path value of null to get the root document
*
- * @param resourcePath The wsdl resource to get, can be null for the top level wsdl
+ * @param resPath The wsdl resource to get, can be null for the top level wsdl
* @return A wsdl document, or null if it cannot be found
*/
- public Document getDocumentForPath(String hostPath, String requestURI, String resourcePath) throws IOException
+ public Document getDocumentForPath(URL reqURL, String wsdlHost, String resPath) throws IOException
{
String wsdlLocation = epMetaData.getServiceMetaData().getWsdlFile();
if (wsdlLocation == null)
@@ -79,7 +80,7 @@
URL wsdlURL = new URL(wsdlLocation);
// get the root wsdl
- if (resourcePath == null)
+ if (resPath == null)
{
Element wsdlElement = DOMUtils.parse(wsdlURL.openStream());
wsdlDoc = wsdlElement.getOwnerDocument();
@@ -88,21 +89,21 @@
// get some imported resource
else
{
- String resPath = new File(wsdlURL.getPath()).getParent() + File.separatorChar + resourcePath;
- File resFile = new File(resPath);
+ String impResourcePath = new File(wsdlURL.getPath()).getParent() + File.separatorChar + resPath;
+ File impResourceFile = new File(impResourcePath);
- Element wsdlElement = DOMUtils.parse(resFile.toURL().openStream());
+ Element wsdlElement = DOMUtils.parse(impResourceFile.toURL().openStream());
wsdlDoc = wsdlElement.getOwnerDocument();
}
- modifyImportLocations(hostPath, requestURI, resourcePath, wsdlDoc.getDocumentElement());
+ modifyAddressReferences(reqURL, wsdlHost, resPath, wsdlDoc.getDocumentElement());
return wsdlDoc;
}
/**
* Modify the location of wsdl and schema imports
*/
- private void modifyImportLocations(String hostPath, String requestURI, String resourcePath, Element element)
+ private void modifyAddressReferences(URL reqURL, String wsdlHost, String resPath, Element element) throws MalformedURLException
{
// map wsdl definition imports
NodeList nlist = element.getChildNodes();
@@ -123,23 +124,50 @@
{
String orgLocation = locationAttr.getNodeValue();
boolean isAbsolute = orgLocation.startsWith("http://") || orgLocation.startsWith("https://");
- if (isAbsolute == false && orgLocation.startsWith(requestURI) == false)
+ if (isAbsolute == false && orgLocation.startsWith(reqURL.getPath()) == false)
{
String newResourcePath = orgLocation;
- if (resourcePath != null && resourcePath.indexOf("/") > 0)
- newResourcePath = resourcePath.substring(0, resourcePath.lastIndexOf("/") + 1) + orgLocation;
+ if (resPath != null && resPath.indexOf("/") > 0)
+ newResourcePath = resPath.substring(0, resPath.lastIndexOf("/") + 1) + orgLocation;
- String newLocation = hostPath + requestURI + "?wsdl&resource=" + newResourcePath;
+ String reqProtocol = reqURL.getProtocol();
+ int reqPort = reqURL.getPort();
+ String hostAndPort = wsdlHost + (reqPort > 0 ? ":" + reqPort : "");
+ String reqPath = reqURL.getPath();
+
+ String newLocation = reqProtocol + "://" + hostAndPort + reqPath + "?wsdl&resource=" + newResourcePath;
locationAttr.setNodeValue(newLocation);
log.debug("Mapping import from '" + orgLocation + "' to '" + newLocation + "'");
}
}
}
+ else if ("address".equals(nodeName))
+ {
+ Attr locationAttr = childElement.getAttributeNode("location");
+ if (locationAttr != null)
+ {
+ String orgLocation = locationAttr.getNodeValue();
+
+ URL locURL = new URL(orgLocation);
+ String locProtocol = locURL.getProtocol();
+ String locPath = locURL.getPath();
+ if (reqURL.getProtocol().equals(locProtocol) && reqURL.getPath().equals(locPath))
+ {
+ int locPort = locURL.getPort();
+ String hostAndPort = wsdlHost + (locPort > 0 ? ":" + locPort : "");
+
+ String newLocation = locProtocol + "://" + hostAndPort + locPath;
+ locationAttr.setNodeValue(newLocation);
+
+ log.debug("Mapping address from '" + orgLocation + "' to '" + newLocation + "'");
+ }
+ }
+ }
else
{
- modifyImportLocations(hostPath, requestURI, resourcePath, childElement);
+ modifyAddressReferences(reqURL, wsdlHost, resPath, childElement);
}
}
}
Modified: trunk/src/main/resources/jbossws.beans/META-INF/jboss-beans.xml
===================================================================
--- trunk/src/main/resources/jbossws.beans/META-INF/jboss-beans.xml 2006-11-21 10:39:06 UTC (rev 1480)
+++ trunk/src/main/resources/jbossws.beans/META-INF/jboss-beans.xml 2006-11-21 10:41:18 UTC (rev 1481)
@@ -7,11 +7,13 @@
<bean name="ServiceEndpointManager" class="org.jboss.ws.server.ServiceEndpointManager">
<!--
- The WSDL, that is a required deployment artifact for an endpoint, has a <soap:address>
- element which points to the location of the endpoint. JBoss supports rewriting of that SOAP address.
-
- If the content of <soap:address> is a valid URL, JBossWS will not rewrite it unless AlwaysModifySOAPAddress is true.
- If the content of <soap:address> is not a valid URL, JBossWS will rewrite it using the attribute values given below.
+ The WSDL, that is a required deployment artifact for an endpoint, has a <soap:address>
+ element which points to the location of the endpoint. JBoss supports rewriting of that SOAP address.
+
+ If the content of <soap:address> is a valid URL, JBossWS will not rewrite it unless 'alwaysModifySOAPAddress' is true.
+ If the content of <soap:address> is not a valid URL, JBossWS will rewrite it using the attribute values given below.
+
+ If 'webServiceHost' is an empty string, JBossWS uses requesters host when rewriting the <soap:address>.
-->
<property name="webServiceHost">${jboss.bind.address}</property>
<property name="webServiceSecurePort">8443</property>
Modified: trunk/src/test/ant/build-jars-jaxws.xml
===================================================================
--- trunk/src/test/ant/build-jars-jaxws.xml 2006-11-21 10:39:06 UTC (rev 1480)
+++ trunk/src/test/ant/build-jars-jaxws.xml 2006-11-21 10:41:18 UTC (rev 1481)
@@ -106,6 +106,13 @@
</fileset>
</jar>
+ <!-- jaxws-jbws1178 -->
+ <war destfile="${build.test.dir}/libs/jaxws-jbws1178.war" webxml="${build.test.dir}/resources/jaxws/jbws1178/WEB-INF/web.xml">
+ <classes dir="${build.test.dir}/classes">
+ <include name="org/jboss/test/ws/jaxws/jbws1178/TestEndpoint.class"/>
+ </classes>
+ </war>
+
<!-- jaxws-jsr181-complex -->
<war warfile="${build.test.dir}/libs/jaxws-jsr181-complex.war" webxml="${build.test.dir}/resources/jaxws/jsr181/complex/WEB-INF/web.xml">
<classes dir="${build.test.dir}/classes">
Copied: trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1178 (from rev 1475, branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1178)
Deleted: trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1178/JBWS1178TestCase.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1178/JBWS1178TestCase.java 2006-11-20 22:22:10 UTC (rev 1475)
+++ trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1178/JBWS1178TestCase.java 2006-11-21 10:41:18 UTC (rev 1481)
@@ -1,99 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.ws.jaxws.jbws1178;
-
-import java.net.InetAddress;
-import java.net.URL;
-
-import javax.management.Attribute;
-import javax.management.ObjectName;
-import javax.xml.namespace.QName;
-import javax.xml.rpc.Service;
-import javax.xml.rpc.ServiceFactory;
-
-import junit.framework.Test;
-
-import org.jboss.test.ws.JBossWSTest;
-import org.jboss.test.ws.JBossWSTestSetup;
-import org.jboss.ws.jaxrpc.CallImpl;
-
-/**
- * Multiple virtual host and soap:address problem
- *
- * http://jira.jboss.org/jira/browse/JBWS-1178
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 05-Oct-2006
- */
-public class JBWS1178TestCase extends JBossWSTest
-{
- String webServiceHost;
-
- public static Test suite()
- {
- return JBossWSTestSetup.newTestSetup(JBWS1178TestCase.class, "jaxws-jbws1178.war");
- }
-
- public void setUp() throws Exception
- {
- ObjectName objectName = new ObjectName("jboss.ws:service=ServiceEndpointManager");
- webServiceHost = (String)getServer().getAttribute(objectName, "WebServiceHost");
- // Setting the WebServiceHost to an empty string, causes the request host to be used
- getServer().setAttribute(objectName, new Attribute("WebServiceHost", ""));
- }
-
- public void tearDown() throws Exception
- {
- ObjectName objectName = new ObjectName("jboss.ws:service=ServiceEndpointManager");
- getServer().setAttribute(objectName, new Attribute("WebServiceHost", webServiceHost));
- }
-
- public void testHostAddress() throws Exception
- {
- InetAddress inetAddr = InetAddress.getByName(getServerHost());
- URL wsdlURL = new URL("http://" + inetAddr.getHostAddress() + ":8080/jaxws-jbws1178?wsdl");
-
- ServiceFactory factory = ServiceFactory.newInstance();
- QName serviceName = new QName("http://org.jboss.ws/jbws1178", "TestEndpointService");
- QName portName = new QName("http://org.jboss.ws/jbws1178", "TestEndpointPort");
- Service service = factory.createService(wsdlURL, serviceName);
- CallImpl call = (CallImpl)service.createCall(portName);
- URL epURL = new URL(call.getEndpointMetaData().getEndpointAddress());
-
- assertEquals(wsdlURL.getHost(), epURL.getHost());
- }
-
- public void testHostName() throws Exception
- {
- InetAddress inetAddr = InetAddress.getByName(getServerHost());
- URL wsdlURL = new URL("http://" + inetAddr.getHostName() + ":8080/jaxws-jbws1178?wsdl");
-
- ServiceFactory factory = ServiceFactory.newInstance();
- QName serviceName = new QName("http://org.jboss.ws/jbws1178", "TestEndpointService");
- QName portName = new QName("http://org.jboss.ws/jbws1178", "TestEndpointPort");
- Service service = factory.createService(wsdlURL, serviceName);
- CallImpl call = (CallImpl)service.createCall(portName);
- URL epURL = new URL(call.getEndpointMetaData().getEndpointAddress());
-
- assertEquals(wsdlURL.getHost(), epURL.getHost());
- }
-}
Copied: trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1178/JBWS1178TestCase.java (from rev 1475, branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1178/JBWS1178TestCase.java)
Deleted: trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1178/TestEndpoint.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1178/TestEndpoint.java 2006-11-20 22:22:10 UTC (rev 1475)
+++ trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1178/TestEndpoint.java 2006-11-21 10:41:18 UTC (rev 1481)
@@ -1,37 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.ws.jaxws.jbws1178;
-
-import javax.jws.WebMethod;
-import javax.jws.WebService;
-import javax.jws.soap.SOAPBinding;
-
-@WebService(name = "TestEndpoint", targetNamespace = "http://org.jboss.ws/jbws1178")
-@SOAPBinding(style = SOAPBinding.Style.RPC)
-public class TestEndpoint
-{
- @WebMethod
- public String echo(String input)
- {
- return input;
- }
-}
Copied: trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1178/TestEndpoint.java (from rev 1475, branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1178/TestEndpoint.java)
Copied: trunk/src/test/resources/jaxws/jbws1178 (from rev 1475, branches/tdiesler/trunk/src/test/resources/jaxws/jbws1178)
Copied: trunk/src/test/resources/jaxws/jbws1178/WEB-INF (from rev 1475, branches/tdiesler/trunk/src/test/resources/jaxws/jbws1178/WEB-INF)
Deleted: trunk/src/test/resources/jaxws/jbws1178/WEB-INF/web.xml
===================================================================
--- branches/tdiesler/trunk/src/test/resources/jaxws/jbws1178/WEB-INF/web.xml 2006-11-20 22:22:10 UTC (rev 1475)
+++ trunk/src/test/resources/jaxws/jbws1178/WEB-INF/web.xml 2006-11-21 10:41:18 UTC (rev 1481)
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
-
- <servlet>
- <servlet-name>TestEndpoint</servlet-name>
- <servlet-class>org.jboss.test.ws.jaxws.jbws1178.TestEndpoint</servlet-class>
- </servlet>
-
- <servlet-mapping>
- <servlet-name>TestEndpoint</servlet-name>
- <url-pattern>/*</url-pattern>
- </servlet-mapping>
-</web-app>
\ No newline at end of file
Copied: trunk/src/test/resources/jaxws/jbws1178/WEB-INF/web.xml (from rev 1475, branches/tdiesler/trunk/src/test/resources/jaxws/jbws1178/WEB-INF/web.xml)
17 years, 11 months
JBossWS SVN: r1480 - in trunk/src/main: etc resources/dist
by jbossws-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2006-11-21 05:39:06 -0500 (Tue, 21 Nov 2006)
New Revision: 1480
Added:
trunk/src/main/etc/JBossORG-EULA.txt
trunk/src/main/resources/dist/Install.txt
Modified:
trunk/src/main/etc/jbossws-component-info.xml
Log:
Add EULA, Install Instructions
Copied: trunk/src/main/etc/JBossORG-EULA.txt (from rev 1474, branches/tdiesler/trunk/src/main/etc/JBossORG-EULA.txt)
Modified: trunk/src/main/etc/jbossws-component-info.xml
===================================================================
--- trunk/src/main/etc/jbossws-component-info.xml 2006-11-21 10:26:50 UTC (rev 1479)
+++ trunk/src/main/etc/jbossws-component-info.xml 2006-11-21 10:39:06 UTC (rev 1480)
@@ -5,11 +5,11 @@
version="@repository.id@"
description="JBossWS an implementation of J2EE Web Services">
+ <artifact id="jbossws.sar"/>
+ <artifact id="jbossws-client.jar"/>
<artifact id="jboss-jaxrpc.jar"/>
<artifact id="jboss-jaxws.jar"/>
<artifact id="jboss-saaj.jar"/>
- <artifact id="jbossws-client.jar"/>
- <artifact id="jbossws.sar"/>
<import componentref="apache-xmlsec">
<compatible version="@apache-xmlsec@"/>
@@ -31,11 +31,11 @@
</import>
<export>
+ <include input="jbossws.sar"/>
+ <include input="jbossws-client.jar"/>
<include input="jboss-jaxrpc.jar"/>
<include input="jboss-jaxws.jar"/>
<include input="jboss-saaj.jar"/>
- <include input="jbossws-client.jar"/>
- <include input="jbossws.sar"/>
</export>
</component>
Copied: trunk/src/main/resources/dist/Install.txt (from rev 1474, branches/tdiesler/trunk/src/main/resources/dist/Install.txt)
17 years, 11 months
JBossWS SVN: r1479 - in branches/tdiesler/trunk/src: main/java/org/jboss/ws/common main/java/org/jboss/ws/deployment main/java/org/jboss/ws/jaxrpc main/java/org/jboss/ws/jaxrpc/handler main/java/org/jboss/ws/jaxws main/java/org/jboss/ws/jaxws/handler main/java/org/jboss/ws/metadata main/java/org/jboss/ws/metadata/j2ee main/java/org/jboss/ws/server main/java/org/jboss/ws/soap main/java/org/jboss/ws/tools/metadata test/java/org/jboss/test/ws/jaxrpc/samples/dynamichandler test/java/org/jboss/
by jbossws-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2006-11-21 05:26:50 -0500 (Tue, 21 Nov 2006)
New Revision: 1479
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/CommonClient.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/JSR109ClientMetaDataBuilder.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/CallProxy.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/MetaDataSynchronization.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/ServiceObjectFactory.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerDelegateJAXRPC.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/DynamicWrapperGenerator.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/handler/HandlerResolverImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/FaultMetaData.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/HandlerMetaData.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/OperationMetaData.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/ParameterMetaData.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/ServiceMetaData.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/UnifiedMetaData.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedHandlerMetaData.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServiceEndpoint.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPBodyImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPContentElement.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/metadata/ToolsUnifiedMetaDataBuilder.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/dynamichandler/DynamicHandlerTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws860/JBWS860TestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws944/EJB3Bean01.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws944/JBWS944TestCase.java
branches/tdiesler/trunk/src/test/resources/jaxws/samples/jsr181ejb/wstools-config.xml
branches/tdiesler/trunk/src/test/resources/jaxws/samples/jsr181pojo/wstools-config.xml
branches/tdiesler/trunk/src/test/resources/jaxws/samples/wsaddressing/wstools-config.xml
branches/tdiesler/trunk/src/test/resources/jaxws/wsaddressing/replyto/Initial-META-INF/jaxrpc-mapping.xml
branches/tdiesler/trunk/src/test/resources/jaxws/wsaddressing/replyto/Initial-META-INF/wstools-config.xml
branches/tdiesler/trunk/src/test/resources/jaxws/wsaddressing/replyto/ReplyTo-META-INF/wstools-config.xml
Log:
[JBWS-1113] Improve performance of Service.getPort()
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/CommonClient.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/CommonClient.java 2006-11-20 23:30:37 UTC (rev 1478)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/CommonClient.java 2006-11-21 10:26:50 UTC (rev 1479)
@@ -55,7 +55,6 @@
import org.jboss.ws.soap.SOAPBodyImpl;
import org.jboss.ws.soap.SOAPConnectionImpl;
import org.jboss.ws.utils.HolderUtils;
-import org.jboss.ws.utils.JavaUtils;
/**
* Provides support for the dynamic invocation of a service endpoint.
@@ -181,6 +180,8 @@
if (epMetaData == null)
{
UnifiedMetaData wsMetaData = new UnifiedMetaData();
+ wsMetaData.setClassLoader(Thread.currentThread().getContextClassLoader());
+
ServiceMetaData serviceMetaData = new ServiceMetaData(wsMetaData, new QName(Constants.NS_JBOSSWS_URI, "AnonymousService"));
wsMetaData.addService(serviceMetaData);
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/JSR109ClientMetaDataBuilder.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/JSR109ClientMetaDataBuilder.java 2006-11-20 23:30:37 UTC (rev 1478)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/JSR109ClientMetaDataBuilder.java 2006-11-21 10:26:50 UTC (rev 1479)
@@ -25,8 +25,6 @@
import java.io.IOException;
import java.net.URL;
-import java.util.Arrays;
-import java.util.List;
import java.util.Set;
import javax.xml.namespace.QName;
@@ -42,6 +40,7 @@
import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
import org.jboss.ws.metadata.config.jaxrpc.WSClientConfigJAXRPC;
import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedPortComponentRefMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedServiceRefMetaData;
import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMappingFactory;
@@ -104,7 +103,6 @@
try
{
UnifiedMetaData wsMetaData = new UnifiedMetaData();
- wsMetaData.setClassLoader(classLoader);
ServiceMetaData serviceMetaData = new ServiceMetaData(wsMetaData, serviceQName);
wsMetaData.addService(serviceMetaData);
@@ -178,18 +176,6 @@
epMetaData.setEndpointAddress(wsdlEndpoint.getAddress());
serviceMetaData.addEndpoint(epMetaData);
- // config-name, config-file
- if (serviceRefMetaData != null)
- {
- String configName = serviceRefMetaData.getConfigName();
- if (configName != null)
- epMetaData.setConfigName(configName);
-
- String configFile = serviceRefMetaData.getConfigFile();
- if (configFile != null)
- epMetaData.setConfigFile(configFile);
- }
-
// Init the endpoint binding
initEndpointBinding(wsdlEndpoint, epMetaData);
@@ -211,6 +197,30 @@
}
}
+ // config-name, config-file
+ if (serviceRefMetaData != null)
+ {
+ String configName = serviceRefMetaData.getConfigName();
+ if (configName != null)
+ epMetaData.setConfigName(configName);
+
+ String configFile = serviceRefMetaData.getConfigFile();
+ if (configFile != null)
+ epMetaData.setConfigFile(configFile);
+
+ // Setup endpoint meta data
+ for (UnifiedPortComponentRefMetaData pcRefMetaData : serviceRefMetaData.getPortComponentRefs())
+ {
+ String seiName = pcRefMetaData.getServiceEndpointInterface();
+ String epSEIName = epMetaData.getServiceEndpointInterfaceName();
+ if (seiName.equals(epSEIName) || epSEIName == null)
+ {
+ epMetaData.setServiceEndpointInterfaceName(seiName);
+ epMetaData.setProperties(pcRefMetaData.getCallProperties());
+ }
+ }
+ }
+
processEndpointMetaDataExtensions(epMetaData, wsdlDefinitions);
setupOperationsFromWSDL(epMetaData, wsdlEndpoint, seiMapping);
setupHandlers(serviceRefMetaData, portName, epMetaData);
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/CallProxy.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/CallProxy.java 2006-11-20 23:30:37 UTC (rev 1478)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/CallProxy.java 2006-11-21 10:26:50 UTC (rev 1479)
@@ -33,7 +33,6 @@
import java.util.Map;
import java.util.Set;
-import javax.xml.rpc.Call;
import javax.xml.rpc.JAXRPCException;
import javax.xml.rpc.Stub;
import javax.xml.rpc.soap.SOAPFaultException;
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/MetaDataSynchronization.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/MetaDataSynchronization.java 2006-11-20 23:30:37 UTC (rev 1478)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/MetaDataSynchronization.java 2006-11-21 10:26:50 UTC (rev 1479)
@@ -49,6 +49,7 @@
if (epMetaData.getServiceEndpointInterface() != seiClass)
throw new IllegalArgumentException("Endpoint meta data SEI missmatch, expected: " + epMetaData.getServiceEndpointInterfaceName());
+ /*
Method[] methods = seiClass.getMethods();
for (int i = 0; i < methods.length; i++)
{
@@ -63,5 +64,6 @@
if (opMetaData == null)
throw new ServiceException("Cannot obtain operation meta data for method: " + method);
}
+ */
}
}
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/ServiceObjectFactory.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/ServiceObjectFactory.java 2006-11-20 23:30:37 UTC (rev 1478)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/ServiceObjectFactory.java 2006-11-21 10:26:50 UTC (rev 1479)
@@ -180,22 +180,6 @@
QName serviceName = serviceRefMetaData.getServiceQName();
JavaWsdlMapping javaWsdlMapping = (JavaWsdlMapping)serviceRefMetaData.getJavaWsdlMapping();
jaxrpcService = new ServiceImpl(serviceName, wsdlURL, javaWsdlMapping, securityConfig, serviceRefMetaData);
-
- // Setup endpoint meta data
- ServiceMetaData serviceMetaData = jaxrpcService.getServiceMetaData();
- for (UnifiedPortComponentRefMetaData pcRefMetaData : serviceRefMetaData.getPortComponentRefs())
- {
- String seiName = pcRefMetaData.getServiceEndpointInterface();
- for (EndpointMetaData epMetaData : serviceMetaData.getEndpoints())
- {
- String epSEIName = epMetaData.getServiceEndpointInterfaceName();
- if (seiName.equals(epSEIName) || epSEIName == null)
- {
- epMetaData.setServiceEndpointInterfaceName(seiName);
- epMetaData.setProperties(pcRefMetaData.getCallProperties());
- }
- }
- }
}
else
{
@@ -307,8 +291,7 @@
HandlerMetaDataJAXRPC jaxrpcMetaData = (HandlerMetaDataJAXRPC)handlerMetaData;
handlerRoles.addAll(jaxrpcMetaData.getSoapRoles());
- ClassLoader cl = epMetaData.getClassLoader();
- Class hClass = cl.loadClass(jaxrpcMetaData.getHandlerClass());
+ Class hClass = jaxrpcMetaData.getHandlerClass();
HashMap hConfig = new HashMap();
for (HandlerInitParam param : jaxrpcMetaData.getInitParams())
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerDelegateJAXRPC.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerDelegateJAXRPC.java 2006-11-20 23:30:37 UTC (rev 1478)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerDelegateJAXRPC.java 2006-11-21 10:26:50 UTC (rev 1479)
@@ -154,7 +154,7 @@
handlerRoles.addAll(jaxrpcMetaData.getSoapRoles());
Class hClass;
- String handlerClass = jaxrpcMetaData.getHandlerClass();
+ String handlerClass = jaxrpcMetaData.getHandlerClassName();
try
{
// Load the handler class using the deployments top level CL
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/DynamicWrapperGenerator.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/DynamicWrapperGenerator.java 2006-11-20 23:30:37 UTC (rev 1478)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/DynamicWrapperGenerator.java 2006-11-21 10:26:50 UTC (rev 1479)
@@ -119,12 +119,16 @@
public void generate(FaultMetaData fmd)
{
+ // If a wrapper already present, no need to generate one
String faultBeanName = fmd.getFaultBeanName();
if (faultBeanName == null || JavaUtils.isLoaded(faultBeanName, loader))
return;
+ log.debug("Generating fault bean: " + faultBeanName);
+
+ QName xmlType = fmd.getXmlType();
+
Class exception = fmd.getJavaType();
-
try
{
SortedMap<String, Class<?>> properties = getExceptionProperties(exception);
@@ -142,8 +146,12 @@
}
catch (Exception e)
{
- throw new WSException("Could not generate wrapper type: " + faultBeanName, e);
+ throw new WSException("Could not generate fault wrapper bean: " + faultBeanName, e);
}
+
+ // Add the generated type to the types meta data
+ TypesMetaData types = fmd.getOperationMetaData().getEndpointMetaData().getServiceMetaData().getTypesMetaData();
+ types.addTypeMapping(new TypeMappingMetaData(types, xmlType, faultBeanName));
}
private static String getterPrefix(CtClass type)
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/handler/HandlerResolverImpl.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/handler/HandlerResolverImpl.java 2006-11-20 23:30:37 UTC (rev 1478)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/handler/HandlerResolverImpl.java 2006-11-21 10:26:50 UTC (rev 1479)
@@ -135,7 +135,7 @@
{
HandlerMetaDataJAXWS jaxwsMetaData = (HandlerMetaDataJAXWS)handlerMetaData;
String handlerName = jaxwsMetaData.getHandlerName();
- String className = jaxwsMetaData.getHandlerClass();
+ String className = jaxwsMetaData.getHandlerClassName();
Set<QName> soapHeaders = jaxwsMetaData.getSoapHeaders();
try
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java 2006-11-20 23:30:37 UTC (rev 1478)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java 2006-11-21 10:26:50 UTC (rev 1479)
@@ -24,8 +24,8 @@
// $Id$
import java.lang.reflect.Method;
-import java.net.URLClassLoader;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -37,8 +37,8 @@
import javax.xml.ws.Service.Mode;
import org.jboss.logging.Logger;
+import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
-import org.jboss.ws.Constants;
import org.jboss.ws.common.CommonSOAPBinding;
import org.jboss.ws.jaxrpc.Style;
import org.jboss.ws.jaxrpc.TypeMappingImpl;
@@ -70,7 +70,7 @@
}
// The parent meta data.
- private ServiceMetaData service;
+ private ServiceMetaData serviceMetaData;
// The REQUIRED endpoint config
protected WSCommonConfig endpointConfig;
@@ -89,6 +89,8 @@
private String endpointAddress;
// The endpoint interface name
private String seiName;
+ // The endpoint interface
+ private Class seiClass;
// The optional authentication method
private String authMethod;
// The optional transport guarantee
@@ -111,12 +113,12 @@
private List<HandlerMetaData> handlers = new ArrayList<HandlerMetaData>();
// True if the handlers are initialized
private boolean handlersInitialized;
- // The operation meta data cache
- private transient Map<Method,OperationMetaData> methodCache = new HashMap<Method,OperationMetaData>();
+ // Maps the java method to the operation meta data
+ private Map<Method, OperationMetaData> opMetaDataCache = new HashMap<Method, OperationMetaData>();
public EndpointMetaData(ServiceMetaData service, QName qname, QName interfaceQName, Type type)
{
- this.service = service;
+ this.serviceMetaData = service;
this.portName = qname;
this.interfaceQName = interfaceQName;
this.type = type;
@@ -127,7 +129,7 @@
public ServiceMetaData getServiceMetaData()
{
- return service;
+ return serviceMetaData;
}
public QName getQName()
@@ -148,6 +150,7 @@
public void setConfigFile(String configFile)
{
this.configFile = configFile;
+ this.endpointConfig = null;
}
public String getConfigName()
@@ -158,6 +161,7 @@
public void setConfigName(String configName)
{
this.configName = configName;
+ this.endpointConfig = null;
}
public abstract Object getEndpointConfig();
@@ -189,9 +193,20 @@
return seiName;
}
- public void setServiceEndpointInterfaceName(String endpointInterfaceName)
+ public void setServiceEndpointInterfaceName(String seiName)
{
- this.seiName = endpointInterfaceName;
+ this.seiName = seiName;
+ this.seiClass = null;
+
+ UnifiedMetaData wsMetaData = serviceMetaData.getUnifiedMetaData();
+ if (wsMetaData.isEagerInitialized())
+ {
+ if (UnifiedMetaData.isFinalRelease() == false)
+ log.warn("Set SEI name after eager initialization", new IllegalStateException());
+
+ // reinitialize
+ initializeInternal();
+ }
}
/** Get the class loader associated with the endpoint meta data */
@@ -201,28 +216,31 @@
return classLoader;
}
- /** Lazily load the SEI. The SEI class loader may not be available at creation time.
+ /**
+ * Load the service endpoint interface.
+ * It should only be cached during eager initialization.
*/
public Class getServiceEndpointInterface()
{
- String seiName = getServiceEndpointInterfaceName();
- if (seiName == null)
- throw new WSException("ServiceEndpointInterface name not available");
-
- Class seiClass = null;
- try
+ Class tmpClass = seiClass;
+ if (tmpClass == null && seiName != null)
{
- ClassLoader classLoader = getClassLoader();
- if (classLoader == null)
- throw new WSException("Class loader not available");
-
- seiClass = classLoader.loadClass(seiName);
+ try
+ {
+ ClassLoader classLoader = getClassLoader();
+ tmpClass = classLoader.loadClass(seiName);
+ if (serviceMetaData.getUnifiedMetaData().isEagerInitialized())
+ {
+ log.warn("Loading SEI after eager initialization");
+ seiClass = tmpClass;
+ }
+ }
+ catch (ClassNotFoundException ex)
+ {
+ throw new WSException("Cannot load service endpoint interface: " + seiName, ex);
+ }
}
- catch (ClassNotFoundException ex)
- {
- throw new WSException("Cannot load SEI: " + seiName, ex);
- }
- return seiClass;
+ return tmpClass;
}
public Use getEncodingStyle()
@@ -385,7 +403,14 @@
public OperationMetaData getOperation(Method method)
{
- OperationMetaData opMetaData = methodCache.get(method);
+ if (opMetaDataCache.size() == 0)
+ {
+ // This can happen when the SEI mapping was not found
+ log.warn("Access to empty operation meta data cache, reinitializing");
+ initializeInternal();
+ }
+
+ OperationMetaData opMetaData = opMetaDataCache.get(method);
if (opMetaData == null)
{
for (OperationMetaData aux : operations)
@@ -402,7 +427,7 @@
if (doesMatch)
{
- methodCache.put(method, aux);
+ opMetaDataCache.put(method, aux);
opMetaData = aux;
break;
}
@@ -459,25 +484,63 @@
this.handlersInitialized = flag;
}
+ public void validate()
+ {
+ for (HandlerMetaData handler : handlers)
+ handler.validate();
+
+ for (OperationMetaData opMetaData : operations)
+ opMetaData.validate();
+ }
+
/**
* @see UnifiedMetaData#eagerInitialize()
*/
public void eagerInitialize()
{
- for (OperationMetaData operation : operations)
- operation.eagerInitialize();
+ initializeInternal();
+ }
- TypeMappingImpl typeMapping = service.getTypeMapping();
- for (TypeMappingMetaData tmMetaData : service.getTypesMetaData().getTypeMappings())
+ private void initializeInternal()
+ {
+ eagerInitializeOperations();
+ eagerInitializeTypes();
+ }
+
+ private void eagerInitializeOperations()
+ {
+ seiClass = getServiceEndpointInterface();
+ if (seiClass != null)
{
+ List<Method> unsynchronizedMethods = new ArrayList<Method>();
+ unsynchronizedMethods.addAll(Arrays.asList(seiClass.getMethods()));
+
+ for (OperationMetaData opMetaData : operations)
+ {
+ opMetaData.eagerInitialize(unsynchronizedMethods);
+ Method method = opMetaData.getJavaMethod();
+ if (method != null)
+ {
+ opMetaDataCache.put(method, opMetaData);
+ unsynchronizedMethods.remove(method);
+ }
+ }
+ }
+ }
+
+ private void eagerInitializeTypes()
+ {
+ TypeMappingImpl typeMapping = serviceMetaData.getTypeMapping();
+ for (TypeMappingMetaData tmMetaData : serviceMetaData.getTypesMetaData().getTypeMappings())
+ {
String javaTypeName = tmMetaData.getJavaTypeName();
QName xmlType = tmMetaData.getXmlType();
if (xmlType != null)
{
- List<Class> classes = typeMapping.getJavaTypes(xmlType);
+ List<Class> registeredTypes = typeMapping.getJavaTypes(xmlType);
boolean registered = false;
- for (Class current : classes) {
+ for (Class current : registeredTypes) {
if (current.getName().equals(javaTypeName))
{
registered = true;
@@ -487,13 +550,11 @@
if (registered == false)
{
- ClassLoader classLoader = service.getUnifiedMetaData().getClassLoader();
- if (classLoader == null)
- throw new WSException("ClassLoader not available in meta data");
-
try
{
+ ClassLoader classLoader = getClassLoader();
Class javaType = JavaUtils.loadJavaType(javaTypeName, classLoader);
+
if (JavaUtils.isPrimitive(javaTypeName))
javaType = JavaUtils.getWrapperType(javaType);
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/FaultMetaData.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/FaultMetaData.java 2006-11-20 23:30:37 UTC (rev 1478)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/FaultMetaData.java 2006-11-21 10:26:50 UTC (rev 1479)
@@ -25,6 +25,7 @@
import javax.xml.namespace.QName;
+import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
import org.jboss.ws.jaxws.DynamicWrapperGenerator;
import org.jboss.ws.utils.JavaUtils;
@@ -38,8 +39,11 @@
*/
public class FaultMetaData
{
+ // provide logging
+ private final Logger log = Logger.getLogger(FaultMetaData.class);
+
// The parent operation
- private OperationMetaData operation;
+ private OperationMetaData opMetaData;
private QName xmlName;
private QName xmlType;
@@ -61,14 +65,14 @@
if (javaTypeName == null)
throw new IllegalArgumentException("Invalid null javaTypeName argument, for: " + xmlName);
- this.operation = operation;
+ this.opMetaData = operation;
this.xmlName = xmlName;
this.javaTypeName = javaTypeName;
}
public OperationMetaData getOperationMetaData()
{
- return operation;
+ return opMetaData;
}
public QName getXmlName()
@@ -94,59 +98,51 @@
return javaTypeName;
}
+ /** Load the java type.
+ * It should only be cached during eager initialization.
+ */
public Class getJavaType()
{
- if (javaTypeName == null)
- return null;
-
- ClassLoader loader = getClassLoader();
-
- if (javaType == null || (!javaType.isPrimitive() && javaType.getClassLoader() != loader))
+ Class tmpJavaType = javaType;
+ if (tmpJavaType == null && javaTypeName != null)
{
try
{
- javaType = JavaUtils.loadJavaType(javaTypeName, loader);
+ ClassLoader loader = opMetaData.getEndpointMetaData().getClassLoader();
+ tmpJavaType = JavaUtils.loadJavaType(javaTypeName, loader);
+
+ if (opMetaData.getEndpointMetaData().getServiceMetaData().getUnifiedMetaData().isEagerInitialized())
+ {
+ log.warn("Loading java type after eager initialization");
+ javaType = tmpJavaType;
+ }
}
catch (ClassNotFoundException ex)
{
throw new WSException("Cannot load java type: " + javaTypeName, ex);
}
}
-
- return javaType;
+ return tmpJavaType;
}
public Class getFaultBean()
{
- if (faultBeanName == null)
- return null;
-
- ClassLoader loader = getClassLoader();
-
- if (faultBean == null || (!faultBean.isPrimitive() && faultBean.getClassLoader() != loader))
+ Class tmpFaultBean = faultBean;
+ if (tmpFaultBean == null && faultBeanName != null)
{
try
{
- faultBean = JavaUtils.loadJavaType(faultBeanName, loader);
+ ClassLoader loader = opMetaData.getEndpointMetaData().getClassLoader();
+ tmpFaultBean = JavaUtils.loadJavaType(faultBeanName, loader);
}
catch (ClassNotFoundException ex)
{
throw new WSException("Cannot load fault bean: " + faultBeanName, ex);
}
}
-
- return faultBean;
+ return tmpFaultBean;
}
- private ClassLoader getClassLoader()
- {
- ClassLoader loader = operation.getEndpointMetaData().getServiceMetaData().getUnifiedMetaData().getClassLoader();
- if (loader == null)
- throw new WSException("ClassLoader not available");
-
- return loader;
- }
-
public String getFaultBeanName()
{
return faultBeanName;
@@ -159,10 +155,15 @@
public void eagerInitialize()
{
- (new DynamicWrapperGenerator(getClassLoader())).generate(this);
+ ClassLoader loader = opMetaData.getEndpointMetaData().getClassLoader();
+ new DynamicWrapperGenerator(loader).generate(this);
+
// Initialize the cache
- getJavaType();
- getFaultBean();
+ javaType = getJavaType();
+ if (javaType == null)
+ throw new WSException("Cannot load java type: " + javaTypeName);
+
+ faultBean = getFaultBean();
}
public String toString()
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/HandlerMetaData.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/HandlerMetaData.java 2006-11-20 23:30:37 UTC (rev 1478)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/HandlerMetaData.java 2006-11-21 10:26:50 UTC (rev 1479)
@@ -31,6 +31,9 @@
import javax.xml.namespace.QName;
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+
/**
* The common metdata data for a handler element
*
@@ -39,38 +42,43 @@
*/
public abstract class HandlerMetaData implements Serializable
{
+ // provide logging
+ private static final Logger log = Logger.getLogger(HandlerMetaData.class);
+
public enum HandlerType
{
PRE, ENDPOINT, POST, ALL
};
- private transient EndpointMetaData endpointMetaData;
+ private transient EndpointMetaData epMetaData;
// The required <handler-name> element
private String handlerName;
// The required <handler-class> element
- private String handlerClass;
+ private String handlerClassName;
// The required handler type
private HandlerType handlerType;
// The optional <soap-header> elements
private Set<QName> soapHeaders = new HashSet<QName>();
// The optional <init-param> elements
private List<HandlerInitParam> initParams = new ArrayList<HandlerInitParam>();
+ // The cached handler class
+ private Class handlerClass;
- public HandlerMetaData(EndpointMetaData endpointMetaData, HandlerType type)
+ public HandlerMetaData(EndpointMetaData epMetaData, HandlerType type)
{
- this.endpointMetaData = endpointMetaData;
+ this.epMetaData = epMetaData;
this.handlerType = type;
}
- public void setEndpointMetaData(EndpointMetaData endpointMetaData)
+ public void setEndpointMetaData(EndpointMetaData epMetaData)
{
- this.endpointMetaData = endpointMetaData;
+ this.epMetaData = epMetaData;
}
public EndpointMetaData getEndpointMetaData()
{
- return endpointMetaData;
+ return epMetaData;
}
public void setHandlerName(String value)
@@ -83,16 +91,37 @@
return handlerName;
}
- public void setHandlerClass(String handlerClass)
+ public void setHandlerClassName(String handlerClass)
{
- this.handlerClass = handlerClass;
+ this.handlerClassName = handlerClass;
}
- public String getHandlerClass()
+ public String getHandlerClassName()
{
- return handlerClass;
+ return handlerClassName;
}
+ public Class getHandlerClass()
+ {
+ if (handlerClassName == null)
+ throw new IllegalStateException("Handler class name cannot be null");
+
+ Class localClass = handlerClass;
+ if (localClass == null)
+ {
+ try
+ {
+ ClassLoader loader = epMetaData.getClassLoader();
+ localClass = loader.loadClass(handlerClassName);
+ }
+ catch (ClassNotFoundException ex)
+ {
+ throw new WSException("Cannot load handler: " + handlerClassName, ex);
+ }
+ }
+ return localClass;
+ }
+
public HandlerType getHandlerType()
{
return handlerType;
@@ -118,8 +147,30 @@
return initParams;
}
- public static class HandlerInitParam
+ public void validate()
{
+ List<String> securityHandlers = new ArrayList<String>();
+ securityHandlers.add(org.jboss.ws.wsse.jaxrpc.WSSecurityHandlerInbound.class.getName());
+ securityHandlers.add(org.jboss.ws.wsse.jaxrpc.WSSecurityHandlerOutbound.class.getName());
+ securityHandlers.add(org.jboss.ws.wsse.jaxws.WSSecurityHandlerInbound.class.getName());
+ securityHandlers.add(org.jboss.ws.wsse.jaxws.WSSecurityHandlerOutbound.class.getName());
+
+ if (securityHandlers.contains(handlerClassName))
+ {
+ if (epMetaData.getServiceMetaData().getSecurityConfiguration() == null)
+ log.warn("WS-Security requires security configuration");
+ }
+ }
+
+ public void eagerInitialize()
+ {
+ handlerClass = getHandlerClass();
+ }
+
+ public static class HandlerInitParam implements Serializable
+ {
+ private static final long serialVersionUID = -8687875291620457318L;
+
// The required <handler-name> element
private String paramName;
// The required <handler-class> element
@@ -135,7 +186,6 @@
this.paramName = paramName;
}
-
public String getParamValue()
{
return paramValue;
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/OperationMetaData.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/OperationMetaData.java 2006-11-20 23:30:37 UTC (rev 1478)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/OperationMetaData.java 2006-11-21 10:26:50 UTC (rev 1479)
@@ -155,63 +155,70 @@
{
return javaName;
}
-
- /** Lazily load the java method. The SEI class loader may not be available at creation time
- */
+
public Method getJavaMethod()
{
- ClassLoader loader = getEndpointMetaData().getServiceMetaData().getUnifiedMetaData().getClassLoader();
- if (javaMethod == null || javaMethod.getDeclaringClass().getClassLoader().equals(loader) == false)
+ Method tmpMethod = javaMethod;
+ Class seiClass = epMetaData.getServiceEndpointInterface();
+ if (tmpMethod == null && seiClass != null)
{
- javaMethod = null;
- try
+ for (Method method : seiClass.getMethods())
{
- Class seiClass = epMetaData.getServiceEndpointInterface();
- if (seiClass == null)
- throw new WSException("ServiceEndpointInterface not available");
-
- for (Method method : seiClass.getMethods())
+ if (isJavaMethod(method))
{
- String methodName = method.getName();
-
- if (javaName.equals(methodName))
+ tmpMethod = method;
+
+ UnifiedMetaData wsMetaData = epMetaData.getServiceMetaData().getUnifiedMetaData();
+ if (wsMetaData.isEagerInitialized())
{
- log.trace("Found java method: " + method);
+ if (UnifiedMetaData.isFinalRelease() == false)
+ log.warn("Loading java method after eager initialization", new IllegalStateException());
+
+ javaMethod = method;
+ }
+
+ break;
+ }
+ }
+
+ if (tmpMethod == null)
+ throw new WSException("Cannot find java method: " + javaName);
+ }
+ return tmpMethod;
+ }
- // compare params by java type name
- if (matchParameters(method, true))
- {
- log.debug("Found best matching java method: " + method);
- javaMethod = method;
- break;
- }
+ public boolean isJavaMethod(Method method)
+ {
+ boolean isJavaMethod = method.equals(javaMethod);
+ if (isJavaMethod == false)
+ {
+ String methodName = method.getName();
+ if (javaName.equals(methodName))
+ {
+ log.trace("Found java method: " + method);
- // compare params by assignability
- if (matchParameters(method, false))
- {
- log.debug("Found possible matching java method: " + method);
- javaMethod = method;
- // continue on, in case there is a better matching method
- }
- }
+ // compare params by java type name
+ if (matchParameters(method, true))
+ {
+ log.debug("Found best matching java method: " + method);
+ isJavaMethod = true;
}
- if (javaMethod == null)
- throw new WSException("Cannot find java method: " + javaName);
+ // compare params by assignability
+ if (!isJavaMethod && matchParameters(method, false))
+ {
+ log.debug("Found possible matching java method: " + method);
+ isJavaMethod = true;
+ }
}
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new WSException("Cannot load java method: " + javaName);
- }
}
-
- return javaMethod;
+
+ if (log.isTraceEnabled())
+ log.trace("Synchronized java method:\n" + method + "\nwith: " + toString());
+
+ return isJavaMethod;
}
-
+
private boolean matchParameters(Method method, boolean exact)
{
Class[] paramTypes = method.getParameterTypes();
@@ -439,8 +446,11 @@
/**
* @see UnifiedMetaData#eagerInitialize()
*/
- public void eagerInitialize()
+ public void eagerInitialize(List<Method> unsynchronizedMethods)
{
+ // reset java method
+ javaMethod = null;
+
for (ParameterMetaData parameter : parameters)
parameter.eagerInitialize();
@@ -449,6 +459,28 @@
for (FaultMetaData fault : faults)
fault.eagerInitialize();
+
+ // Method initialization
+ for (Method method : unsynchronizedMethods)
+ {
+ if (isJavaMethod(method))
+ {
+ javaMethod = method;
+ break;
+ }
+ }
+
+ // Report unsynchronized java method
+ if (javaMethod == null)
+ {
+ StringBuilder errMsg = new StringBuilder("Cannot synchronize to any of these methods:");
+ for (Method method : unsynchronizedMethods)
+ {
+ errMsg.append("\n" + method);
+ }
+ errMsg.append("\n" + toString());
+ throw new IllegalStateException(errMsg.toString());
+ }
}
public String toString()
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/ParameterMetaData.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/ParameterMetaData.java 2006-11-20 23:30:37 UTC (rev 1478)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/ParameterMetaData.java 2006-11-21 10:26:50 UTC (rev 1479)
@@ -52,8 +52,9 @@
*/
public class ParameterMetaData
{
- private static Logger log = Logger.getLogger(ParameterMetaData.class);
-
+ // provide logging
+ private final Logger log = Logger.getLogger(ParameterMetaData.class);
+
// The parent operation
private OperationMetaData opMetaData;
@@ -170,31 +171,42 @@
return javaTypeName;
}
- public void setJavaTypeName(String javaTypeName)
+ public void setJavaTypeName(String typeName)
{
- this.javaTypeName = javaTypeName;
+ // Warn if this is called after eager initialization
+ UnifiedMetaData wsMetaData = opMetaData.getEndpointMetaData().getServiceMetaData().getUnifiedMetaData();
+ if (wsMetaData.isEagerInitialized() && UnifiedMetaData.isFinalRelease() == false)
+ log.warn("Set java type name after eager initialization", new IllegalStateException());
+
+ javaTypeName = typeName;
+ javaType = null;
}
+ /** Load the java type.
+ * It should only be cached during eager initialization.
+ */
public Class getJavaType()
{
- ClassLoader loader = getClassLoader();
-
- if (javaTypeName == null)
- return null;
-
- if (javaType == null || ((!javaType.isPrimitive()) && javaType.getClassLoader() != loader))
+ Class tmpJavaType = javaType;
+ if (tmpJavaType == null && javaTypeName != null)
{
try
{
- javaType = JavaUtils.loadJavaType(javaTypeName, loader);
+ ClassLoader loader = opMetaData.getEndpointMetaData().getClassLoader();
+ tmpJavaType = JavaUtils.loadJavaType(javaTypeName, loader);
+
+ if (opMetaData.getEndpointMetaData().getServiceMetaData().getUnifiedMetaData().isEagerInitialized())
+ {
+ // This should not happen, see the warning in setJavaTypeName
+ javaType = tmpJavaType;
+ }
}
catch (ClassNotFoundException ex)
{
throw new WSException("Cannot load java type: " + javaTypeName, ex);
}
}
-
- return javaType;
+ return tmpJavaType;
}
public ParameterMode getMode()
@@ -341,8 +353,9 @@
wrapped.setAccessor(factory.create(wrapped));
}
- // Initialize the cache
- getJavaType();
+ javaType = getJavaType();
+ if (javaType == null)
+ throw new WSException("Cannot load java type: " + javaTypeName);
}
private ClassLoader getClassLoader()
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/ServiceMetaData.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/ServiceMetaData.java 2006-11-20 23:30:37 UTC (rev 1478)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/ServiceMetaData.java 2006-11-21 10:26:50 UTC (rev 1479)
@@ -41,6 +41,7 @@
import org.jboss.ws.jaxrpc.TypeMappingRegistryImpl;
import org.jboss.ws.jaxrpc.Use;
import org.jboss.ws.jbossxb.SchemaBindingBuilder;
+import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMappingFactory;
import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
@@ -339,6 +340,26 @@
return schemaBinding;
}
+ public void validate()
+ {
+ // Validate that there is at least one handler configured
+ // if we have a security configuration
+ if (securityConfiguration != null)
+ {
+ int handlerCount = 0;
+ for (EndpointMetaData epMetaData : endpoints.values())
+ {
+ handlerCount += epMetaData.getHandlerMetaData(HandlerType.ALL).size();
+ }
+ if (handlerCount == 0)
+ log.warn("WS-Security requires a security handler to be configured");
+ }
+
+ // Validate endpoints
+ for (EndpointMetaData epMetaData : endpoints.values())
+ epMetaData.validate();
+ }
+
/**
* @see UnifiedMetaData#eagerInitialize()
*/
@@ -351,7 +372,7 @@
WSDLTypes types = definitions.getWsdlTypes();
if (types != null)
{
- JBossXSModel model = WSDLUtils.getSchemaModel(types);;
+ JBossXSModel model = WSDLUtils.getSchemaModel(types);
if (model != null)
model.eagerInitialize();
}
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/UnifiedMetaData.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/UnifiedMetaData.java 2006-11-20 23:30:37 UTC (rev 1478)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/UnifiedMetaData.java 2006-11-21 10:26:50 UTC (rev 1479)
@@ -29,6 +29,7 @@
import java.util.Map;
import java.util.StringTokenizer;
+import org.jboss.logging.Logger;
import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
import org.jboss.ws.server.ServiceEndpointManager;
@@ -49,6 +50,9 @@
*/
public class UnifiedMetaData
{
+ // provide logging
+ private static Logger log = Logger.getLogger(UnifiedMetaData.class);
+
// The canonical deployment name
private String deploymentName;
// The modules class loader
@@ -58,7 +62,7 @@
// The implementation version
private static String implementationVersion;
// True if this is a final release
- private static boolean isDevRelease;
+ private static boolean isFinalRelease;
// Map<String, WSDLDefinitions> the wsdl-file to the wsdl Document
// Note the same wsdl can be used in multiple webservice descriptions
Map<String, WSDLDefinitions> wsdlMap = new HashMap<String, WSDLDefinitions>();
@@ -67,20 +71,11 @@
Map<String, JavaWsdlMapping> jaxrpcMap = new HashMap<String, JavaWsdlMapping>();
// The list of service meta data
private List<ServiceMetaData> services = new ArrayList<ServiceMetaData>();
-
// Used by eager initialization
- private boolean initialized = false;
+ private boolean eagerInitialized;
+ // Used by validate
+ private boolean validated;
- public String getDeploymentName()
- {
- return deploymentName;
- }
-
- public void setDeploymentName(String deploymentName)
- {
- this.deploymentName = deploymentName;
- }
-
public UnifiedMetaData()
{
this.classLoader = Thread.currentThread().getContextClassLoader();
@@ -88,6 +83,9 @@
public ClassLoader getClassLoader()
{
+ if (classLoader == null)
+ throw new IllegalStateException ("Class loader not available");
+
return classLoader;
}
@@ -96,6 +94,16 @@
this.classLoader = classLoader;
}
+ public String getDeploymentName()
+ {
+ return deploymentName;
+ }
+
+ public void setDeploymentName(String deploymentName)
+ {
+ this.deploymentName = deploymentName;
+ }
+
public String getSecurityDomain()
{
return securityDomain;
@@ -140,6 +148,23 @@
return jaxrpcMap.get(jaxrpcFile);
}
+ public void validate()
+ {
+ if (validated == false)
+ {
+ for (ServiceMetaData service : services)
+ {
+ service.validate();
+ }
+ validated = true;
+ }
+ }
+
+ public boolean isEagerInitialized()
+ {
+ return eagerInitialized;
+ }
+
/**
* Eagerly initialize all cache values that are normally lazy-loaded. This
* allows for concurrent read-only access to a <code>UnifiedMetaData</code>
@@ -147,12 +172,14 @@
*/
public void eagerInitialize()
{
- if (initialized == false)
+ if (eagerInitialized == false)
{
+ log.debug("Eagerly initialize the meta data model");
for (ServiceMetaData service : services)
+ {
service.eagerInitialize();
-
- initialized = true;
+ }
+ eagerInitialized = true;
}
}
@@ -161,15 +188,16 @@
if (implementationVersion == null)
{
implementationVersion = ServiceEndpointManager.class.getPackage().getImplementationVersion();
- isDevRelease = new StringTokenizer(implementationVersion).nextToken().endsWith(".DEV");
+ if (implementationVersion != null)
+ isFinalRelease = new StringTokenizer(implementationVersion).nextToken().endsWith(".GA");
}
return implementationVersion;
}
- public static boolean isDevRelease()
+ public static boolean isFinalRelease()
{
getImplementationVersion();
- return isDevRelease;
+ return isFinalRelease;
}
public String toString()
@@ -188,4 +216,4 @@
}
return buffer.toString();
}
-}
\ No newline at end of file
+}
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedHandlerMetaData.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedHandlerMetaData.java 2006-11-20 23:30:37 UTC (rev 1478)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/j2ee/UnifiedHandlerMetaData.java 2006-11-21 10:26:50 UTC (rev 1479)
@@ -147,7 +147,7 @@
{
HandlerMetaDataJAXRPC hmd = new HandlerMetaDataJAXRPC(epMetaData, type);
hmd.setHandlerName(getHandlerName());
- hmd.setHandlerClass(getHandlerClass());
+ hmd.setHandlerClassName(getHandlerClass());
hmd.seiInitParams(getInitParams());
hmd.setSoapHeaders(getSoapHeaders());
hmd.setSoapRoles(getSoapRoles());
@@ -159,7 +159,7 @@
{
HandlerMetaDataJAXWS hmd = new HandlerMetaDataJAXWS(epMetaData, type);
hmd.setHandlerName(getHandlerName());
- hmd.setHandlerClass(getHandlerClass());
+ hmd.setHandlerClassName(getHandlerClass());
hmd.seiInitParams(getInitParams());
hmd.setProtocolBindings(getProtocolBindings());
hmd.setServiceNamePattern(getServiceNamePattern());
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServiceEndpoint.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServiceEndpoint.java 2006-11-20 23:30:37 UTC (rev 1478)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/ServiceEndpoint.java 2006-11-21 10:26:50 UTC (rev 1479)
@@ -36,7 +36,6 @@
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPMessage;
-import org.jboss.kernel.Kernel;
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
import org.jboss.ws.binding.BindingException;
@@ -105,7 +104,7 @@
ServerEndpointMetaData epMetaData = seInfo.getServerEndpointMetaData();
UnifiedMetaData wsMetaData = epMetaData.getServiceMetaData().getUnifiedMetaData();
wsMetaData.eagerInitialize();
-
+
seMetrics.start();
seInfo.setState(State.STARTED);
}
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPBodyImpl.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPBodyImpl.java 2006-11-20 23:30:37 UTC (rev 1478)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPBodyImpl.java 2006-11-21 10:26:50 UTC (rev 1479)
@@ -284,7 +284,7 @@
// DOM expansion should only happen when a handler accesses the DOM API.
// We do not allow DOM expansion on a dev release.
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
- if (msgContext != null && UnifiedMetaData.isDevRelease())
+ if (msgContext != null && UnifiedMetaData.isFinalRelease() == false)
{
Boolean allowExpand = (Boolean)msgContext.getProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM);
if (Boolean.TRUE.equals(allowExpand) == false)
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPContentElement.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPContentElement.java 2006-11-20 23:30:37 UTC (rev 1478)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPContentElement.java 2006-11-21 10:26:50 UTC (rev 1479)
@@ -811,7 +811,7 @@
// DOM expansion should only happen when a handler accesses the DOM API.
// We do not allow DOM expansion on a dev release.
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
- if (msgContext != null && UnifiedMetaData.isDevRelease())
+ if (msgContext != null && UnifiedMetaData.isFinalRelease() == false)
{
Boolean allowExpand = (Boolean)msgContext.getProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM);
if (Boolean.TRUE.equals(allowExpand) == false)
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/metadata/ToolsUnifiedMetaDataBuilder.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/metadata/ToolsUnifiedMetaDataBuilder.java 2006-11-20 23:30:37 UTC (rev 1478)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/metadata/ToolsUnifiedMetaDataBuilder.java 2006-11-21 10:26:50 UTC (rev 1479)
@@ -84,6 +84,7 @@
throw new WSException("A service endpoint interface should extend Remote");
um = new UnifiedMetaData();
+ um.setClassLoader(Thread.currentThread().getContextClassLoader());
String seiName = WSDLUtils.getInstance().getJustClassName(seiClass.getName());
if (serviceName == null)
Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/dynamichandler/DynamicHandlerTestCase.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/dynamichandler/DynamicHandlerTestCase.java 2006-11-20 23:30:37 UTC (rev 1478)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/dynamichandler/DynamicHandlerTestCase.java 2006-11-21 10:26:50 UTC (rev 1479)
@@ -106,7 +106,7 @@
while (it.hasNext())
{
HandlerMetaData handlerMetaData = it.next();
- if (handlerMetaData.getHandlerClass().equals(ServerSideHandler.class.getName()))
+ if (handlerMetaData.getHandlerClassName().equals(ServerSideHandler.class.getName()))
it.remove();
}
server.invoke(oname, "stopServiceEndpoint", new Object[]{serviceID}, new String[]{"javax.management.ObjectName"});
Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws860/JBWS860TestCase.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws860/JBWS860TestCase.java 2006-11-20 23:30:37 UTC (rev 1478)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws860/JBWS860TestCase.java 2006-11-21 10:26:50 UTC (rev 1479)
@@ -57,7 +57,7 @@
assertNotNull(wsdlDef);
}
- public void testHervletAccess() throws Exception
+ public void testServletAccess() throws Exception
{
HttpURLConnection con = (HttpURLConnection)new URL("http://" + getServerHost() + ":8080/test/TestServlet").openConnection();
BufferedReader isr = new BufferedReader(new InputStreamReader(con.getInputStream()));
Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws944/EJB3Bean01.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws944/EJB3Bean01.java 2006-11-20 23:30:37 UTC (rev 1478)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws944/EJB3Bean01.java 2006-11-21 10:26:50 UTC (rev 1479)
@@ -31,9 +31,11 @@
@WebService(name = "EJB3Bean", targetNamespace = "http://org.jboss.ws/jbws944")
@SOAPBinding(style = SOAPBinding.Style.RPC)
+
@Remote(EJB3RemoteInterface.class)
@RemoteBinding(jndiBinding = "/ejb3/EJB3EndpointInterface")
@Stateless(name = "FooBean01")
+
public class EJB3Bean01 implements EJB3RemoteInterface
{
@WebMethod
Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws944/JBWS944TestCase.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws944/JBWS944TestCase.java 2006-11-20 23:30:37 UTC (rev 1478)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws944/JBWS944TestCase.java 2006-11-21 10:26:50 UTC (rev 1479)
@@ -36,7 +36,9 @@
import org.jboss.ws.metadata.wsdl.WSDLDefinitionsFactory;
/**
- * Tests JBWS-944
+ * EJB3 jmx name is incorrectly derrived
+ *
+ * http://jira.jboss.org/jira/browse/JBWS-944
*
* @author Thomas.Diesler(a)jboss.org
* @author Jason.Greene(a)jboss.com
Modified: branches/tdiesler/trunk/src/test/resources/jaxws/samples/jsr181ejb/wstools-config.xml
===================================================================
--- branches/tdiesler/trunk/src/test/resources/jaxws/samples/jsr181ejb/wstools-config.xml 2006-11-20 23:30:37 UTC (rev 1478)
+++ branches/tdiesler/trunk/src/test/resources/jaxws/samples/jsr181ejb/wstools-config.xml 2006-11-21 10:26:50 UTC (rev 1479)
@@ -8,6 +8,9 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.jboss.org/jbossws-tools http://www.jboss.org/jbossws-tools/schema/jbossws-tool_1_0.xsd">
+ <global>
+ <package-namespace package="org.jboss.test.ws.jaxws.samples.jsr181ejb" namespace="http://org.jboss.ws/samples/jsr181ejb"/>
+ </global>
<wsdl-java file="resources/jaxws/samples/jsr181ejb/META-INF/wsdl/TestService.wsdl">
<mapping file="jaxrpc-mapping.xml" />
</wsdl-java>
Modified: branches/tdiesler/trunk/src/test/resources/jaxws/samples/jsr181pojo/wstools-config.xml
===================================================================
--- branches/tdiesler/trunk/src/test/resources/jaxws/samples/jsr181pojo/wstools-config.xml 2006-11-20 23:30:37 UTC (rev 1478)
+++ branches/tdiesler/trunk/src/test/resources/jaxws/samples/jsr181pojo/wstools-config.xml 2006-11-21 10:26:50 UTC (rev 1479)
@@ -8,6 +8,9 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.jboss.org/jbossws-tools http://www.jboss.org/jbossws-tools/schema/jbossws-tool_1_0.xsd">
+ <global>
+ <package-namespace package="org.jboss.test.ws.jaxws.samples.jsr181pojo" namespace="http://org.jboss.ws/samples/jsr181pojo"/>
+ </global>
<wsdl-java file="resources/jaxws/samples/jsr181pojo/META-INF/wsdl/TestService.wsdl">
<mapping file="jaxrpc-mapping.xml" />
</wsdl-java>
Modified: branches/tdiesler/trunk/src/test/resources/jaxws/samples/wsaddressing/wstools-config.xml
===================================================================
--- branches/tdiesler/trunk/src/test/resources/jaxws/samples/wsaddressing/wstools-config.xml 2006-11-20 23:30:37 UTC (rev 1478)
+++ branches/tdiesler/trunk/src/test/resources/jaxws/samples/wsaddressing/wstools-config.xml 2006-11-21 10:26:50 UTC (rev 1479)
@@ -8,6 +8,9 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.jboss.org/jbossws-tools http://www.jboss.org/jbossws-tools/schema/jbossws-tool_1_0.xsd">
+ <global>
+ <package-namespace package="org.jboss.test.ws.jaxws.samples.wsaddressing" namespace="http://org.jboss.ws/samples/wsaddressing"/>
+ </global>
<wsdl-java file="resources/jaxws/samples/wsaddressing/META-INF/wsdl/TestService.wsdl">
<mapping file="jaxrpc-mapping.xml"/>
</wsdl-java>
Modified: branches/tdiesler/trunk/src/test/resources/jaxws/wsaddressing/replyto/Initial-META-INF/jaxrpc-mapping.xml
===================================================================
--- branches/tdiesler/trunk/src/test/resources/jaxws/wsaddressing/replyto/Initial-META-INF/jaxrpc-mapping.xml 2006-11-20 23:30:37 UTC (rev 1478)
+++ branches/tdiesler/trunk/src/test/resources/jaxws/wsaddressing/replyto/Initial-META-INF/jaxrpc-mapping.xml 2006-11-21 10:26:50 UTC (rev 1479)
@@ -1,10 +1,10 @@
<?xml version='1.0' encoding='UTF-8'?><java-wsdl-mapping version='1.1' xmlns='http://java.sun.com/xml/ns/j2ee' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://java.sun.com/xml/ns/j2ee http://www.ibm.com/webservices/xsd/j2ee_jaxrpc_mapping_1_1.xsd'>
<package-mapping>
- <package-type>ws.jboss.org.addressing.replyto</package-type>
+ <package-type>org.jboss.test.ws.jaxws.wsaddressing.replyto</package-type>
<namespaceURI>http://org.jboss.ws/addressing/replyto</namespaceURI>
</package-mapping>
<service-interface-mapping>
- <service-interface>ws.jboss.org.addressing.replyto.InitialEndpointService</service-interface>
+ <service-interface>org.jboss.test.ws.jaxws.wsaddressing.replyto.InitialEndpointService</service-interface>
<wsdl-service-name xmlns:serviceNS='http://org.jboss.ws/addressing/replyto'>serviceNS:InitialEndpointService</wsdl-service-name>
<port-mapping>
<port-name>InitialEndpointPort</port-name>
@@ -12,7 +12,7 @@
</port-mapping>
</service-interface-mapping>
<service-endpoint-interface-mapping>
- <service-endpoint-interface>ws.jboss.org.addressing.replyto.InitialEndpoint</service-endpoint-interface>
+ <service-endpoint-interface>org.jboss.test.ws.jaxws.wsaddressing.replyto.InitialEndpoint</service-endpoint-interface>
<wsdl-port-type xmlns:portTypeNS='http://org.jboss.ws/addressing/replyto'>portTypeNS:InitialEndpoint</wsdl-port-type>
<wsdl-binding xmlns:bindingNS='http://org.jboss.ws/addressing/replyto'>bindingNS:InitialEndpointBinding</wsdl-binding>
<service-endpoint-method-mapping>
Modified: branches/tdiesler/trunk/src/test/resources/jaxws/wsaddressing/replyto/Initial-META-INF/wstools-config.xml
===================================================================
--- branches/tdiesler/trunk/src/test/resources/jaxws/wsaddressing/replyto/Initial-META-INF/wstools-config.xml 2006-11-20 23:30:37 UTC (rev 1478)
+++ branches/tdiesler/trunk/src/test/resources/jaxws/wsaddressing/replyto/Initial-META-INF/wstools-config.xml 2006-11-21 10:26:50 UTC (rev 1479)
@@ -8,6 +8,9 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.jboss.org/jbossws-tools http://www.jboss.org/jbossws-tools/schema/jbossws-tool_1_0.xsd">
+ <global>
+ <package-namespace package="org.jboss.test.ws.jaxws.wsaddressing.replyto" namespace="http://org.jboss.ws/addressing/replyto"/>
+ </global>
<wsdl-java file="http://localhost:8080/jaxws-wsaddressing-initial/InitialService?wsdl">
<mapping file="jaxrpc-mapping.xml" />
</wsdl-java>
Modified: branches/tdiesler/trunk/src/test/resources/jaxws/wsaddressing/replyto/ReplyTo-META-INF/wstools-config.xml
===================================================================
--- branches/tdiesler/trunk/src/test/resources/jaxws/wsaddressing/replyto/ReplyTo-META-INF/wstools-config.xml 2006-11-20 23:30:37 UTC (rev 1478)
+++ branches/tdiesler/trunk/src/test/resources/jaxws/wsaddressing/replyto/ReplyTo-META-INF/wstools-config.xml 2006-11-21 10:26:50 UTC (rev 1479)
@@ -8,6 +8,9 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.jboss.org/jbossws-tools http://www.jboss.org/jbossws-tools/schema/jbossws-tool_1_0.xsd">
+ <global>
+ <package-namespace package="org.jboss.test.ws.jaxws.wsaddressing.replyto" namespace="http://org.jboss.ws/addressing/replyto"/>
+ </global>
<wsdl-java file="http://localhost:8080/jaxws-wsaddressing-replyto/ReplyToService?wsdl">
<mapping file="jaxrpc-mapping.xml" />
</wsdl-java>
17 years, 11 months
JBossWS SVN: r1478 - branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/wsaddressing
by jbossws-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2006-11-20 18:30:37 -0500 (Mon, 20 Nov 2006)
New Revision: 1478
Modified:
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/SOAPAddressingPropertiesTestCase.java
Log:
[JBWS-1130] Consolidate namespace declarations
Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/SOAPAddressingPropertiesTestCase.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/SOAPAddressingPropertiesTestCase.java 2006-11-20 23:28:46 UTC (rev 1477)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/SOAPAddressingPropertiesTestCase.java 2006-11-20 23:30:37 UTC (rev 1478)
@@ -125,16 +125,11 @@
wasMsg.writeTo(baos);
String wasEnv = new String(baos.toByteArray());
-<<<<<<< .working
- System.out.println("FIXME: [JBWS-1130] Consolidate namespace declarations");
- //assertEquals(expEnv, wasEnv);
-=======
SOAPMessage expMsg = factory.createMessage(null, new ByteArrayInputStream(resEnvStr.getBytes()));
baos = new ByteArrayOutputStream();
expMsg.writeTo(baos);
String expEnv = new String(baos.toByteArray());
assertEquals(DOMUtils.parse(expEnv), DOMUtils.parse(wasEnv));
->>>>>>> .merge-right.r1166
}
}
17 years, 11 months
JBossWS SVN: r1477 - in branches/tdiesler/trunk/src: main/java/org/jboss/ws/addressing main/java/org/jboss/ws/soap main/java/org/jboss/ws/utils test/java/org/jboss/test/ws/common/soap test/java/org/jboss/test/ws/common/utils test/java/org/jboss/test/ws/jaxrpc/wsse test/java/org/jboss/test/ws/jaxws/wsaddressing
by jbossws-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2006-11-20 18:28:46 -0500 (Mon, 20 Nov 2006)
New Revision: 1477
Modified:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/addressing/EndpointReferenceImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPContentElement.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPHeaderElementImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/utils/DOMWriter.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/soap/SOAPHeaderElementTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/utils/DOMWriterTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wsse/MicrosoftInteropTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/EndpointReferenceTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/SOAPAddressingPropertiesTestCase.java
Log:
[JBWS-1130] Consolidate namespace declarations
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/addressing/EndpointReferenceImpl.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/addressing/EndpointReferenceImpl.java 2006-11-20 22:48:06 UTC (rev 1476)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/addressing/EndpointReferenceImpl.java 2006-11-20 23:28:46 UTC (rev 1477)
@@ -24,6 +24,7 @@
//$Id$
import java.io.IOException;
+import java.io.StringWriter;
import java.net.URI;
import java.util.Iterator;
import java.util.List;
@@ -38,10 +39,10 @@
import javax.xml.ws.addressing.ReferenceParameters;
import javax.xml.ws.addressing.soap.SOAPAddressingBuilder;
+import org.jboss.ws.WSException;
+import org.jboss.ws.addressing.soap.SOAPAddressingBuilderImpl;
import org.jboss.ws.utils.DOMUtils;
import org.jboss.ws.utils.DOMWriter;
-import org.jboss.ws.WSException;
-import org.jboss.ws.addressing.soap.SOAPAddressingBuilderImpl;
import org.w3c.dom.Element;
/**
@@ -267,7 +268,10 @@
{
if (obj instanceof Element)
{
- String xmlFragment = DOMWriter.printNode((Element)obj, false);
+ StringWriter strwr = new StringWriter();
+ DOMWriter domWriter = new DOMWriter(strwr).setCompleteNamespaces(false);
+ domWriter.print((Element)obj);
+ String xmlFragment = strwr.toString();
xmlBuffer.append(xmlFragment);
}
else if (obj instanceof String)
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPContentElement.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPContentElement.java 2006-11-20 22:48:06 UTC (rev 1476)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPContentElement.java 2006-11-20 23:28:46 UTC (rev 1477)
@@ -23,6 +23,18 @@
// $Id$
+import java.io.IOException;
+import java.io.Writer;
+import java.lang.reflect.Array;
+import java.lang.reflect.Method;
+import java.util.Iterator;
+
+import javax.activation.DataHandler;
+import javax.xml.namespace.QName;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
@@ -41,19 +53,14 @@
import org.jboss.ws.utils.DOMWriter;
import org.jboss.ws.utils.JavaUtils;
import org.jboss.ws.xop.XOPContext;
-import org.w3c.dom.*;
+import org.w3c.dom.Attr;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.TypeInfo;
-import javax.activation.DataHandler;
-import javax.xml.namespace.QName;
-import javax.xml.soap.Name;
-import javax.xml.soap.SOAPElement;
-import javax.xml.soap.SOAPException;
-import java.io.IOException;
-import java.io.Writer;
-import java.lang.reflect.Array;
-import java.lang.reflect.Method;
-import java.util.Iterator;
-
/**
* A SOAPElement that gives access to its content as XML fragment or Java object.
*
@@ -126,7 +133,7 @@
{
return getParamMetaData().getJavaType();
}
-
+
public boolean isDOMValid()
{
return isDOMValid;
@@ -965,24 +972,17 @@
}
}
- public void writeElement(Writer writer) {
- try
+ public void writeElement(Writer writer) throws IOException
+ {
+ handleMTOMTransitions();
+
+ if (isDOMValid)
{
- handleMTOMTransitions();
-
- if(isDOMValid)
- {
- new DOMWriter(writer).print(this);
- }
- else
- {
- writer.write( getXMLFragment() );
- }
-
+ new DOMWriter(writer).print(this);
}
- catch (Exception e)
+ else
{
- throw new WSException("Failed to write SOAPContentElement ", e);
+ writer.write(getXMLFragment());
}
}
@@ -998,11 +998,12 @@
* it's needs to be decided wether or not the <code>xop:Include</code> should be restored.
* This as well depends upon the message context property.
*/
- public void handleMTOMTransitions() {
+ public void handleMTOMTransitions()
+ {
boolean mtomEnabled = isXOPParameter() && XOPContext.isMTOMEnabled();
- if( paramMetaData != null && mtomEnabled == false )
+ if (paramMetaData != null && mtomEnabled == false)
{
// If MTOM is disabled, we force dom expansion.
// This will inline any XOP include element
@@ -1014,7 +1015,7 @@
msgContext.setProperty(CommonMessageContext.ALLOW_EXPAND_TO_DOM, Boolean.TRUE);
expandToDOM();
}
- else if(isDOMValid && mtomEnabled )
+ else if (isDOMValid && mtomEnabled)
{
// When the DOM representation is valid,
// and MTOM is enabled we need to convert the inlined
@@ -1030,7 +1031,9 @@
{
return paramMetaData != null && paramMetaData.isXOP();
}
- public void accept(SAAJVisitor visitor) {
+
+ public void accept(SAAJVisitor visitor)
+ {
visitor.visitSOAPContentElement(this);
}
}
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPHeaderElementImpl.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPHeaderElementImpl.java 2006-11-20 22:48:06 UTC (rev 1476)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPHeaderElementImpl.java 2006-11-20 23:28:46 UTC (rev 1477)
@@ -21,8 +21,16 @@
*/
package org.jboss.ws.soap;
+import java.io.IOException;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
import javax.xml.soap.Name;
import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPHeader;
import javax.xml.soap.SOAPHeaderElement;
@@ -87,4 +95,48 @@
super.setParentElement(parent);
}
+
+ @Override
+ public void writeElement(Writer writer) throws IOException
+ {
+ StringWriter strwr = new StringWriter(256);
+ super.writeElement(strwr);
+
+ SOAPHeader soapHeader = (SOAPHeader)getParentElement();
+ SOAPEnvelope soapEnvelope = (SOAPEnvelope)soapHeader.getParentElement();
+
+ // Find known namespace declarations
+ List<String> knownNamespaces = new ArrayList<String>();
+ Iterator prefixes = soapEnvelope.getNamespacePrefixes();
+ while (prefixes.hasNext())
+ {
+ String prefix = (String)prefixes.next();
+ String nsURI = soapEnvelope.getNamespaceURI(prefix);
+ String xmlns = " xmlns:" + prefix + "='" + nsURI + "'";
+ knownNamespaces.add(xmlns);
+ }
+ prefixes = soapHeader.getNamespacePrefixes();
+ while (prefixes.hasNext())
+ {
+ String prefix = (String)prefixes.next();
+ String nsURI = soapHeader.getNamespaceURI(prefix);
+ String xmlns = " xmlns:" + prefix + "='" + nsURI + "'";
+ knownNamespaces.add(xmlns);
+ }
+
+ // Remove known namespace declarations
+ String xmlFragment = strwr.toString();
+ for (String xmlns : knownNamespaces)
+ {
+ int start = xmlFragment.indexOf(xmlns);
+ while (start > 0)
+ {
+ int end = start + xmlns.length();
+ xmlFragment = xmlFragment.substring(0, start) + xmlFragment.substring(end);
+ start = xmlFragment.indexOf(xmlns);
+ }
+ }
+
+ writer.write(xmlFragment);
+ }
}
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/utils/DOMWriter.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/utils/DOMWriter.java 2006-11-20 22:48:06 UTC (rev 1476)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/utils/DOMWriter.java 2006-11-20 23:28:46 UTC (rev 1477)
@@ -98,7 +98,9 @@
private boolean wroteXMLDeclaration;
// The node that started the write
private Node rootNode;
-
+ // True if we want namespace completion
+ private boolean completeNamespaces = true;
+
public DOMWriter(Writer w)
{
this.out = new PrintWriter(w);
@@ -157,6 +159,17 @@
return this;
}
+ /**
+ * Set wheter subelements should have their namespaces completed.
+ * Setting this to false may lead to invalid XML fragments.
+ * The default is true.
+ */
+ public DOMWriter setCompleteNamespaces(boolean complete)
+ {
+ this.completeNamespaces = complete;
+ return this;
+ }
+
public boolean isPrettyprint()
{
return prettyprint;
@@ -232,7 +245,7 @@
break;
}
- // print element with attributes
+ // print element with attributes
case Node.ELEMENT_NODE:
{
Element element = (Element)node;
@@ -247,7 +260,7 @@
out.print('<');
out.print(nodeName);
-
+
Map nsMap = new HashMap();
String elPrefix = node.getPrefix();
if (elPrefix != null)
@@ -255,7 +268,7 @@
String nsURI = getNamespaceURI(elPrefix, element, rootNode);
nsMap.put(elPrefix, nsURI);
}
-
+
Attr attrs[] = sortAttributes(node.getAttributes());
for (int i = 0; i < attrs.length; i++)
{
@@ -263,7 +276,7 @@
String atPrefix = attr.getPrefix();
String atName = attr.getNodeName();
String atValue = normalize(attr.getNodeValue());
-
+
if (atPrefix != null && !atPrefix.equals("xmlns") && !atPrefix.equals("xml"))
{
String nsURI = getNamespaceURI(atPrefix, element, rootNode);
@@ -277,20 +290,23 @@
nsMap.put(typePrefix, typeURI);
}
}
-
+
out.print(" " + atName + "='" + atValue + "'");
}
-
+
// Add missing namespace declaration
- Iterator itPrefix = nsMap.keySet().iterator();
- while (itPrefix.hasNext())
+ if (completeNamespaces)
{
- String prefix = (String)itPrefix.next();
- String nsURI = (String)nsMap.get(prefix);
- if (nsURI == null)
+ Iterator itPrefix = nsMap.keySet().iterator();
+ while (itPrefix.hasNext())
{
- nsURI = getNamespaceURI(prefix, element, null);
- out.print(" xmlns:" + prefix + "='" + nsURI + "'");
+ String prefix = (String)itPrefix.next();
+ String nsURI = (String)nsMap.get(prefix);
+ if (nsURI == null)
+ {
+ nsURI = getNamespaceURI(prefix, element, null);
+ out.print(" xmlns:" + prefix + "='" + nsURI + "'");
+ }
}
}
Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/soap/SOAPHeaderElementTestCase.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/soap/SOAPHeaderElementTestCase.java 2006-11-20 22:48:06 UTC (rev 1476)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/soap/SOAPHeaderElementTestCase.java 2006-11-20 23:28:46 UTC (rev 1477)
@@ -22,6 +22,7 @@
package org.jboss.test.ws.common.soap;
import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.Name;
@@ -33,6 +34,7 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.ws.soap.MessageFactoryImpl;
import org.jboss.ws.soap.NameImpl;
+import org.jboss.ws.utils.DOMUtils;
/**
* Test the SOAPHeaderElement
@@ -97,18 +99,15 @@
*/
public void testSetMustUnderstand() throws Exception
{
- String envStr =
+ String expEnv =
"<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" +
- " <env:Header>" +
- " <ns2:Bar xmlns:ns2='http://org.jboss.ws/header2' env:mustUnderstand='1'>SomeOtherValue</ns2:Bar>" +
- " </env:Header>" +
- " <env:Body/>" +
+ "<env:Header>" +
+ "<ns2:Bar xmlns:ns2='http://org.jboss.ws/header2' env:mustUnderstand='1'>SomeOtherValue</ns2:Bar>" +
+ "</env:Header>" +
+ "<env:Body/>" +
"</env:Envelope>";
MessageFactory factory = new MessageFactoryImpl();
- SOAPMessage expSoapMessage = factory.createMessage(null, new ByteArrayInputStream(envStr.getBytes()));
- SOAPEnvelope expSoapEnv = expSoapMessage.getSOAPPart().getEnvelope();
-
SOAPMessage soapMessage = factory.createMessage();
SOAPEnvelope soapEnv = soapMessage.getSOAPPart().getEnvelope();
SOAPHeader soapHeader = soapEnv.getHeader();
@@ -118,7 +117,10 @@
soapHeaderElement.setMustUnderstand(true);
soapHeaderElement.addTextNode("SomeOtherValue");
- System.out.println("FIXME: [JBWS-1130] Consolidate namespace declarations");
- // assertEquals(expSoapEnv, soapEnv);
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ soapMessage.writeTo(baos);
+ String wasEnv = new String(baos.toByteArray());
+
+ assertEquals(DOMUtils.parse(expEnv), DOMUtils.parse(wasEnv));
}
}
Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/utils/DOMWriterTestCase.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/utils/DOMWriterTestCase.java 2006-11-20 22:48:06 UTC (rev 1476)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/utils/DOMWriterTestCase.java 2006-11-20 23:28:46 UTC (rev 1477)
@@ -22,9 +22,9 @@
package org.jboss.test.ws.common.utils;
import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
import javax.xml.soap.MessageFactory;
-import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPMessage;
import org.jboss.test.ws.JBossWSTest;
@@ -150,7 +150,7 @@
public void testEnvelopeWriter() throws Exception
{
- String xmlEnv = "<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>"
+ String expEnv = "<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>"
+ " <env:Header xmlns:wsa='http://www.w3.org/2005/08/addressing'>"
+ " <wsa:To>http://fabrikam123.example/Purchasing</wsa:To>"
+ " <wsa:ReplyTo>"
@@ -166,10 +166,12 @@
+ "</env:Envelope>";
MessageFactory factory = MessageFactory.newInstance();
- SOAPMessage msgOut = factory.createMessage(null, new ByteArrayInputStream(xmlEnv.getBytes()));
- SOAPEnvelope soapEnv = msgOut.getSOAPPart().getEnvelope();
+ SOAPMessage soapMessage = factory.createMessage(null, new ByteArrayInputStream(expEnv.getBytes()));
- System.out.println("FIXME: [JBWS-1130] Consolidate namespace declarations");
- //assertEquals(DOMUtils.parse(xmlEnv), soapEnv);
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ soapMessage.writeTo(baos);
+ String wasEnv = new String(baos.toByteArray());
+
+ assertEquals(DOMUtils.parse(expEnv), DOMUtils.parse(wasEnv));
}
}
Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wsse/MicrosoftInteropTestCase.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wsse/MicrosoftInteropTestCase.java 2006-11-20 22:48:06 UTC (rev 1476)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxrpc/wsse/MicrosoftInteropTestCase.java 2006-11-20 23:28:46 UTC (rev 1477)
@@ -21,6 +21,7 @@
*/
package org.jboss.test.ws.jaxrpc.wsse;
+import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Calendar;
@@ -32,7 +33,7 @@
import org.jboss.test.ws.JBossWSTest;
import org.jboss.ws.soap.MessageFactoryImpl;
-import org.jboss.ws.utils.DOMWriter;
+import org.jboss.ws.utils.DOMUtils;
import org.jboss.ws.wsse.Constants;
import org.jboss.ws.wsse.SecurityDecoder;
import org.jboss.ws.wsse.SecurityStore;
@@ -52,7 +53,7 @@
/** Test that we can build an envelope from InputStream */
public void testMicrosoftRequest() throws Exception
{
- String envStr =
+ String expEnv =
"<?xml version='1.0' encoding='UTF-8'?>" +
"<soap:Envelope" +
" xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'" +
@@ -65,7 +66,7 @@
" <wsa:ReplyTo>" +
" <wsa:Address>http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous</wsa:Address>" +
" </wsa:ReplyTo>" +
- " <wsa:To>http://draught:8081/jaxrpc-jaxrpc-jse</wsa:To>" +
+ " <wsa:To>http://draught:8081/jbossws-jaxrpc-jse</wsa:To>" +
" </soap:Header>" +
" <soap:Body>" +
" <echoString xmlns='http://org.jboss.ws/jaxrpc/types'>" +
@@ -79,8 +80,7 @@
MessageFactory factory = new MessageFactoryImpl();
SOAPMessage soapMsg = factory.createMessage(null, inputStream);
- SOAPEnvelope env = soapMsg.getSOAPPart().getEnvelope();
- Document doc = env.getOwnerDocument();
+ SOAPEnvelope soapEnv = soapMsg.getSOAPPart().getEnvelope();
// The Microsoft WSE message is timestamp protected like so:
// <wsu:Timestamp wsu:Id="Timestamp-9e3e6632-f2a1-4b26-a682-9301a75003a7">
@@ -97,16 +97,16 @@
cal.set(Calendar.SECOND, 25);
SecurityDecoder decoder = new SecurityDecoder(new SecurityStore(), cal);
- decoder.decode(doc);
+ decoder.decode(soapEnv.getOwnerDocument());
decoder.complete();
- cleanupWsuIds(doc.getDocumentElement());
+ cleanupWsuIds(soapEnv);
- String decodedString = DOMWriter.printNode(doc, true);
- log.debug("Decoded message:" + decodedString);
-
- System.out.println("FIXME: [JBWS-1130] Consolidate namespace declarations");
- // assertEquals(DOMUtils.parse(envStr), doc.getDocumentElement());
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ soapMsg.writeTo(baos);
+ String wasEnv = new String(baos.toByteArray());
+
+ assertEquals(DOMUtils.parse(expEnv), DOMUtils.parse(wasEnv));
}
// WS-Security leaves wsu:id attributes arround on elements which are not cleaned
Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/EndpointReferenceTestCase.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/EndpointReferenceTestCase.java 2006-11-20 22:48:06 UTC (rev 1476)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/EndpointReferenceTestCase.java 2006-11-20 23:28:46 UTC (rev 1477)
@@ -63,7 +63,6 @@
EndpointReferenceImpl epr = new EndpointReferenceImpl(inElement);
Element outElement = epr.toElement();
- System.out.println("FIXME: [JBWS-1130] Consolidate namespace declarations");
- //assertEquals(inElement, outElement);
+ assertEquals(inElement, outElement);
}
}
Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/SOAPAddressingPropertiesTestCase.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/SOAPAddressingPropertiesTestCase.java 2006-11-20 22:48:06 UTC (rev 1476)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxws/wsaddressing/SOAPAddressingPropertiesTestCase.java 2006-11-20 23:28:46 UTC (rev 1477)
@@ -25,16 +25,17 @@
// Exp $
import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
import java.net.URI;
import javax.xml.soap.MessageFactory;
-import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPMessage;
import javax.xml.ws.addressing.AddressingBuilder;
import javax.xml.ws.addressing.soap.SOAPAddressingBuilder;
import javax.xml.ws.addressing.soap.SOAPAddressingProperties;
import org.jboss.test.ws.JBossWSTest;
+import org.jboss.util.xml.DOMUtils;
/**
* Test the SOAPAddressingProperties
@@ -94,15 +95,19 @@
public void testWriteHeaders() throws Exception
{
MessageFactory factory = MessageFactory.newInstance();
- SOAPMessage soapMessage = factory.createMessage();
- addrProps.writeHeaders(soapMessage);
- SOAPEnvelope wasEnv = soapMessage.getSOAPPart().getEnvelope();
+ SOAPMessage wasMsg = factory.createMessage();
+ addrProps.writeHeaders(wasMsg);
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ wasMsg.writeTo(baos);
+ String wasEnv = new String(baos.toByteArray());
- SOAPMessage msgOut = factory.createMessage(null, new ByteArrayInputStream(reqEnvStr.getBytes()));
- SOAPEnvelope expEnv = msgOut.getSOAPPart().getEnvelope();
+ SOAPMessage expMsg = factory.createMessage(null, new ByteArrayInputStream(reqEnvStr.getBytes()));
+ baos = new ByteArrayOutputStream();
+ expMsg.writeTo(baos);
+ String expEnv = new String(baos.toByteArray());
- System.out.println("FIXME: [JBWS-1130] Consolidate namespace declarations");
- //assertEquals(expEnv, wasEnv);
+ assertEquals(DOMUtils.parse(expEnv), DOMUtils.parse(wasEnv));
}
public void testReplyToHeaders() throws Exception
@@ -113,14 +118,23 @@
replyProps.setAction(addrBuilder.newURI("http://fabrikam123.example/ReplyPO"));
MessageFactory factory = MessageFactory.newInstance();
- SOAPMessage soapMessage = factory.createMessage();
- replyProps.writeHeaders(soapMessage);
- SOAPEnvelope wasEnv = soapMessage.getSOAPPart().getEnvelope();
+ SOAPMessage wasMsg = factory.createMessage();
+ replyProps.writeHeaders(wasMsg);
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ wasMsg.writeTo(baos);
+ String wasEnv = new String(baos.toByteArray());
- SOAPMessage msgOut = factory.createMessage(null, new ByteArrayInputStream(resEnvStr.getBytes()));
- SOAPEnvelope expEnv = msgOut.getSOAPPart().getEnvelope();
-
+<<<<<<< .working
System.out.println("FIXME: [JBWS-1130] Consolidate namespace declarations");
//assertEquals(expEnv, wasEnv);
+=======
+ SOAPMessage expMsg = factory.createMessage(null, new ByteArrayInputStream(resEnvStr.getBytes()));
+ baos = new ByteArrayOutputStream();
+ expMsg.writeTo(baos);
+ String expEnv = new String(baos.toByteArray());
+
+ assertEquals(DOMUtils.parse(expEnv), DOMUtils.parse(wasEnv));
+>>>>>>> .merge-right.r1166
}
}
17 years, 11 months