Author: dkulp
Date: Mon Apr 14 10:43:09 2008
New Revision: 647919
URL: http://svn.apache.org/viewvc?rev=647919&view=rev
Log:
Remove some dead/unused code. Check to see if we can set oneway on the
exchange in the provider case.
Removed:
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/ProviderInDatabindingInterceptor.java
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/ProviderOutDatabindingInterceptor.java
Modified:
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/DispatchInDatabindingInterceptor.java
Modified:
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/DispatchInDatabindingInterceptor.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/DispatchInDatabindingInterceptor.java?rev=647919&r1=647918&r2=647919&view=diff
==============================================================================
---
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/DispatchInDatabindingInterceptor.java
(original)
+++
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/DispatchInDatabindingInterceptor.java
Mon Apr 14 10:43:09 2008
@@ -29,10 +29,12 @@
import javax.activation.DataSource;
import javax.mail.util.ByteArrayDataSource;
+import javax.xml.namespace.QName;
import javax.xml.soap.AttachmentPart;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.MimeHeader;
import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPBody;
import javax.xml.soap.SOAPConstants;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
@@ -76,6 +78,9 @@
//import org.apache.cxf.service.model.BindingOperationInfo;
//import org.apache.cxf.service.model.MessageInfo;
//import org.apache.cxf.service.model.MessagePartInfo;
+import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.service.model.OperationInfo;
+import org.apache.cxf.service.model.ServiceModelUtil;
import org.apache.cxf.staxutils.StaxUtils;
public class DispatchInDatabindingInterceptor extends
AbstractInDatabindingInterceptor {
@@ -166,7 +171,7 @@
} catch (Exception e) {
throw new Fault(e);
}
- }
+ }
private SOAPMessage newSOAPMessage(InputStream is, SoapMessage msg) throws
Exception {
SoapVersion version = msg.getVersion();
@@ -189,7 +194,44 @@
}
return msgFactory.createMessage(headers, is);
}
-
+
+ void setupBindingOperationInfo(Exchange exch, SOAPMessage msg) {
+ if (exch.get(BindingOperationInfo.class) == null) {
+ //need to know the operation to determine if oneway
+ QName opName = null;
+ try {
+ SOAPBody body = msg.getSOAPBody();
+ if (body != null) {
+ org.w3c.dom.Node nd = body.getFirstChild();
+ while (nd != null && !(nd instanceof org.w3c.dom.Element))
{
+ nd = nd.getNextSibling();
+ }
+ if (nd != null) {
+ opName = new QName(nd.getNamespaceURI(),
nd.getLocalName());
+ }
+ }
+ if (opName == null) {
+ return;
+ }
+ } catch (SOAPException e) {
+ //ignore and return;
+ return;
+ }
+ BindingOperationInfo bop = ServiceModelUtil
+ .getOperationForWrapperElement(exch, opName, false);
+ if (bop == null) {
+ bop = ServiceModelUtil.getOperation(exch, opName);
+ }
+ if (bop != null) {
+ exch.put(BindingOperationInfo.class, bop);
+ exch.put(OperationInfo.class, bop.getOperationInfo());
+ if (bop.getOutput() == null) {
+ exch.setOneWay(true);
+ }
+ }
+
+ }
+ }
//This interceptor is invoked after DispatchSOAPHandlerInterceptor,
converts SOAPMessage to Source
private class PostDispatchSOAPHandlerInterceptor extends
AbstractInDatabindingInterceptor {
@@ -205,7 +247,7 @@
if (message instanceof SoapMessage) {
SOAPMessage soapMessage =
message.getContent(SOAPMessage.class);
message.removeContent(SOAPMessage.class);
-
+ setupBindingOperationInfo(message.getExchange(), soapMessage);
DataReader<Node> dataReader = new NodeDataReader();
Node n = null;
if (mode == Service.Mode.MESSAGE) {
@@ -296,6 +338,7 @@
}
}
obj = msg;
+ setupBindingOperationInfo(message.getExchange(), msg);
} catch (Exception e) {
throw new Fault(e);
}