Author: jason.greene(a)jboss.com
Date: 2007-03-16 19:44:09 -0400 (Fri, 16 Mar 2007)
New Revision: 2634
Modified:
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/binding/SerializationContext.java
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/JAXBSerializer.java
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/SOAPFaultHelperJAXWS.java
trunk/jbossws-core/src/java/org/jboss/ws/core/soap/ObjectContent.java
trunk/jbossws-core/src/java/org/jboss/ws/core/soap/XMLContent.java
Log:
Fix fault bean serialization
Modified:
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/binding/SerializationContext.java
===================================================================
---
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/binding/SerializationContext.java 2007-03-16
22:02:41 UTC (rev 2633)
+++
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/binding/SerializationContext.java 2007-03-16
23:44:09 UTC (rev 2634)
@@ -38,8 +38,9 @@
public abstract class SerializationContext
{
public static final String CONTEXT_TYPES =
"org.jboss.ws.jaxrpc.binding.contextTypes";
-
- // The type mapping that is valid for this serialization context
+
+ private Class javaType;
+
private TypeMappingImpl typeMapping;
// The namespace registry that is valid for this serialization context
private NamespaceRegistry namespaceRegistry = new NamespaceRegistry();
@@ -70,4 +71,14 @@
{
return namespaceRegistry;
}
+
+ public Class getJavaType()
+ {
+ return javaType;
+ }
+
+ public void setJavaType(Class javaType)
+ {
+ this.javaType = javaType;
+ }
}
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/JAXBSerializer.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/JAXBSerializer.java 2007-03-16
22:02:41 UTC (rev 2633)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/JAXBSerializer.java 2007-03-16
23:44:09 UTC (rev 2634)
@@ -63,10 +63,9 @@
Result result = null;
try
{
- // The PMD contains the base type, which is needed for JAXB to marshall xsi:type
correctly.
+ // The serialization context contains the base type, which is needed for JAXB to
marshall xsi:type correctly.
// This should be more efficient and accurate than searching the type mapping
- ParameterMetaData pmd =
(ParameterMetaData)serContext.getProperty(ParameterMetaData.class.getName());
- Class expectedType = pmd.getJavaType();
+ Class expectedType = serContext.getJavaType();
Class actualType = value.getClass();
JAXBContextCache contextCache = JAXBContextCache.getContextCache();
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/SOAPFaultHelperJAXWS.java
===================================================================
---
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/SOAPFaultHelperJAXWS.java 2007-03-16
22:02:41 UTC (rev 2633)
+++
trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/SOAPFaultHelperJAXWS.java 2007-03-16
23:44:09 UTC (rev 2634)
@@ -307,7 +307,8 @@
// Get the serializer from the type mapping
QName xmlType = faultMetaData.getXmlType();
- Class javaType = faultMetaData.getFaultBean() != null ?
faultMetaData.getFaultBean() : faultMetaData.getJavaType();
+ Class javaType = faultMetaData.getFaultBean();
+ serContext.setJavaType(javaType);
SerializerFactoryBase serFactory =
(SerializerFactoryBase)serContext.getTypeMapping().getSerializer(javaType, xmlType);
if (serFactory == null)
throw new WebServiceException("Cannot obtain serializer factory:
xmlType=" + xmlType + ", javaType=" + javaType);
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/soap/ObjectContent.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/soap/ObjectContent.java 2007-03-16
22:02:41 UTC (rev 2633)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/soap/ObjectContent.java 2007-03-16
23:44:09 UTC (rev 2634)
@@ -133,6 +133,7 @@
SerializationContext serContext = msgContext.getSerializationContext();
serContext.setProperty(ParameterMetaData.class.getName(),
container.getParamMetaData());
+ serContext.setJavaType(javaType);
TypeMappingImpl typeMapping = serContext.getTypeMapping();
XMLFragment xmlFragment = null;
Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/soap/XMLContent.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/soap/XMLContent.java 2007-03-16 22:02:41
UTC (rev 2633)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/soap/XMLContent.java 2007-03-16 23:44:09
UTC (rev 2634)
@@ -126,6 +126,7 @@
SerializationContext serContext = msgContext.getSerializationContext();
ParameterMetaData pmd = container.getParamMetaData();
serContext.setProperty(ParameterMetaData.class.getName(), pmd);
+ serContext.setJavaType(javaType);
List<Class> registeredTypes =
pmd.getOperationMetaData().getEndpointMetaData().getRegisteredTypes();
serContext.setProperty(SerializationContext.CONTEXT_TYPES,
registeredTypes.toArray(new Class[0]));