You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by bu...@apache.org on 2017/08/25 08:22:03 UTC

svn commit: r1017260 [15/40] - in /websites/production/camel/content: ./ cache/

Modified: websites/production/camel/content/cxf-proxy-example.html
==============================================================================
--- websites/production/camel/content/cxf-proxy-example.html (original)
+++ websites/production/camel/content/cxf-proxy-example.html Fri Aug 25 08:22:01 2017
@@ -36,17 +36,6 @@
     <![endif]-->
 
 
-  <link href='//camel.apache.org/styles/highlighter/styles/shCoreCamel.css' rel='stylesheet' type='text/css' />
-  <link href='//camel.apache.org/styles/highlighter/styles/shThemeCamel.css' rel='stylesheet' type='text/css' />
-  <script src='//camel.apache.org/styles/highlighter/scripts/shCore.js' type='text/javascript'></script>
-  <script src='//camel.apache.org/styles/highlighter/scripts/shBrushJava.js' type='text/javascript'></script>
-  <script src='//camel.apache.org/styles/highlighter/scripts/shBrushXml.js' type='text/javascript'></script>
-  <script src='//camel.apache.org/styles/highlighter/scripts/shBrushPlain.js' type='text/javascript'></script>
-  
-  <script type="text/javascript">
-  SyntaxHighlighter.defaults['toolbar'] = false;
-  SyntaxHighlighter.all();
-  </script>
 
     <title>
     Apache Camel: CXF Proxy Example
@@ -92,18 +81,16 @@
 There is a <code>README.txt</code> file with instructions how to run it.</p>
 
 <p>If you use Maven then you can easily run it from the command line using:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
+<plain-text-body>
 mvn camel:run
-]]></script>
-</div></div>
+</plain-text-body>
 
 <h3 id="CXFProxyExample-About">About</h3>
 
 <p>This example demonstrates how <a shape="rect" href="cxf.html">CXF</a> can be used to proxy a real web service. For this example we want Camel to validate and enrich the input message before it's sent to the actual web service. We do this to ensure the data is correct and to have Camel automatically add in any missing information. In real life you may wish to use a proxy in cases where clients are sending bad/faulty data to a web service, and it's costly/not possible to update and fix those clients.</p>
 
-<div class="confluence-information-macro confluence-information-macro-tip"><p class="title">Pure HTTP proxy</p><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div class="confluence-information-macro-body">
-<p>If you want a pure HTTP-based proxy then you can use <a shape="rect" href="jetty.html">Jetty</a> or <a shape="rect" href="servlet.html">Servlet</a> as the front end in Camel. Then delegate those incoming HTTP requests to the real web service.  This is for cases where you need a simple straight through proxy where the message should not be altered by Camel.  By using the <a shape="rect" href="cxf.html">CXF</a> component you get access to all the web service features Apache CXF provides, whereas <a shape="rect" href="jetty.html">Jetty</a> will provide just a pure HTTP proxy.</p></div></div>
+<parameter ac:name="title">Pure HTTP proxy</parameter><rich-text-body>
+<p>If you want a pure HTTP-based proxy then you can use <a shape="rect" href="jetty.html">Jetty</a> or <a shape="rect" href="servlet.html">Servlet</a> as the front end in Camel. Then delegate those incoming HTTP requests to the real web service.  This is for cases where you need a simple straight through proxy where the message should not be altered by Camel.  By using the <a shape="rect" href="cxf.html">CXF</a> component you get access to all the web service features Apache CXF provides, whereas <a shape="rect" href="jetty.html">Jetty</a> will provide just a pure HTTP proxy.</p></rich-text-body>
 
 <h3 id="CXFProxyExample-Implementation">Implementation</h3>
 
