From commits-return-14342-apmail-servicemix-commits-archive=servicemix.apache.org@servicemix.apache.org Tue May 25 04:09:29 2010 Return-Path: Delivered-To: apmail-servicemix-commits-archive@www.apache.org Received: (qmail 92518 invoked from network); 25 May 2010 04:09:28 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 25 May 2010 04:09:28 -0000 Received: (qmail 3042 invoked by uid 500); 25 May 2010 04:09:28 -0000 Delivered-To: apmail-servicemix-commits-archive@servicemix.apache.org Received: (qmail 2971 invoked by uid 500); 25 May 2010 04:09:27 -0000 Mailing-List: contact commits-help@servicemix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@servicemix.apache.org Delivered-To: mailing list commits@servicemix.apache.org Received: (qmail 2964 invoked by uid 99); 25 May 2010 04:09:26 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 May 2010 04:09:26 +0000 X-ASF-Spam-Status: No, hits=-1994.3 required=10.0 tests=ALL_TRUSTED,HTML_MESSAGE,MIME_HTML_ONLY X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 May 2010 04:09:22 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id o4P491mp016988 for ; Tue, 25 May 2010 04:09:01 GMT Date: Tue, 25 May 2010 00:09:01 -0400 (EDT) From: confluence@apache.org To: commits@servicemix.apache.org Message-ID: <29822122.839.1274760541202.JavaMail.confluence@thor> Subject: [CONF] Apache ServiceMix > servicemix-cxf-bc MIME-Version: 1.0 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Auto-Submitted: auto-generated X-Virus-Checked: Checked by ClamAV on apache.org

servicemix-cxf-bc

Page edited by Freeman Fang


Changes (1)

