cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache CXF Documentation > WS-Addressing
Date Mon, 18 Mar 2013 18:45:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/2042/9/1/_/styles/combined.css?spaceKey=CXF20DOC&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/CXF20DOC/WS-Addressing">WS-Addressing</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~dkulp">Daniel
Kulp</a>
    </h4>
        <br/>
                         <h4>Changes (1)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >            .put(&quot;javax.xml.ws.addressing.context&quot;,
maps); <br>{code} <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">{note}This
method can also be used to configure the namespace/version of the WS-Addressing headers, exact
message ID&#39;s, etc...{note} <br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h1><a name="WS-Addressing-WSAddressingviaXMLConfiguration%2FJavaAPI"></a>WS-Addressing
via XML Configuration/Java API</h1>

<p>CXF provides support for the 2004-08 and 1.0 versions of WS-Addressing. </p>

<p>To enable WS-Addressing you may enable the WSAddressingFeature on your service. If
you wish to use XML to configure this, you may use the following syntax:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
<span class="code-tag">&lt;jaxws:endpoint id=<span class="code-quote">"{your.service.namespace}YourPortName"</span>&gt;</span>
  <span class="code-tag">&lt;jaxws:features&gt;</span>
    <span class="code-tag">&lt;wsa:addressing <span class="code-keyword">xmlns:wsa</span>=<span
class="code-quote">"http://cxf.apache.org/ws/addressing"</span>/&gt;</span>
  <span class="code-tag">&lt;/jaxws:features&gt;</span>
<span class="code-tag">&lt;/jaxws:endpoint&gt;</span>
</pre>
</div></div>
<p>You can also use the same exact syntax with a &lt;jaxws:client&gt;</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
<span class="code-tag">&lt;jaxws: client id=<span class="code-quote">"{your.service.namespace}YourPortName"</span>&gt;</span>
  <span class="code-tag">&lt;jaxws:features&gt;</span>
    <span class="code-tag">&lt;wsa:addressing <span class="code-keyword">xmlns:wsa</span>=<span
class="code-quote">"http://cxf.apache.org/ws/addressing"</span>/&gt;</span>
  <span class="code-tag">&lt;/jaxws:features&gt;</span>
<span class="code-tag">&lt;/jaxws:client&gt;</span>
</pre>
</div></div>
<p> From an API point of view this looks very similar:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
<span class="code-keyword">import</span> org.apache.cxf.jaxws.EndpointImpl;
<span class="code-keyword">import</span> org.apache.cxf.ws.addressing.WSAddressingFeature;

MyServiceImpl implementor =  <span class="code-keyword">new</span> MyServiceImpl()
EndpointImpl ep = (EndpointImpl) Endpoint.create(implementor);
ep.getFeatures().add(<span class="code-keyword">new</span> WSAddressingFeature());
ep.publish(<span class="code-quote">"http:<span class="code-comment">//some/address"</span>);</span>
</pre>
</div></div>
<p>You can also use it with the ClientProxyFactoryBeans and ServerFactoryBeans (and
their JAX-WS versions, namely JaxWsProxyFactoryBean and JaxWsServerFactoryBean):</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
<span class="code-keyword">import</span> org.apache.cxf.frontend.simple.ClientProxyFactoryBean;
<span class="code-keyword">import</span> org.apache.cxf.ws.addressing.WSAddressingFeature;

ClientProxyFactoryBean factory = <span class="code-keyword">new</span> ClientProxyFactoryBean();
factory.setServiceClass(MyService.class);
factory.setAddress(<span class="code-quote">"http:<span class="code-comment">//acme.come/some-service"</span>);
</span>factory.getFeatures().add(<span class="code-keyword">new</span> WSAddressingFeature());
MyService client = (MyService) factory.create();
</pre>
</div></div>

<h1><a name="WS-Addressing-EnablingWSAddressingwithWSPolicy"></a>Enabling
WS-Addressing with WS-Policy</h1>
<p>If you're using <a href="/confluence/display/CXF20DOC/WS-Policy" title="WS-Policy">WS&#45;Policy</a>,
CXF can automatically set up WS-Addressing for you if you use the &lt;Addressing&gt;
policy expression.</p>

<h1><a name="WS-Addressing-Decoupledresponses"></a>Decoupled responses</h1>
<p>By default, WS-Addressing using anonymous Reply-To addresses.   This means the request/response
patterns are synchronous in nature and the response is sent back via the normal reply channel.
  However, WS-Addressing allows for a decoupled endpoint to be used for receiving the response
and CXF will then correlate it with the appropriate request.  There are a few ways for configuring
the address on which CXF will listen for decoupled WS-Addressing responses.</p>

<h3><a name="WS-Addressing-HTTPConduitconfiguration"></a>HTTP Conduit configuration</h3>
<p>The HTTP Conduit's client configuration has an option for a DecoupledEndpoint address.
 If the conduit has this configured, all requests sent via that conduit that have WS-Addressing
enabled will have their responses sent to that endpoint:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
    <span class="code-tag">&lt;http:conduit name=<span class="code-quote">"{http://apache.org/hello_world_soap_http}SoapPort.http-conduit"</span>&gt;</span>
      <span class="code-tag">&lt;http:client DecoupledEndpoint=<span class="code-quote">"http://localhost:9090/decoupled_endpoint"</span>/&gt;</span>
    <span class="code-tag">&lt;/http:conduit&gt;</span>
</pre>
</div></div>

<h3><a name="WS-Addressing-RequestProperty"></a>Request Property</h3>
<p>The address can be set via a Request Context property.   </p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
((BindingProvider)proxy).getRequestContext()
    .put(<span class="code-quote">"org.apache.cxf.ws.addressing.replyto"</span>,
<span class="code-quote">"http:<span class="code-comment">//localhost:9090/decoupled_endpoint"</span>);</span>
</pre>
</div></div>

<h3><a name="WS-Addressing-AddressingProperties"></a>AddressingProperties</h3>
<p>The CXF org.apache.cxf.ws.addressing.impl.AddressingPropertiesImpl object can be
used to control many aspects of WS-Addressing including the Reply-To:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
        AddressingProperties maps = <span class="code-keyword">new</span> AddressingPropertiesImpl();
        EndpointReferenceType ref = <span class="code-keyword">new</span> EndpointReferenceType();
        AttributedURIType add = <span class="code-keyword">new</span> AttributedURIType();
        add.setValue(<span class="code-quote">"http:<span class="code-comment">//localhost:9090/decoupled_endpoint"</span>);
</span>        ref.setAddress(add);
        maps.setReplyTo(ref);
        maps.setFaultTo(ref);

        ((BindingProvider)port).getRequestContext()
            .put(<span class="code-quote">"javax.xml.ws.addressing.context"</span>,
maps);
</pre>
</div></div>
<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/warning.gif" width="16" height="16"
align="absmiddle" alt="" border="0"></td><td>This method can also be used to
configure the namespace/version of the WS-Addressing headers, exact message ID's, etc...</td></tr></table></div>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
        </div>
        <a href="https://cwiki.apache.org/confluence/display/CXF20DOC/WS-Addressing">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=53521&revisedVersion=6&originalVersion=5">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/CXF20DOC/WS-Addressing?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message