@@ -116,94 +103,13 @@ mvn camel:run
 <p>As you can see in the Camel route we use a <a shape="rect" href="cxf.html">CXF</a> consumer to proxy the web service. Then we route the message to the EnrichBean which validates and adds the missing information. Then we just use the <a shape="rect" href="http.html">HTTP</a> component to send the web service request to the real web service.<br clear="none">
 The reply from the real web service is then logged and used as a reply for the proxied web service as well.</p>
 
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
-&lt;beans xmlns=&quot;http://www.springframework.org/schema/beans&quot;
-       xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
-       xmlns:camel=&quot;http://camel.apache.org/schema/spring&quot;
-       xmlns:cxf=&quot;http://camel.apache.org/schema/cxf&quot;
-       xmlns:context=&quot;http://www.springframework.org/schema/context&quot;
-       xsi:schemaLocation=&quot;
-       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
-       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
-       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
-       http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd&quot;&gt;
-
-  &lt;!-- spring property placeholder, ignore resource not found as the file resource is for unit testing --&gt;
-  &lt;context:property-placeholder location=&quot;classpath:incident.properties,file:target/custom.properties&quot;
-                                ignore-resource-not-found=&quot;true&quot;/&gt;
-
-  &lt;!-- Use a bean to start and stop the real web service (is not Camel specific) --&gt;
-  &lt;!-- In a real use-case the real web service would be probably located on another server
-       but we simulate this in the same JVM --&gt;
-  &lt;bean id=&quot;realWebService&quot; class=&quot;org.apache.camel.example.cxf.proxy.RealWebServiceBean&quot;
-        init-method=&quot;start&quot; destroy-method=&quot;stop&quot;&gt;
-    &lt;!-- url of the real web service we have proxied --&gt;
-    &lt;property name=&quot;url&quot; value=&quot;http://localhost:${real.port}/real-webservice&quot;/&gt;
-  &lt;/bean&gt;
-
-  &lt;!-- bean that enriches the SOAP request --&gt;
-  &lt;bean id=&quot;enrichBean&quot; class=&quot;org.apache.camel.example.cxf.proxy.EnrichBean&quot;/&gt;
-
-  &lt;!-- this is the CXF web service we use as the front end --&gt;
-  &lt;cxf:cxfEndpoint id=&quot;reportIncident&quot;
-                   address=&quot;http://localhost:${proxy.port}/camel-example-cxf-proxy/webservices/incident&quot;
-                   endpointName=&quot;s:ReportIncidentEndpoint&quot;
-                   serviceName=&quot;s:ReportIncidentEndpointService&quot;
-                   wsdlURL=&quot;etc/report_incident.wsdl&quot;
-                   xmlns:s=&quot;http://reportincident.example.camel.apache.org&quot;/&gt;
-
-  &lt;!-- this is the Camel route which proxies the real web service and forwards SOAP requests to it --&gt;
-  &lt;camelContext xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
-
-    &lt;!-- property which contains port number --&gt;
-    &lt;propertyPlaceholder id=&quot;properties&quot; location=&quot;classpath:incident.properties,file:target/custom.properties&quot;/&gt;
-
-    &lt;endpoint id=&quot;callRealWebService&quot; uri=&quot;http://localhost:${real.port}/real-webservice?throwExceptionOnFailure=false&quot;/&gt;
-
-    &lt;route&gt;
-      &lt;!-- CXF consumer using MESSAGE format --&gt;
-      &lt;from uri=&quot;cxf:bean:reportIncident?dataFormat=MESSAGE&quot;/&gt;
-      &lt;!-- log input received --&gt;
-      &lt;to uri=&quot;log:input&quot;/&gt;
-      &lt;!-- enrich the input by ensure the incidentId parameter is set --&gt;
-      &lt;to uri=&quot;bean:enrichBean&quot;/&gt;
-      &lt;!-- Need to remove the http headers which could confuse the http endpoint --&gt;
-      &lt;removeHeaders pattern=&quot;CamelHttp*&quot;/&gt;
-      &lt;!-- send proxied request to real web service --&gt;
-      &lt;to ref=&quot;callRealWebService&quot;/&gt;
-      &lt;!-- log answer from real web service --&gt;
-      &lt;to uri=&quot;log:output&quot;/&gt;
-    &lt;/route&gt;
-
-  &lt;/camelContext&gt;
-
-&lt;/beans&gt;
-]]></script>
-</div></div>
+<plain-text-body>{snippet:id=e1|lang=xml|url=camel/trunk/examples/camel-example-cxf-proxy/src/main/resources/META-INF/spring/camel-config.xml}</plain-text-body>
 
 <h4 id="CXFProxyExample-Enrichbean">Enrich bean</h4>
 
 <p>The enrich bean is Java code which in our simple example will just set the incidentId parameter to the fixed value of 456. In your implementation you can of course do a lot more.</p>
 
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
-public class EnrichBean {
-
-    public Document enrich(Document doc) {
-        Node node = doc.getElementsByTagName(&quot;incidentId&quot;).item(0);
-        String incident = node.getTextContent();
-
-        // here we enrich the document by changing the incident id to another value
-        // you can of course do a lot more in your use-case
-        node.setTextContent(&quot;456&quot;);
-        System.out.println(&quot;Incident was &quot; + incident + &quot;, changed to 456&quot;);
-
-        return doc;
-    }
-}
-]]></script>
-</div></div>
+<plain-text-body>{snippet:id=e1|lang=java|url=camel/trunk/examples/camel-example-cxf-proxy/src/main/java/org/apache/camel/example/cxf/proxy/EnrichBean.java}</plain-text-body>
 
 <h3 id="CXFProxyExample-Runningtheexample">Running the example</h3>
 
