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 Tue, 28 Sep 2010 13:00:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1810/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?focusedCommentId=23339154#comment-23339154">WS-Addressing</a></h2>
        <h4>Page
        <b>comment added</b> by              <a href="https://cwiki.apache.org/confluence/display/~manten">Oliver
ten Hoevel</a>
    </h4>
    <br/>
    <div class="notificationGreySide">
       <p>It was hard for me to figure out how to be able to communicate via WS-Addressing
with a counterpart using 2004/08 NS. I got it working by an interceptor:</p>

<div class="code panel" style="border-style: solid;border-width: 1px;"><div class="codeHeader
panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;"><b>AddressingHeaderInterceptor.java</b></div><div
class="codeContent panelContent">
<pre class="code-java">
<span class="code-keyword">import</span> org.apache.commons.logging.Log;
<span class="code-keyword">import</span> org.apache.commons.logging.LogFactory;
<span class="code-keyword">import</span> org.apache.cxf.binding.soap.SoapMessage;
<span class="code-keyword">import</span> org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor;
<span class="code-keyword">import</span> org.apache.cxf.interceptor.Fault;
<span class="code-keyword">import</span> org.apache.cxf.message.Message;
<span class="code-keyword">import</span> org.apache.cxf.phase.Phase;
<span class="code-keyword">import</span> org.apache.cxf.ws.addressing.AddressingPropertiesImpl;
<span class="code-keyword">import</span> org.apache.cxf.ws.addressing.MAPAggregator;
<span class="code-keyword">import</span> org.apache.cxf.ws.addressing.soap.VersionTransformer;

/**
 * OCS uses the NS 2004/08 <span class="code-keyword">for</span> WSA, CXF internally
2005/08. With <span class="code-keyword">this</span> interceptor the out- and

 * ingoing messages are transformed that both parties can work with.
 * @author Oliver ten Hoevel
 *
 */
<span class="code-keyword">public</span> class AddressingHeaderInterceptor <span
class="code-keyword">extends</span> AbstractSoapInterceptor {

	<span class="code-keyword">private</span> <span class="code-keyword">static</span>
Log log = LogFactory.getLog(AddressingHeaderInterceptor.class);
	
	<span class="code-keyword">public</span> AddressingHeaderInterceptor() {
		<span class="code-keyword">super</span>(Phase.PRE_LOGICAL);
		addAfter(MAPAggregator.class.getName());
	}

	<span class="code-keyword">public</span> void handleMessage(SoapMessage message)
<span class="code-keyword">throws</span> Fault {
		<span class="code-keyword">try</span> {
			Message msg = message.getMessage();
			AddressingPropertiesImpl outMaps = (AddressingPropertiesImpl) msg.get(<span class="code-quote">"javax.xml.ws.addressing.context.outbound"</span>);
			outMaps.exposeAs(VersionTransformer.Names200408.WSA_NAMESPACE_NAME);
		} <span class="code-keyword">catch</span> (Throwable t) {
			log.error(t);
		}
	}

}
</pre>
</div></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?focusedCommentId=23339154#comment-23339154">View
Online</a>
              |
       <a id="reply-23339154" href="https://cwiki.apache.org/confluence/display/CXF20DOC/WS-Addressing?replyToComment=23339154#comment-23339154">Reply
To This</a>
           </div>

</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message