-
Notifications
You must be signed in to change notification settings - Fork 8
Service Message Level Processing
DRAFT
Two main functions :
- Data extraction to have informations about the protocol (SOAP, HTTP ...) and to get the message content.
- Setup of this extraction and on it transversal services, such as making it compatible with a previous version, security, message replaying ...
Three Methods / Solutions
-
Proxy wrapper : The Http discovery proxy act as a proxy wrapper. TODO tunnel != http proxy, ref monit
-
FraSCAti intents : An intent can be plugged on a SCA component. TODO ex. UML activity diagram tracer
-
CXF interceptors / JAXWS handlers : Using CXF Provider (server) / Dispatcher (client) api. With this API, we could create dynamic HTTP clients / servers for REST and especially for SOAP protocols.
Easier dynamic client, works on payload (SOAP body) or whole message, can work on different models, ex. for cxf : Source (DOM / SAX / Stream), JAXB (SOAP only), SOAPMessage, DataSource (mime ; http only).
For general informations about dispatch API : http://cxf.apache.org/docs/jax-ws-dispatch-api.html See the following link for developping a client : http://cxf.apache.org/docs/how-do-i-develop-a-client.html
Here is a example on how to work with an XML SOAP message : ex. soap message : @ServiceMode(value=javax.xml.ws.Service.Mode.MESSAGE) See https://blogs.oracle.com/artf/entry/operating_at_the_xml_message
Can work on same models. See http://cxf.apache.org/docs/provider-services.html though JAXB can be done manually within payload mode (i.e. soap body only), see http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/sts/provider/SecurityTokenServiceProvider.java?view=markup
Here is an example in rest with CXF : http://cxf.apache.org/docs/rest-with-jax-ws-provider-and-dispatch.html
xpath provider from xpath expression produces a filled class instance http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/XPathProviderTest.java?view=markup
CXF STS provider framework : SPI for implementing or integrating its own STS server in CXF See http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/sts/provider/SecurityTokenServiceProvider.java?view=markup
CXF SOAP or REST gives access to HTTP headers and much more in its CXF Message with its own attributes, available using JAXWS WebServiceContext some are standard, others specific ex. Map Message.PROTOCOL_HEADERS, see all at http://www.docjar.com/html/api/org/apache/cxf/message/Message.java.html and http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/restful_dispatch/src/main/java/demo/restful/server/RestSourcePayloadProvider.java?view=markup
43 @Resource
44 protected WebServiceContext wsContext;
37 import org.apache.cxf.message.Message;
51 String path = (String)mc.get(Message.PATH_INFO);
52 String query = (String)mc.get(Message.QUERY_STRING);
53 String httpMethod = (String)mc.get(Message.HTTP_REQUEST_METHOD);
- frontend : HTTP / jetty (no choice here)
- emitter / forwarder / sender (abstracted in its own SCA service) : could use a CXF REST or SOAP dynamic client, whose message uses HTTP & SOAP headers & content custom mapped from read ones ; though not better than now at all.
- extract HTTP headers from CXF Message (available from JAXWS WebServiceContext). TODO are all available ??? (otherwise CXF interceptor required)
- extract SOAP headers either from CXF Message, or using custom code (in Intent or wrapper), or more elegantly using a dedicated service wrapper proxy in JAXWS Provider Message mode, or (for ex. unsupported SOAP 2.0) in DataSource mode using custom parsing
- do both either in generic Intent, or in proxy wrapper, OR CXF interceptor
- extract business attributes either from business Intent (scripted in Light / FStudio), or using a dedicated service wrapper proxy in JAXWS Provider / Message / DOMSource and configured (injected properties or service) xpath expressions, or (for ex. unsupported content or JSON if not supported ??) in DataSource mode using custom parsing ; OR using custom CXF interceptor
- emitter / forwarder / sender (abstracted in its own SCA service) : could use a CXF REST or SOAP dynamic client, whose message uses HTTP & SOAP headers & content taken easily from CXF Message ; though not much better than now.
TODO Q FraSCAti CXF's implementation of the JAX-WS Handlers is based on its native interceptors http://soasidewalk.blogspot.com/2008/02/apache-cxf-and-soap-headers.html ?? and WS-* headers ??
TODO refs & also @handlerchain
JAX-WS Handlers JAXWS @HandlerChain annotation allows to configure JAXWS Handlers, which in CXF are CXF interceptors. See this tutorial : http://www.jroller.com/gmazza/entry/jaxws_handler_tutorial
A simple example of provider/dispatcher API in a test. See https://github.com/easysoa/EasySOA/blob/2983e8869e6d5307637facfdfe4f5f15c17a1b2b/easysoa-proxy/easysoa-proxy-core/easysoa-proxy-core-httpdiscoveryproxy/src/test/java/org/easysoa/cxf/CxfProviderDispatcherTest.java
At the moment, there is a problem using JAX-WS in FraSCAti : A lot of JAX-WS annotation are not fully supported by FraSCAti, most of the time simply ignored (see https://github.com/easysoa/EasySOA/issues/23).