@@ -217,11 +123,10 @@ You can also start the Camel application
 <h3 id="CXFProxyExample-Sampleoutput">Sample output</h3>
 
 <p>Here is a sample output from the console:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
+<plain-text-body>
 2010-09-26 12:20:46,974 [main           ] INFO  DefaultCamelContext            - Apache Camel 2.5-SNAPSHOT (CamelContext: camel-1) started in 0.858 seconds
 2010-09-26 12:20:55,685 [tp-1790017034-1] INFO  input                          - Exchange[ExchangePattern:InOut, BodyType:null, Body:
-&lt;soapenv:Envelope xmlns:soapenv=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot; xmlns:rep=&quot;http://reportincident.example.camel.apache.org&quot;&gt;
+&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:rep="http://reportincident.example.camel.apache.org"&gt;
    &lt;soapenv:Header/&gt;
    &lt;soapenv:Body&gt;
       &lt;rep:inputReportIncident&gt;
@@ -244,15 +149,14 @@ Invoked real web service: id=456 by Clau
 
 2010-09-26 12:20:55,997 [tp-1790017034-1] INFO  output                         - Exchange[ExchangePattern:InOut,
     BodyType:org.apache.camel.converter.stream.CachedOutputStream.WrappedInputStream, Body:
-&lt;soap:Envelope xmlns:soap=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&gt;
+&lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;
     &lt;soap:Body&gt;
-        &lt;ns2:outputReportIncident xmlns:ns2=&quot;http://reportincident.example.camel.apache.org&quot;&gt;
+        &lt;ns2:outputReportIncident xmlns:ns2="http://reportincident.example.camel.apache.org"&gt;
             &lt;code&gt;OK;456&lt;/code&gt;
         &lt;/ns2:outputReportIncident&gt;
     &lt;/soap:Body&gt;
 &lt;/soap:Envelope&gt;]
-]]></script>
-</div></div>
+</plain-text-body>
 
 <h3 id="CXFProxyExample-SeeAlso">See Also</h3>
 <ul class="alternate"><li><a shape="rect" href="examples.html">Examples</a></li><li><a shape="rect" href="cxf.html">CXF</a></li><li><a shape="rect" href="http.html">HTTP</a></li><li><a shape="rect" href="jetty.html">Jetty</a></li><li><a shape="rect" href="servlet.html">Servlet</a></li><li><a shape="rect" href="soap.html">SOAP</a></li></ul></div>