You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by sc...@apache.org on 2009/12/23 18:23:56 UTC
svn commit: r893580 - in /webservices/axis2/trunk/java/modules:
jaxws-integration/test/org/apache/axis2/jaxws/sample/DLWMinTests.java
jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMinimalMethodMarshaller.java
Author: scheu
Date: Wed Dec 23 17:23:56 2009
New Revision: 893580
URL: http://svn.apache.org/viewvc?rev=893580&view=rev
Log:
AXIS2-3341
Contributor:Rich Scheuerle
This fix corrects the special case of byte[] parameters when using doc/lit wrapped minimal.
Modified:
webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/DLWMinTests.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMinimalMethodMarshaller.java
Modified: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/DLWMinTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/DLWMinTests.java?rev=893580&r1=893579&r2=893580&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/DLWMinTests.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/DLWMinTests.java Wed Dec 23 17:23:56 2009
@@ -193,9 +193,7 @@
String request =
"<pre:simpleTest xmlns:pre='http://apache.org/axis2/jaxws/sample/dlwmin'>" +
"<pre:name>user1</pre:name>" +
- "<pre:bytes>1</pre:bytes>" +
- "<pre:bytes>2</pre:bytes>" +
- "<pre:bytes>3</pre:bytes>" +
+ "<pre:bytes>010203</pre:bytes>" +
"</pre:simpleTest>";
TestLogger.logger.debug("Doc/Lit Wrapped Minimal Request =" + request);
String response = dispatch.invoke(request);
@@ -226,9 +224,7 @@
String request =
"<pre:simpleTest xmlns:pre='http://apache.org/axis2/jaxws/sample/dlwmin'>" +
- "<pre:bytes>1</pre:bytes>" +
- "<pre:bytes>2</pre:bytes>" +
- "<pre:bytes>3</pre:bytes>" +
+ "<pre:bytes>010203</pre:bytes>" +
"</pre:simpleTest>";
TestLogger.logger.debug("Doc/Lit Wrapped Minimal Request =" + request);
String response = dispatch.invoke(request);
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMinimalMethodMarshaller.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMinimalMethodMarshaller.java?rev=893580&r1=893579&r2=893580&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMinimalMethodMarshaller.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMinimalMethodMarshaller.java Wed Dec 23 17:23:56 2009
@@ -350,7 +350,7 @@
}
Element returnElement = null;
QName returnQName = new QName(returnNS, returnLocalPart);
- if (isListOrArray(returnObject)) {
+ if (representAsOccurrence(returnObject)) {
if (log.isDebugEnabled()) {
log.debug("Return element isListOrArray");
}
@@ -436,7 +436,7 @@
if (elementValue instanceof JAXBElement) {
JAXBElement jaxb = (JAXBElement) elementValue;
Object value = jaxb.getValue();
- if (isListOrArray(value)) {
+ if (representAsOccurrence(value)) {
if (log.isDebugEnabled()) {
log.debug("Build OccurrentArray");
}
@@ -455,13 +455,26 @@
/**
* @param value
- * @return true if List or Array
+ * @return true if this value should be represented as a series of occurrence
+ * elements
*/
- private static boolean isListOrArray (Object value) {
- boolean rc =(value instanceof List) ||
- (value != null && value.getClass().isArray());
+ private static boolean representAsOccurrence(Object value) {
+ // Represent as a series of occurrence elements if not List/Array
+ // but not a byte[]. A byte[] has its own encoding.
+
+ boolean rc = false;
+
+ if (value == null) {
+ rc = false;
+ } else if (value instanceof List) {
+ rc = true;
+ } else if (value.getClass().equals(byte[].class)) {
+ rc = false; // assume base64binary
+ } else if (value.getClass().isArray()) {
+ rc = true;
+ }
if (log.isDebugEnabled()) {
- log.debug("isListOrArray for " + JavaUtils.getObjectIdentity(value) + " " + rc);
+ log.debug("representAsOccurrence for " + JavaUtils.getObjectIdentity(value) + " " + rc);
}
return rc;
}
@@ -799,11 +812,16 @@
AttachmentDescription attachmentDesc = pd.getAttachmentDescription();
if (attachmentDesc == null) {
+ boolean isBase64Binary = byte[].class.equals(javaType[i]);
+
+
// In most cases the entire java object is unmarshalled.
// But in some cases, the java object is a series of
// elements.
boolean unmarshalComponents = false;
- if (pd.isListType() || javaComponentType[i] == null) {
+ if (pd.isListType() ||
+ javaComponentType[i] == null ||
+ isBase64Binary) {
context.setProcessType(javaType[i]);
context.setIsxmlList(pd.isListType());
} else {