Hi All,
I'd like to provide my first patch as the start.
This patch is based on Nodet's cxf bc module, and fix compile and test
failure which is caused by cxf api changed.
Please review and apply this patch for me.
Tons of thanks
Freeman
Freeman Fang wrote:
Hi all,
I am from apache cxf team.
I am going to add cxf binding component into servicemix which can
support ws-*.
In next several weeks there would be questions and patches.
Thanks in advance for answering my questions and reviewing and
applying the patches.
Thanks again
Freeman
Index:
deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiOperationInterceptor.java
===================================================================
---
deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiOperationInterceptor.java
(revision 550382)
+++
deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiOperationInterceptor.java
(working copy)
@@ -37,8 +37,7 @@
public class JbiOperationInterceptor extends AbstractPhaseInterceptor<Message>
{
public JbiOperationInterceptor() {
- super();
- setPhase(Phase.UNMARSHAL);
+ super(Phase.UNMARSHAL);
addAfter(URIMappingInterceptor.class.getName());
}
Index:
deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiInWsdl1Interceptor.java
===================================================================
---
deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiInWsdl1Interceptor.java
(revision 550382)
+++
deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiInWsdl1Interceptor.java
(working copy)
@@ -37,6 +37,7 @@
import org.apache.cxf.binding.soap.model.SoapBindingInfo;
import org.apache.cxf.binding.soap.model.SoapHeaderInfo;
import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.headers.Header;
import org.apache.cxf.interceptor.Fault;
import org.apache.cxf.message.Exchange;
import org.apache.cxf.message.Message;
@@ -56,7 +57,7 @@
public class JbiInWsdl1Interceptor extends AbstractSoapInterceptor {
public JbiInWsdl1Interceptor() {
- setPhase(Phase.UNMARSHAL);
+ super(Phase.UNMARSHAL);
addAfter(JbiOperationInterceptor.class.getName());
}
@@ -104,7 +105,7 @@
}
Element body = getBodyElement(message);
List<SoapHeaderInfo> headers =
wsdlMessage.getExtensors(SoapHeaderInfo.class);
- Element headerElement = message.getHeaders(Element.class);
+ List<Header> headerElement = message.getHeaders();
List<Object> parts = new ArrayList<Object>();
for (MessagePartInfo part : wsdlMessage.getMessageParts()) {
if ("document".equals(style)) {
@@ -129,10 +130,10 @@
if (headers != null) {
for (SoapHeaderInfo header : headers) {
MessagePartInfo part = header.getPart();
- Element param = findHeader(headerElement, part);
+ Header param = findHeader(headerElement, part);
int idx = part.getIndex();
QName element = part.getElementQName();
- Element hdr = getHeaderElement(message, element);
+ Header hdr = getHeaderElement(message, element);
if (hdr == null) {
throw new Fault(new Exception("Missing required header
element: "
+ QNameUtil.toString(element)));
@@ -190,7 +191,7 @@
}
}
- protected Element getHeaderElement(SoapMessage message, QName name) {
+ protected Header getHeaderElement(SoapMessage message, QName name) {
Exchange exchange = message.getExchange();
BindingOperationInfo bop = exchange.get(BindingOperationInfo.class);
if (bop.isUnwrapped()) {
@@ -206,11 +207,11 @@
if (headers == null || headers.size() == 0) {
return null;
}
- Element headerElement = message.getHeaders(Element.class);
+ List<Header> headerElement = message.getHeaders();
for (SoapHeaderInfo header : headers) {
if (header.getPart().getElementQName().equals(name)) {
MessagePartInfo mpi = header.getPart();
- Element param = findHeader(headerElement, mpi);
+ Header param = findHeader(headerElement, mpi);
return param;
}
}
@@ -236,18 +237,16 @@
}
}
- private static Element findHeader(Element headerElement, MessagePartInfo
mpi) {
- NodeList nodeList = headerElement.getChildNodes();
- Element param = null;
- if (nodeList != null) {
+ private static Header findHeader(List<Header> headerElement,
MessagePartInfo mpi) {
+ Header param = null;
+ if (headerElement != null) {
QName name = mpi.getConcreteName();
- for (int i = 0; i < nodeList.getLength(); i++) {
- Node n = nodeList.item(i);
- if (n.getNamespaceURI() != null
- && n.getNamespaceURI().equals(name.getNamespaceURI())
- && n.getLocalName() != null
- && n.getLocalName().equals(name.getLocalPart())) {
- param = (Element) n;
+ for (Header header : headerElement) {
+ if (header.getName().getNamespaceURI() != null
+ &&
header.getName().getNamespaceURI().equals(name.getNamespaceURI())
+ && header.getName().getLocalPart() != null
+ &&
header.getName().getLocalPart().equals(name.getLocalPart())) {
+ param = header;
}
}
}
Index:
deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiOutWsdl1Interceptor.java
===================================================================
---
deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiOutWsdl1Interceptor.java
(revision 550382)
+++
deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiOutWsdl1Interceptor.java
(working copy)
@@ -51,7 +51,7 @@
public class JbiOutWsdl1Interceptor extends AbstractSoapInterceptor {
public JbiOutWsdl1Interceptor() {
- setPhase(Phase.MARSHAL);
+ super(Phase.MARSHAL);
}
public void handleMessage(SoapMessage message) {
@@ -89,7 +89,7 @@
List<SoapHeaderInfo> headers =
msg.getExtensors(SoapHeaderInfo.class);
for (SoapHeaderInfo header : headers) {
NodeList nl = partsContent.get(header.getPart().getIndex());
- Element headerElement = message.getHeaders(Element.class);
+ Element headerElement = message.get(Element.class);
for (int i = 0; i < nl.getLength(); i++) {
headerElement.appendChild(nl.item(i));
}
Index:
deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiInInterceptor.java
===================================================================
---
deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiInInterceptor.java
(revision 550382)
+++
deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiInInterceptor.java
(working copy)
@@ -45,7 +45,7 @@
public static final String OPERATION_MEP = "MEP";
public JbiInInterceptor() {
- setPhase(Phase.PRE_INVOKE);
+ super(Phase.PRE_INVOKE);
}
public void handleMessage(Message message) {
Index:
deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
===================================================================
---
deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
(revision 550382)
+++
deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
(working copy)
@@ -175,7 +175,7 @@
protected class JbiInvokerInterceptor extends
AbstractPhaseInterceptor<Message> {
public JbiInvokerInterceptor() {
- setPhase(Phase.INVOKE);
+ super(Phase.INVOKE);
}
public void handleMessage(final Message message) throws Fault {
@@ -200,7 +200,7 @@
protected static class JbiPostInvokerInterceptor extends
AbstractPhaseInterceptor<Message> {
public JbiPostInvokerInterceptor() {
- setPhase(Phase.POST_INVOKE);
+ super(Phase.POST_INVOKE);
addBefore(OutgoingChainInterceptor.class.getName());
}
Index: deployables/bindingcomponents/servicemix-cxf-bc/pom.xml
===================================================================
--- deployables/bindingcomponents/servicemix-cxf-bc/pom.xml (revision
550382)
+++ deployables/bindingcomponents/servicemix-cxf-bc/pom.xml (working copy)
@@ -30,8 +30,8 @@
<groupId>org.apache.servicemix</groupId>
<artifactId>servicemix-cxf-bc</artifactId>
<packaging>jbi-component</packaging>
- <name>ServiceMix :: File</name>
- <description>A File component</description>
+ <name>ServiceMix :: CXF</name>
+ <description>A CXF component</description>
<dependencies>
<dependency>
@@ -40,6 +40,11 @@
<version>${servicemix-version}</version>
</dependency>
<dependency>
+ <groupId>org.apache.servicemix</groupId>
+ <artifactId>servicemix-services</artifactId>
+ <version>${servicemix-version}</version>
+ </dependency>
+ <dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>${cxf-version}</version>