=20 =20
...
[here|http://svn.apache.org/r= epos/asf/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/ja= va/org/apache/servicemix/cxfbc/ws/rm/CxfBcRMSequenceTest.java]
h3. More= about [Cxf WS-RM|http://cwiki.apache.org/CXF20DOC/ws-reliablemessaging.htm= l] implementation

h2. Interceptors Configuration
Since cxfbc is using [Apache = CXF|http://cxf.apache.org/] internally, so you can configure cxf bc endpoin= t with inteceptors which follow cxf inteceptor api.
example per as belo= w
{code:lang=3Dxml}
<cxfbc:consumer wsdl=3D"..."> =
<cxfbc:inInterceptors>
<bean class=3D&q= uot;org.apache.cxf.interceptor.LoggingInInterceptor"/>
= </cxfbc:inInterceptors>
<cxfbc:outInterceptors> <bean class=3D"org.apache.cxf.interceptor.LoggingOutInte= rceptor"/>
</cxfbc:outInterceptors>
&= lt;cxfbc:inFaultInterceptors>
<bean class=3D"org.a= pache.cxf.interceptor.LoggingInInterceptor"/>
</cxfb= c:inFaultInterceptors>
<cxfbc:outFaultInterceptors> <bean class=3D"org.apache.cxf.interceptor.LoggingOutInt= erceptor"/>
</cxfbc:outFaultInterceptors>
= </cxfbc:consumer>

{code}

Can find document for CXF = interceptors [here|http://cwiki.apache.org/confluence/display/CXF20DOC/Inte= rceptors]

h2. Features configuration
You can also configure cx= f features directly on cxf bc endpoint. Example per as below
{code:lang= =3Dxml}
<cxfbc:consumer wsdl=3D"...">
<cxf= bc:features>
<bean class=3D"org.apache.cxf.transp= ort.jms.JMSConfigFeature">
<property name=3D= "jmsConfig">
<bean class=3D"or= g.apache.cxf.transport.jms.JMSConfiguration">
= <property name=3D"concurrentConsumers">
= <value>5</value>
= </property>
<property name=3D"c= onnectionFactory">
<ref bean=3D&= quot;myConnectionFactory" />
</prope= rty>
<property name=3D"targetDestina= tion">
<value>test.jmstranspo= rt.text</value>
</property>
= <property name=3D"useJms11">
= <value>false</value>
= </property>
</bean>
= </property>
</bean>
</= cxfbc:features>
</cxfbc:consumer>
{code}

Full Content

servicemix-cx= f-bc

ServiceMix ships with a JBI compliant HTTP/SOAP or JMS/SOAP binding comp= onent named servicemix-cxf-bc which use apache cxf internally= .

Here are the main features:

    =09
  • JBI compliant Binding Component
  • =09
  • Usable in a lightweight mode in servicemix.xml configuration files =09
  • SOAP 1.1 and 1.2 support
  • =09
  • MIME attachments
  • =09
  • Support for all MEPs as consumers or providers
  • =09
  • SSL support
  • =09
  • WS-Security support
  • =09
  • WS-Policy support
  • =09
  • WS-RM support
  • =09
  • WS-Addressing support

Installation

Installing the servicemix-cxf-bc component can be done in several ways:<= /p>

    =09
  • drop the installer zip in an hotdeploy directory monitored by Servic= eMix
  • =09
  • using ant tasks

Note that when using ant tasks, the component is not started, you will h= ave to start it manually using ant tasks or a console.

XBean deployment

You can deploy Service Units containing a file named xbean.xml for activ= ating consumer and provider endpoints.
This xml file should respect the given syntax, though this is a spring based xml configuration file
See a full example here.  Note that you have to define the http namespa= ce with

<beans xmlns:http<=
/span>=3D"http://servicemix.apache.org/cxfbc/1.0=
">
    ...
</beans>

Any numbers of endpoints can be specified in the xbean.xml file.

Consumer endpoint

A consumer endpoint is a server-side cxf endpoint that will consume plai= n HTTP+SOAP requests and send them into the NMR to a given JBI endpoint, wh= ich is called the proxied endpoint.

Following is an example of an http consumer endpoint.

<cxfbc:consumer wsdl=3D"/wsdl/calculator.wsdl=
"
                      service=3D"calculator:Calc=
ulatorService"
                      endpoint=3D"CalculatorPort=
"
                      targetEndpoint=3D"Calculat=
orPortProxy"
                      targetService=3D"calculato=
r:CalculatorService"
                      targetInterface=3D"calcula=
tor:CalculatorPortType">
         =20
</cxfbc:consumer>
3D""Consumer endpoint attributes<= br />
Name Type Description Required
wsdl String the wsdl will be retrieved from the given locat= ion yes
service QName the service name of the proxied endpoint no (required if the WSDL has more than one serv= ice)
endpoint String the endpoint name of the proxied endpoint no (required if the specified service has more = than one endpoint)
interfaceName QName the interface name of the proxied endpoint no
targetService QName the service name of the target endpoint no (defaults to the service attribute)
targetEndpoint String the endpoint name of the target endpoint no (defaults to the endpoint attribute)
targetInterfaceName QName the interface name of the target endpoint no
busCfg String the spring configuration file used for cxf bus = initialization no
mtomEnabled boolean Enable MTOM / attachment support no (defaults to false)
synchronous boolean Specifies if the endpoint expects send messageE= xchange by sendSync no (defaults to false)
useJBIWrapper boolean Specifies if the endpoint expects messages to us= e the JBI wrapper for SOAP messages. no (defaults to true,Ignore the value of useSOA= PEnvelope if useJBIWrapper is true)
useSOAPEnvelope boolean Specifies if the endpoint expects soap messages= when useJBIWrapper is false no (defaults to true)
locationURI String Specifies the HTTP address to which requests ar= e sent. This value will overide any value specified in the WSDL. no (if provided the value will override the URL= defined in the WSDL)
timeout long Specifies the interval for which the endpoint w= ill wait for a response, This is specified in seconds. no (defaults to 0 which means wait until respon= se back)
x509 boolean Specifies if the endpoint use X.509 Certificate= to do the authentication. no (defaults to false), by default we delegate= AA to SMX JAASAuthenticationService with ws-security UsernameToken, if we = set this flag as true, we can check for X.509 certificate to run authentica= tion with
delegateToJaas boolean Specifies if the endpoint delegate to JAASAuthe= nticationService to do the authentication. no (defaults to true) If we only want ws-securi= ty get involved and don't want to delegate to SMX JAASAuthenticationServic= e then set this flag as false
schemaValidationEnabled boolean Specifies if the endpoint use schemavalidation = for the incoming/outgoing message. no (defaults to false)
properties Map Sets arbitrary properties that are added to the= CXF context at the Endpoint level. no

The targetService, targetEndpoint and targetInterfaceNa= me attributes can be used to specify the routing method to use (routing= by interface, service or endpoint) and is also useful to allow several pro= xy endpoints to be created for the same JBI endpoint.

3D""We leverage all ws-* features from apach= e cxf by means of putting configuration into busCfg which is used for cxf b= us initialization

Provider endpoint

A provider endpoint is a client-side jbi endpoint which can receive requ= ests from the NMR and send them to a given url where the service is provide= d.

Here is an example of an http provider endpoint:

<cxfbc:provider wsdl=3D"/wsdl/calculator.wsdl=
"
                      locationURI=3D"http://loca=
lhost:9001/bridgetest"
                      service=3D"calculator:Calc=
ulatorService"
                      endpoint=3D"CalculatorPort=
Proxy"
                      interfaceName=3D"calculato=
r:CalculatorPortType">

</cxfbc:provider>
3D""Provider endpoint attributes<= br />
Name Type Description Required
wsdl String the wsdl will be retrieved from the given locat= ion yes
service QName the service name of the exposed jbi endpoint yes
endpoint String the endpoint name of the exposed jbi endpoint <= /td> yes
interfaceName QName the interface name of the exposed jbi endpoint = no
locationURI URI the http url of the target service no (if provided the value will override the URL= defined in the WSDL)
busCfg String the spring configuration file used for cxf bus = initialization no
mtomEnabled boolean Enable MTOM / attachment support no (defaults to false)
useJBIWrapper boolean Specifies if the endpoint expects messages to us= e the JBI wrapper for SOAP messages. no (defaults to true,Ignore the value of useSOA= PEnvelope if useJBIWrapper is true)
useSOAPEnvelope boolean Specifies if the endpoint expects soap messages= when useJBIWrapper is false no (defaults to true)
schemaValidationEnabled boolean Specifies if the endpoint use schemavalidation = for the incoming/outgoing message. no (defaults to false)
properties Map Sets arbitrary properties that are added to the= CXF context at the Endpoint level. no

It is important to note that you need to include the classpath element i= n your xbean.xml if you are deploying the Cxf Provider in a service unit so= that the wsdl can correctly find the classpath element.  Also you nee= d to ensure that the service name and endpoint match the service and port e= lements of the WSDL that you wish to use to correctly return WSDL for the e= ndpoint,  remembering that the service name will use the targetNamespa= ce for the WSDL.

Lightweight mode

The servicemix-cxf-bc component can also be configured in a spring/xbean= configuration file, for use in an embedded ServiceMix.
Here is an example of such a configuration:

<sm:activationSpec>
  <sm:component>
    <cxfbc:component>
      <cxfbc:consumer wsdl=3D"/wsdl/calculato=
r.wsdl"
                      service=3D"calculator:Calc=
ulatorService"
                      endpoint=3D"CalculatorPort=
"
                      targetEndpoint=3D"Calculat=
orPortProxy"
                      targetService=3D"calculato=
r:CalculatorService"
                      targetInterface=3D"calcula=
tor:CalculatorPortType">
         =20
      </cxfbc:consumer>
<cxfbc:provider wsdl=3D"/wsdl/calculator.wsdl=
"
                      locationURI=3D"http://loca=
lhost:9001/bridgetest"
                      service=3D"calculator:Calc=
ulatorService"
                      endpoint=3D"CalculatorPort=
Proxy"
                      interfaceName=3D"calculato=
r:CalculatorPortType"
                     >
      </cxfbc:provider>
    </cxfbc:component>
  </sm:component>
</sm:activationSpec>


3D""Classpath issues when embedding se= rvicemix-cxf-bc component
When using the servicemix.xml configurat= ion file to create cxfbc endpoints, you must include the servicemix-cxf-bc-= xxx.jar in your classpath.
You will find this file inside the component installer (./components/servic= emix-cxf-bc-xxx.zip).
Failing this, an IllegalArgumentException will be thrown with the following= message:
Component name: xxxxxx is bound to an object which is not a JBI component,= it is of type: javax.xml.namespace.QName

WS-Addressing

When used on a SOAP consumer endpoint, servicemix-http handles the WS-Ad= ressing Action and To headers.

wsa:Action

The wsa:Action header can be used to specify the target interface name a= nd operation to use for the JBI exchange.

The header uses the following syntax:

[target namespace][delimiter][interface=
 name][delimiter][operation name]

where:

    =09
  • [delimiter] is ":" when the [target namespace] is a URN, otherwise "= /".
  • =09
  • [target namespace] is the namespace of the interface.
  • =09
  • [interface name] is the name of the interface.
  • =09
  • [operation name] is the name of the operation.

For example, the following header

<wsa:Action>http://example.com/stockq=
uote/StockQuoteInterface/GetLastTradePrice</wsa=
:Action>

will be used to address the JBI exchange with the following properties:<= /p>

wsa:To

The wsa:To header specifies the target JBI service name and endpoint nam= e.

The header uses the following syntax:

[target namespace][delimiter][service name][delimiter][endpoint name]

where:

    =09
  • [delimiter] is ":" when the [target namespace] is a URN, otherwise "= /".
  • =09
  • [target namespace] is the namespace of the interface.
  • =09
  • [service name] is the name of the service.
  • =09
  • [endpoint name] is the name of the endpoint.

For example, the following header

<wsa:To>urn:example:stockquote:StockQ=
uoteService:JBIEndpoint</wsa:To>

will be used to address the JBI exchange with the following properties:<= /p>

    =09
  • service name: {urn:example:stockquote}StockQuoteService
  • =09
  • endpoint name: JBIEndpoint

    Y= ou can find a WS-Addressing test case here

    More about <= a href=3D"http://cwiki.apache.org/CXF20DOC/ws-addressing.html" class=3D"ext= ernal-link" rel=3D"nofollow">Cxf WS-Addressing implementation

WS-Policy

You can f= ind a WS-Policy test case

here<= /p>

More about Cxf WS-Policy implementation

WS-Security

You can= find a WS-Security test case

here<= /a>

More about Cxf WS-Security implementation

WS-RM

You can find = a WS-RM test case

here<= /p>

More about Cxf WS-RM implementation

Interceptor= s Configuration

Since cxfbc is using Apache CXF internally, so you can configure cx= f bc endpoint with inteceptors which follow cxf inteceptor api.
example per as below

 <cxfbc:consumer wsdl=3D"...">
         <cxfbc:inInterceptors>
          <bean class=3D"org.apache.cxf.interceptor.LoggingInInterceptor"/>
        </cxfbc:inInterceptors>
        <cxfbc:outInterceptors>
          <bean class=3D"org.apache.cxf.interceptor.LoggingOutInterceptor"/>
        </cxfbc:outInterceptors>
        <cxfbc:inFaultInterceptors>
          <bean class=3D"org.apache.cxf.interceptor.LoggingInInterceptor"/>
        </cxfbc:inFaultInterceptors>
        <cxfbc:outFaultInterceptors>
          <bean class=3D"org.apache.cxf.interceptor.LoggingOutInterceptor"/>
        </cxfbc:outFaultInterceptors>
   </cxfbc:consumer>

Can find document for CXF interceptors here

Features config= uration

You can also configure cxf features directly on cxf bc endpoint. Example= per as below

 <cxfbc:consumer wsdl=3D"...">
     <cxfbc:features>
           <bean class=3D"org.apache.cxf.transport.jms.JMSConfigFeature">
                <property name=3D"jmsConfig">
                    <bean class=3D"org.apache.cxf.transport.jms.JMSConfiguration"><=
/span>
                        <property name=3D"concurrentConsumers">
                            <value>5<=
span class=3D"code-tag"></value>
                        </property>
                        <property name=3D"connectionFactory">
                            <ref bean=3D"myConnectionFactory" />
                        </property>
                        <property name=3D"targetDestination">
                            <value>te=
st.jmstransport.text</value>
                        </property>
                        <property name=3D"useJms11">
                            <value>fa=
lse</value>
                        </property>
                    </bean>
                </property>
            </bean>
        </cxfbc:features>
</cxfbc:consumer>