Author: thomas.diesler(a)jboss.com
Date: 2007-03-27 11:14:21 -0400 (Tue, 27 Mar 2007)
New Revision: 2692
Modified:
branches/jbossws-1.2.1/jbossws-core/src/java/org/jboss/ws/core/EndpointInvocation.java
branches/jbossws-1.2.1/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SOAPFaultHelperJAXRPC.java
branches/jbossws-1.2.1/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SerializationContextJAXRPC.java
branches/jbossws-1.2.1/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/binding/DeserializerSupport.java
branches/jbossws-1.2.1/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/binding/SOAPArrayDeserializer.java
branches/jbossws-1.2.1/jbossws-core/src/java/org/jboss/ws/core/soap/XMLFragment.java
branches/jbossws-1.2.1/jbossws-tests/ant-import/build-jars-jaxrpc.xml
Log:
Fix rpc/encoded tests
Modified:
branches/jbossws-1.2.1/jbossws-core/src/java/org/jboss/ws/core/EndpointInvocation.java
===================================================================
---
branches/jbossws-1.2.1/jbossws-core/src/java/org/jboss/ws/core/EndpointInvocation.java 2007-03-27
11:06:26 UTC (rev 2691)
+++
branches/jbossws-1.2.1/jbossws-core/src/java/org/jboss/ws/core/EndpointInvocation.java 2007-03-27
15:14:21 UTC (rev 2692)
@@ -116,7 +116,7 @@
*/
public Object[] getRequestPayload() throws SOAPException
{
- if(log.isDebugEnabled()) log.debug("getRequestPayload");
+ log.debug("getRequestPayload");
List<QName> xmlNames = getRequestParamNames();
Object[] payload = new
Object[opMetaData.getJavaMethod().getParameterTypes().length];
Modified:
branches/jbossws-1.2.1/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SOAPFaultHelperJAXRPC.java
===================================================================
---
branches/jbossws-1.2.1/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SOAPFaultHelperJAXRPC.java 2007-03-27
11:06:26 UTC (rev 2691)
+++
branches/jbossws-1.2.1/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SOAPFaultHelperJAXRPC.java 2007-03-27
15:14:21 UTC (rev 2692)
@@ -55,6 +55,7 @@
import org.jboss.ws.core.jaxrpc.binding.SerializationContext;
import org.jboss.ws.core.jaxrpc.binding.SerializerFactoryBase;
import org.jboss.ws.core.jaxrpc.binding.SerializerSupport;
+import org.jboss.ws.core.jaxrpc.handler.MessageContextJAXRPC;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.soap.MessageFactoryImpl;
import org.jboss.ws.core.soap.NameImpl;
@@ -210,7 +211,7 @@
{
assertFaultCode(faultEx.getFaultCode());
- CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ MessageContextJAXRPC msgContext =
(MessageContextJAXRPC)MessageContextAssociation.peekMessageContext();
SerializationContext serContext = (msgContext != null ?
msgContext.getSerializationContext() : new SerializationContextJAXRPC());
NamespaceRegistry nsRegistry = serContext.getNamespaceRegistry();
Modified:
branches/jbossws-1.2.1/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SerializationContextJAXRPC.java
===================================================================
---
branches/jbossws-1.2.1/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SerializationContextJAXRPC.java 2007-03-27
11:06:26 UTC (rev 2691)
+++
branches/jbossws-1.2.1/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SerializationContextJAXRPC.java 2007-03-27
15:14:21 UTC (rev 2692)
@@ -58,7 +58,7 @@
{
if (jaxrpcMapping == null)
{
- if(log.isDebugEnabled()) log.debug("Generate jaxrpcMapping from
typeMapping");
+ log.debug("Generate jaxrpcMapping from typeMapping");
jaxrpcMapping = new JavaWsdlMapping();
for (QName xmlType : getTypeMapping().getRegisteredXmlTypes())
@@ -85,7 +85,8 @@
packageMapping.setNamespaceURI(nsURI);
packageMapping.setPackageType(packageName);
jaxrpcMapping.addPackageMapping(packageMapping);
- if(log.isDebugEnabled()) log.debug("Add package mapping: " +
packageMapping);
+ if (log.isDebugEnabled())
+ log.debug("Add package mapping: " + packageMapping);
}
// Do not add mappings for array types
@@ -100,7 +101,8 @@
xmlTypeMapping.setJavaType(javaTypeName);
xmlTypeMapping.setRootTypeQName(xmlType);
jaxrpcMapping.addJavaXmlTypeMappings(xmlTypeMapping);
- if(log.isDebugEnabled()) log.debug("Add type mapping: " +
xmlTypeMapping);
+ if (log.isDebugEnabled())
+ log.debug("Add type mapping: " + xmlTypeMapping);
}
}
}
Modified:
branches/jbossws-1.2.1/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/binding/DeserializerSupport.java
===================================================================
---
branches/jbossws-1.2.1/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/binding/DeserializerSupport.java 2007-03-27
11:06:26 UTC (rev 2691)
+++
branches/jbossws-1.2.1/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/binding/DeserializerSupport.java 2007-03-27
15:14:21 UTC (rev 2692)
@@ -30,6 +30,7 @@
import javax.xml.rpc.encoding.Deserializer;
import javax.xml.soap.SOAPBody;
import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
import javax.xml.transform.Source;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
@@ -39,9 +40,12 @@
import org.jboss.logging.Logger;
import org.jboss.util.NotImplementedException;
import org.jboss.ws.WSException;
+import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.soap.SOAPContentElement;
import org.jboss.ws.core.utils.DOMWriter;
import org.jboss.ws.core.utils.XMLPredefinedEntityReferenceResolver;
+import org.w3c.dom.Element;
import org.w3c.dom.Node;
/** The base class for all Deserializers.
@@ -58,18 +62,16 @@
QName xmlName = soapElement.getElementQName();
QName xmlType = soapElement.getXmlType();
+ Source source = soapElement.getXMLFragment().getSource();
+
SOAPContentElement refElement = getElementForHRef(soapElement);
if (refElement != null)
- {
- soapElement = refElement;
- xmlName = refElement.getElementQName();
- }
+ source = refElement.getXMLFragment().getSource();
- Source source = soapElement.getXMLFragment().getSource();
return deserialize(xmlName, xmlType, source, serContext);
}
- protected SOAPContentElement getElementForHRef(SOAPElement soapElement)
+ protected SOAPContentElement getElementForHRef(Element soapElement)
{
SOAPContentElement refElement = null;
if (soapElement.getAttribute("href").length() > 0)
@@ -77,24 +79,29 @@
String refID = soapElement.getAttribute("href");
log.debug("Resolve soap encoded href: " + refID);
- SOAPElement parentElement = soapElement.getParentElement();
- while ((parentElement instanceof SOAPBody) == false)
- parentElement = parentElement.getParentElement();
+ try
+ {
+ CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
+ SOAPBody soapBody = msgContext.getSOAPMessage().getSOAPBody();
- SOAPBody soapBody = (SOAPBody)parentElement;
- Iterator it = soapBody.getChildElements();
- while (it.hasNext())
- {
- SOAPElement auxElement = (SOAPElement)it.next();
- if (refID.equals("#" + auxElement.getAttribute("id")))
+ Iterator it = soapBody.getChildElements();
+ while (it.hasNext())
{
- refElement = (SOAPContentElement)auxElement;
- break;
+ SOAPElement auxElement = (SOAPElement)it.next();
+ if (refID.equals("#" +
auxElement.getAttribute("id")))
+ {
+ refElement = (SOAPContentElement)auxElement;
+ break;
+ }
}
}
+ catch (SOAPException ex)
+ {
+ throw new IllegalStateException("Cannot get href element: " +
refID, ex);
+ }
if (refElement == null)
- log.warn("Cannot find referrenced element: " + refID);
+ throw new IllegalStateException("Cannot get href element: " +
refID);
}
return refElement;
}
Modified:
branches/jbossws-1.2.1/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/binding/SOAPArrayDeserializer.java
===================================================================
---
branches/jbossws-1.2.1/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/binding/SOAPArrayDeserializer.java 2007-03-27
11:06:26 UTC (rev 2691)
+++
branches/jbossws-1.2.1/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/binding/SOAPArrayDeserializer.java 2007-03-27
15:14:21 UTC (rev 2692)
@@ -29,12 +29,10 @@
import java.util.StringTokenizer;
import javax.xml.namespace.QName;
-import javax.xml.soap.SOAPElement;
import javax.xml.transform.Source;
import javax.xml.transform.dom.DOMSource;
import org.jboss.logging.Logger;
-import org.jboss.util.NotImplementedException;
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
import org.jboss.ws.core.jaxrpc.TypeMappingImpl;
@@ -57,27 +55,15 @@
private DeserializerSupport componentDeserializer;
- public Object deserialize(QName xmlName, QName xmlType, Source xmlFragment,
SerializationContext serContext) throws BindingException
+ public Object deserialize(QName xmlName, QName xmlType, Source source,
SerializationContext serContext) throws BindingException
{
- throw new NotImplementedException("Use deserialize(SOAPContenentElement,
SerializationContext)");
- }
-
- public Object deserialize(SOAPContentElement soapElement, SerializationContext
serContext) throws BindingException
- {
- QName xmlName = soapElement.getElementQName();
- QName xmlType = soapElement.getXmlType();
-
- SOAPContentElement refElement = getElementForHRef(soapElement);
- if (refElement != null)
- soapElement = refElement;
-
log.debug("deserialize: [xmlName=" + xmlName + ",xmlType=" +
xmlType + "]");
+ Element soapElement = DOMUtils.sourceToElement(source);
try
{
ParameterMetaData paramMetaData =
(ParameterMetaData)serContext.getProperty(ParameterMetaData.class.getName());
QName compXmlType = paramMetaData.getSOAPArrayCompType();
- QName compXmlName = paramMetaData.getXmlName();
int[] arrDims = getDimensionsFromAttribute(soapElement);
Class compJavaType = getComponentTypeFromAttribute(soapElement, serContext);
@@ -112,18 +98,18 @@
if (arrDims.length < 1 || 2 < arrDims.length)
throw new WSException("Unsupported array dimensions: " +
Arrays.asList(arrDims));
- Iterator it = soapElement.getChildElements();
+ Iterator it = DOMUtils.getChildElements(soapElement);
if (arrDims.length == 1)
{
Object[] subArr = retArray;
- deserializeMemberValues(compXmlName, compXmlType, serContext, it, subArr);
+ deserializeMemberValues(compXmlType, serContext, it, subArr);
}
if (arrDims.length == 2)
{
for (int i = 0; i < arrDims[0]; i++)
{
Object[] subArr = (Object[])retArray[i];
- deserializeMemberValues(compXmlName, compXmlType, serContext, it,
subArr);
+ deserializeMemberValues(compXmlType, serContext, it, subArr);
}
}
@@ -140,15 +126,17 @@
}
}
- private void deserializeMemberValues(QName compXmlName, QName compXmlType,
SerializationContext serContext, Iterator it, Object[] subArr) throws BindingException
+ private void deserializeMemberValues(QName compXmlType, SerializationContext
serContext, Iterator it, Object[] subArr) throws BindingException
{
+ QName compXmlName = new QName("item");
+
int dim = subArr.length;
for (int i = 0; i < dim; i++)
{
Object compValue = null;
if (it.hasNext())
{
- SOAPElement childElement = (SOAPElement)it.next();
+ Element childElement = (Element)it.next();
Source source = new DOMSource(childElement);
SOAPContentElement refElement = getElementForHRef(childElement);
Modified:
branches/jbossws-1.2.1/jbossws-core/src/java/org/jboss/ws/core/soap/XMLFragment.java
===================================================================
---
branches/jbossws-1.2.1/jbossws-core/src/java/org/jboss/ws/core/soap/XMLFragment.java 2007-03-27
11:06:26 UTC (rev 2691)
+++
branches/jbossws-1.2.1/jbossws-core/src/java/org/jboss/ws/core/soap/XMLFragment.java 2007-03-27
15:14:21 UTC (rev 2692)
@@ -164,29 +164,7 @@
private static String sourceToStringFragement(Source source)
{
-
throw new IllegalArgumentException("Source should never be converted to
String");
-
- /*new
RuntimeException("sourceToStringFragement").printStackTrace(System.out);
-
- String xmlFragment = null;
-
- try {
- TransformerFactory tf = TransformerFactory.newInstance();
- ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
- tf.newTransformer().transform(source, new StreamResult(baos));
- xmlFragment = new String(baos.toByteArray());
- if (xmlFragment.startsWith("<?xml"))
- {
- int index = xmlFragment.indexOf(">");
- xmlFragment = xmlFragment.substring(index + 1);
- }
- } catch (TransformerException e) {
- WSException.rethrow(e);
- }
-
- return xmlFragment;
- */
}
public void writeTo(Writer writer) throws IOException
@@ -206,9 +184,6 @@
*/
private void writeSource(Writer writer) throws IOException
{
-
- //new RuntimeException("writeSource").printStackTrace(System.out);
-
if (source instanceof DOMSource)
{
DOMSource domSource = (DOMSource)source;
Modified: branches/jbossws-1.2.1/jbossws-tests/ant-import/build-jars-jaxrpc.xml
===================================================================
--- branches/jbossws-1.2.1/jbossws-tests/ant-import/build-jars-jaxrpc.xml 2007-03-27
11:06:26 UTC (rev 2691)
+++ branches/jbossws-1.2.1/jbossws-tests/ant-import/build-jars-jaxrpc.xml 2007-03-27
15:14:21 UTC (rev 2692)
@@ -147,7 +147,7 @@
<classes dir="${tests.output.dir}/classes">
<include
name="org/jboss/test/ws/jaxrpc/encoded/href/MarshallTestImpl.class"/>
<include
name="org/jboss/test/ws/jaxrpc/encoded/href/MarshallTest.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/encoded/href/HrefHandler.class"/>
+ <include
name="org/jboss/test/ws/jaxrpc/encoded/href/HRefHandler.class"/>
</classes>
<webinf
dir="${tests.output.dir}/resources/jaxrpc/encoded/href/WEB-INF">
<include name="jaxrpc-mapping.xml"/>
@@ -158,7 +158,7 @@
<jar
jarfile="${tests.output.dir}/libs/jaxrpc-encoded-href-client.jar">
<fileset dir="${tests.output.dir}/classes">
<include
name="org/jboss/test/ws/jaxrpc/encoded/href/MarshallTest.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/encoded/href/HrefHandler.class"/>
+ <include
name="org/jboss/test/ws/jaxrpc/encoded/href/HRefHandler.class"/>
</fileset>
<metainf
dir="${tests.output.dir}/resources/jaxrpc/encoded/href/WEB-INF">
<include name="jaxrpc-mapping.xml"/>