You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2010/09/07 10:59:17 UTC
svn commit: r993288 - in /cxf/branches/2.2.x-fixes: ./
rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/
rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/
systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/
systests/jaxws/src/test...
Author: sergeyb
Date: Tue Sep 7 08:59:17 2010
New Revision: 993288
URL: http://svn.apache.org/viewvc?rev=993288&view=rev
Log:
Merged revisions 991893 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r991893 | sergeyb | 2010-09-02 12:21:57 +0100 (Thu, 02 Sep 2010) | 1 line
[CXF-2967] Support the unwrapping of JAXB responses for Dispatch
........
Added:
cxf/branches/2.2.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/AddNumbersServiceUnwrap.java
- copied unchanged from r991893, cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/AddNumbersServiceUnwrap.java
cxf/branches/2.2.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/AddNumbersUnwrap.java
- copied unchanged from r991893, cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/AddNumbersUnwrap.java
cxf/branches/2.2.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/types/
- copied from r991893, cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/types/
cxf/branches/2.2.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/types/AddNumbers.java
- copied unchanged from r991893, cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/types/AddNumbers.java
cxf/branches/2.2.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/types/AddNumbersResponse.java
- copied unchanged from r991893, cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/types/AddNumbersResponse.java
cxf/branches/2.2.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/types/package-info.java
- copied unchanged from r991893, cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/types/package-info.java
Modified:
cxf/branches/2.2.x-fixes/ (props changed)
cxf/branches/2.2.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataReaderImpl.java
cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
cxf/branches/2.2.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/DispatchHandlerInvocationTest.java
Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Sep 7 08:59:17 2010
@@ -1 +1 @@
-/cxf/trunk:989123,989434,990386,990593,991324,991416,991797,992000
+/cxf/trunk:989123,989434,990386,990593,991324,991416,991797,991893,992000
Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: cxf/branches/2.2.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataReaderImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataReaderImpl.java?rev=993288&r1=993287&r2=993288&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataReaderImpl.java (original)
+++ cxf/branches/2.2.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataReaderImpl.java Tue Sep 7 08:59:17 2010
@@ -68,6 +68,11 @@ public class DataReaderImpl<T> extends J
veventHandler = databinding.getValidationEventHandler();
}
setEventHandler = MessageUtils.getContextualBoolean(m, "set-jaxb-validation-event-handler", true);
+
+ Object unwrapProperty = m.get(JAXBDataBinding.UNWRAP_JAXB_ELEMENT);
+ if (unwrapProperty != null) {
+ unwrapJAXBElement = Boolean.TRUE.equals(unwrapProperty);
+ }
}
}
private Unmarshaller createUnmarshaller() {
@@ -106,9 +111,10 @@ public class DataReaderImpl<T> extends J
public Object read(MessagePartInfo part, T reader) {
boolean honorJaxbAnnotation = false;
- if (part != null && part.getProperty("honor.jaxb.annotations") != null) {
+ if (part != null && part.getProperty("honor.jaxb.annotations") != null) {
honorJaxbAnnotation = (Boolean)part.getProperty("honor.jaxb.annotations");
}
+
Annotation[] anns = null;
if (honorJaxbAnnotation) {
Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java?rev=993288&r1=993287&r2=993288&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java (original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java Tue Sep 7 08:59:17 2010
@@ -29,6 +29,7 @@ import java.util.logging.Logger;
import javax.activation.DataSource;
import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
import javax.xml.namespace.QName;
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPException;
@@ -275,6 +276,9 @@ public class DispatchImpl<T> implements
if (msg.countAttachments() > 0) {
client.getRequestContext().put(AttachmentOutInterceptor.WRITE_ATTACHMENTS, Boolean.TRUE);
}
+ } else if (context != null) {
+ Boolean unwrapProperty = obj instanceof JAXBElement ? Boolean.FALSE : Boolean.TRUE;
+ getRequestContext().put("unwrap.jaxb.element", unwrapProperty);
}
QName opName = (QName)getRequestContext().get(MessageContext.WSDL_OPERATION);
Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java?rev=993288&r1=993287&r2=993288&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java (original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java Tue Sep 7 08:59:17 2010
@@ -656,7 +656,6 @@ public class ServiceImpl extends Service
AbstractServiceFactoryBean sf = null;
try {
JAXBDataBinding db = new JAXBDataBinding(context);
- db.setUnwrapJAXBElement(false);
sf = createDispatchService(db);
} catch (ServiceConstructionException e) {
throw new WebServiceException(e);
Modified: cxf/branches/2.2.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/DispatchHandlerInvocationTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/DispatchHandlerInvocationTest.java?rev=993288&r1=993287&r2=993288&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/DispatchHandlerInvocationTest.java (original)
+++ cxf/branches/2.2.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/DispatchHandlerInvocationTest.java Tue Sep 7 08:59:17 2010
@@ -108,6 +108,37 @@ public class DispatchHandlerInvocationTe
AddNumbersResponse value = (AddNumbersResponse)response.getValue();
assertEquals(222, value.getReturn());
}
+
+ @Test
+ public void testInvokeWithJAXBUnwrapPayloadMode() throws Exception {
+ URL wsdl = getClass().getResource("/wsdl/addNumbers.wsdl");
+ assertNotNull(wsdl);
+
+ org.apache.cxf.systest.handlers.AddNumbersServiceUnwrap service =
+ new org.apache.cxf.systest.handlers.AddNumbersServiceUnwrap(wsdl, serviceName);
+ assertNotNull(service);
+
+ JAXBContext jc = JAXBContext.newInstance(
+ org.apache.cxf.systest.handlers.types.AddNumbers.class,
+ org.apache.cxf.systest.handlers.types.AddNumbersResponse.class);
+
+ Dispatch<Object> disp = service.createDispatch(portName, jc, Service.Mode.PAYLOAD);
+ setAddress(disp, addNumbersAddress);
+
+ TestHandler handler = new TestHandler();
+ TestSOAPHandler soapHandler = new TestSOAPHandler();
+ addHandlersProgrammatically(disp, handler, soapHandler);
+
+ org.apache.cxf.systest.handlers.types.AddNumbers req =
+ new org.apache.cxf.systest.handlers.types.AddNumbers();
+ req.setArg0(10);
+ req.setArg1(20);
+
+ org.apache.cxf.systest.handlers.types.AddNumbersResponse response =
+ (org.apache.cxf.systest.handlers.types.AddNumbersResponse)disp.invoke(req);
+ assertNotNull(response);
+ assertEquals(222, response.getReturn());
+ }
@Test
public void testInvokeWithDOMSourcMessageMode() throws Exception {