I'm cxf component testing in Servicemix 3.3.1, Windows XP.
As a example of cxf-wsdl-first, it's quite simple that
client -> cxf-bc -> cxf-se
and cxf-se returns response message to the webservice client.
It´s an easy task.
By the way, I wanna add other service(or services) to this structure (e.g.
sm-bean - disposing of business)
so I changed this as following
Webservice client -> cxf-bc -> eip(static routing slip) -> sm-bean
-> cxf-se
The client is soupUI 3.0.1 and send soap message based on the WSDL in
cxf-bc.
In this case, is it impossible that sm-bean receives message from cxf-bc and
sends transformed message
to the cxf-se? or is there better way to operate this logic?
sm-bean code, xbean configuration and result logs are like this
-----------cxfbc xbean.xml-----------------
<beans xmlns:cxfbc="http://servicemix.apache.org/cxfbc/1.0"
xmlns:demows="http://ws.demo/">
<cxfbc:consumer wsdl="classpath:ws_t02.wsdl"
targetService="demows:route-slip"
targetEndpoint="static-routing-slip"
useJBIWrapper="true"
>
<cxfbc:inInterceptors
...(default interceptor)
/>
</cxfbc:consumer>
----------cxfse xbean.xml---------------------
<beans xmlns:cxfse="http://servicemix.apache.org/cxfse/1.0">
<cxfse:endpoint useJBIWrapper="false" useSOAPEnvelope="false">
<cxfse:pojo>
<bean class="test.ws.HelloImpl" />
</cxfse:pojo>
<cxfse:inInterceptors
...(default interceptor)
/>
</cxfse:endpoint>
</beans>
----------cxfse test.ws.HelloImpl------------------
@WebService
public class HelloImpl {
public String sayHello(String name) {
return "HI ~~ " + name;
}
}
----------eip:static-routing-slip xbean.xml--------------
<beans xmlns:eip="http://servicemix.apache.org/eip/1.0"
xmlns:demows="http://ws.demo/"
xmlns:testws="http://ws.test/"
>
<eip:static-routing-slip service="demows:route-slip"
endpoint="static-routing-slip">
<eip:targets>
<eip:exchange-target service="demows:test-bean-su"/>
<eip:exchange-target service="testws:HelloImplService"
endpoint="HelloImplPort" operation="testws:sayHello"/>
</eip:targets>
</eip:static-routing-slip>
</beans>
---------sm-bean(demows:test-bean-su) onMessageExchange
code---------------------
public class TestBean implements MessageExchangeListener {
private DeliveryChannel channel;
public void onMessageExchange(MessageExchange exchange) throws
MessagingException {
SourceTransformer st = new SourceTransformer();
NormalizedMessage inMessage = exchange.getMessage("in");
String indata = st.contentToString(inMessage);
NormalizedMessage out = exchange.createMessage();
// suppose that this xml is return message after disposing
business
String retData = "<?xml version=\"1.0\" ?>\n"
+ "<root>qwer</root>\r\n";
out.setContent(new StringSource(retData));
exchange.setMessage(out, "out");
channel.send(exchange);
}
}
--------------Logs---------------------------------
INFO - LoggingInInterceptor - Inbound Message
----------------------------
Encoding: UTF-8
Headers: {Content-Length=[287], Host=[10.1.3.28:9090], User-Agent=[Jakarta
Commons-HttpClient/3.1],
accept-encoding=[gzip,deflate], SOAPAction=[""],
content-type=[text/xml;charset=UTF-8]}
Messages:
Message:
Payload: <soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http:
//ws.test/">
<soapenv:Header/>
<soapenv:Body>
<ws:sayHello>
<!--Optional:-->
<arg0>1234qwer</arg0>
</ws:sayHello>
</soapenv:Body>
</soapenv:Envelope>
--------------------------------------
INFO - JBITransportFactory - configuring DeliveryChannel:
org.apache.servicemix.common
.endpointdeliverychan...@1ccf0ad
INFO - PhaseInterceptorChain - Interceptor has thrown exception,
unwinding now Message par
t root was not recognized. (Does it exist in service WSDL?)
INFO - LoggingOutInterceptor - Outbound Message
---------------------------
Encoding: UTF-8
Headers:
Messages:
Payload: <ns1:Fault
xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/"><faultcode>ns1:Client</fau
ltcode><faultstring>Message part root was not recognized. (Does it exist in
service WSDL?)</faultst
ring></ns1:Fault>
--------------------------------------
WARN - SimpleEndpoint - SimpleEndpoint.fail called:
INFO - PhaseInterceptorChain - Interceptor has thrown exception,
unwinding now Message par
t root was not recognized. (Does it exist in service WSDL?)
INFO - LoggingOutInterceptor - Outbound Message
---------------------------
Encoding: UTF-8
Headers: {}
Messages:
Payload: <soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Faul
t><faultcode>soap:Server</faultcode><faultstring>Message part root was not
recognized. (Does it exi
st in service WSDL?)</faultstring></soap:Fault></soap:Body></soap:Envelope>
--------------------------------------
Additionally I think that the next best way is
Webservice client -> cxf-bc -> eip(static routing slip) -> sm-bean
I wonder if sm-bean receives message from cxf-bc and return response
messages to the client using a cxf-bc interceptor.
--
View this message in context:
http://www.nabble.com/Question-about-cxf-bc-and-cxf-se-with-sm-bean-tp25467617p25467617.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.