Author: dkulp
Date: Wed Jul 1 18:01:52 2015
New Revision: 956567
Log:
See what this would look like
Modified:
websites/production/cxf/content/faq.html
Modified: websites/production/cxf/content/faq.html
==============================================================================
--- websites/production/cxf/content/faq.html (original)
+++ websites/production/cxf/content/faq.html Wed Jul 1 18:01:52 2015
@@ -58,11 +58,11 @@ Apache CXF -- FAQ
<td id="cell-1-1"> </td>
<td id="cell-1-2">
<!-- Banner -->
-<div class="banner" id="banner"><div><table border="0" cellpadding="0"
cellspacing="0" width="100%"><tr><td align="left" colspan="1" nowrap>
+<div><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td
align="left" colspan="1" nowrap>
<a shape="rect" href="http://cxf.apache.org/" title="Apache CXF"><span
style="font-weight: bold; font-size: 170%; color: white">Apache CXF</span></a>
</td><td align="right" colspan="1" nowrap>
<a shape="rect" href="http://www.apache.org/" title="The Apache Software
Foundation"><img border="0" alt="ASF Logo"
src="http://cxf.apache.org/images/asf-logo.png"></a>
-</td></tr></table></div></div>
+</td></tr></table></div>
<!-- Banner -->
<div id="top-menu">
<table border="0" cellpadding="1" cellspacing="0" width="100%">
@@ -77,7 +77,7 @@ Apache CXF -- FAQ
<td>
<div align="right">
<!-- Quicklinks -->
-<div id="quicklinks"><p><a shape="rect" href="download.html">Download</a> | <a
shape="rect"
href="http://cxf.apache.org/docs/index.html">Documentation</a></p></div>
+<p><a shape="rect" href="download.html">Download</a> | <a shape="rect"
href="http://cxf.apache.org/docs/index.html">Documentation</a></p>
<!-- Quicklinks -->
</div>
</td>
@@ -99,7 +99,7 @@ Apache CXF -- FAQ
<div id="wrapper-menu-page-bottom">
<div id="menu-page">
<!-- NavigationBar -->
-<div id="navigation"><h3 id="Navigation-ApacheCXF"><a shape="rect"
href="index.html">Apache CXF</a></h3><ul class="alternate"><li><a shape="rect"
href="index.html">Home</a></li><li><a shape="rect"
href="download.html">Download</a></li><li><a shape="rect"
href="people.html">People</a></li><li><a shape="rect"
href="project-status.html">Project Status</a></li><li><a shape="rect"
href="roadmap.html">Roadmap</a></li><li><a shape="rect"
href="mailing-lists.html">Mailing Lists</a></li><li><a shape="rect"
class="external-link" href="http://issues.apache.org/jira/browse/CXF">Issue
Reporting</a></li><li><a shape="rect" href="special-thanks.html">Special
Thanks</a></li><li><a shape="rect" class="external-link"
href="http://www.apache.org/licenses/">License</a></li><li><a shape="rect"
href="security-advisories.html">Security Advisories</a></li></ul><h3
id="Navigation-Users">Users</h3><ul class="alternate"><li><a shape="rect"
href="http://cxf.apache.org/docs/index.html">User's Guide</a></li><li>
<a shape="rect" href="support.html">Support</a></li><li><a shape="rect"
href="faq.html">FAQ</a></li><li><a shape="rect"
href="resources-and-articles.html">Resources and Articles</a></li></ul><h3
id="Navigation-Search">Search</h3><form
enctype="application/x-www-form-urlencoded" method="get" id="cse-search-box"
action="http://www.google.com/cse"><div> <input type="hidden" name="cx"
value="002890367768291051730:o99qiwa09y4"> <input type="hidden" name="ie"
value="UTF-8"> <input type="text" name="q" size="21"> <input type="submit"
name="sa" value="Search"> </div> </form> <script type="text/javascript"
src="http://www.google.com/cse/brand?form=cse-search-box&lang=en"></script>
<h3 id="Navigation-Developers">Developers</h3><ul class="alternate"><li><a
shape="rect"
href="http://cxf.apache.org/docs/cxf-architecture.html">Architecture
Guide</a></li><li><a shape="rect" href="source-repository.html">Source
Repository</a></li><li><a shape="rect"
href="building.html">Building</a></li><li><a
shape="rect" href="automated-builds.html">Automated Builds</a></li><li><a
shape="rect" href="testing-debugging.html">Testing-Debugging</a></li><li><a
shape="rect" href="coding-guidelines.html">Coding Guidelines</a></li><li><a
shape="rect" href="getting-involved.html">Getting Involved</a></li><li><a
shape="rect" href="release-management.html">Release Management</a></li></ul><h3
id="Navigation-Subprojects">Subprojects</h3><ul class="alternate"><li><a
shape="rect" href="distributed-osgi.html">Distributed OSGi</a></li><li><a
shape="rect" href="xjc-utils.html">XJC Utils</a></li><li><a shape="rect"
href="build-utils.html">Build Utils</a></li><li><a shape="rect"
href="fediz.html">Fediz</a></li></ul><h3 id="Navigation-ASF"><a shape="rect"
class="external-link" href="http://www.apache.org">ASF</a></h3><ul
class="alternate"><li><a shape="rect" class="external-link"
href="http://www.apache.org/foundation/how-it-works.html">How Apache
Works</a></li><li><a shape="rect" class="external-link" href
="http://www.apache.org/foundation/">Foundation</a></li><li><a shape="rect"
class="external-link"
href="http://www.apache.org/foundation/sponsorship.html">Sponsor
Apache</a></li><li><a shape="rect" class="external-link"
href="http://www.apache.org/foundation/thanks.html">Thanks</a></li><li><a
shape="rect" class="external-link"
href="http://www.apache.org/security/">Security</a></li></ul></div>
+<h3 id="Navigation-ApacheCXF"><a shape="rect" href="index.html">Apache
CXF</a></h3><ul class="alternate"><li><a shape="rect"
href="index.html">Home</a></li><li><a shape="rect"
href="download.html">Download</a></li><li><a shape="rect"
href="people.html">People</a></li><li><a shape="rect"
href="project-status.html">Project Status</a></li><li><a shape="rect"
href="roadmap.html">Roadmap</a></li><li><a shape="rect"
href="mailing-lists.html">Mailing Lists</a></li><li><a shape="rect"
class="external-link" href="http://issues.apache.org/jira/browse/CXF">Issue
Reporting</a></li><li><a shape="rect" href="special-thanks.html">Special
Thanks</a></li><li><a shape="rect" class="external-link"
href="http://www.apache.org/licenses/">License</a></li><li><a shape="rect"
href="security-advisories.html">Security Advisories</a></li></ul><h3
id="Navigation-Users">Users</h3><ul class="alternate"><li><a shape="rect"
href="http://cxf.apache.org/docs/index.html">User's Guide</a></li><li><a
shape="rect" href=
"support.html">Support</a></li><li><a shape="rect"
href="faq.html">FAQ</a></li><li><a shape="rect"
href="resources-and-articles.html">Resources and Articles</a></li></ul><h3
id="Navigation-Search">Search</h3><form
enctype="application/x-www-form-urlencoded" method="get" id="cse-search-box"
action="http://www.google.com/cse"><div> <input type="hidden" name="cx"
value="002890367768291051730:o99qiwa09y4"> <input type="hidden" name="ie"
value="UTF-8"> <input type="text" name="q" size="21"> <input type="submit"
name="sa" value="Search"> </div> </form> <script type="text/javascript"
src="http://www.google.com/cse/brand?form=cse-search-box&lang=en"></script>
<h3 id="Navigation-Developers">Developers</h3><ul class="alternate"><li><a
shape="rect"
href="http://cxf.apache.org/docs/cxf-architecture.html">Architecture
Guide</a></li><li><a shape="rect" href="source-repository.html">Source
Repository</a></li><li><a shape="rect"
href="building.html">Building</a></li><li><a shape="rect" href="au
tomated-builds.html">Automated Builds</a></li><li><a shape="rect"
href="testing-debugging.html">Testing-Debugging</a></li><li><a shape="rect"
href="coding-guidelines.html">Coding Guidelines</a></li><li><a shape="rect"
href="getting-involved.html">Getting Involved</a></li><li><a shape="rect"
href="release-management.html">Release Management</a></li></ul><h3
id="Navigation-Subprojects">Subprojects</h3><ul class="alternate"><li><a
shape="rect" href="distributed-osgi.html">Distributed OSGi</a></li><li><a
shape="rect" href="xjc-utils.html">XJC Utils</a></li><li><a shape="rect"
href="build-utils.html">Build Utils</a></li><li><a shape="rect"
href="fediz.html">Fediz</a></li></ul><h3 id="Navigation-ASF"><a shape="rect"
class="external-link" href="http://www.apache.org">ASF</a></h3><ul
class="alternate"><li><a shape="rect" class="external-link"
href="http://www.apache.org/foundation/how-it-works.html">How Apache
Works</a></li><li><a shape="rect" class="external-link"
href="http://www.apache.o
rg/foundation/">Foundation</a></li><li><a shape="rect" class="external-link"
href="http://www.apache.org/foundation/sponsorship.html">Sponsor
Apache</a></li><li><a shape="rect" class="external-link"
href="http://www.apache.org/foundation/thanks.html">Thanks</a></li><li><a
shape="rect" class="external-link"
href="http://www.apache.org/security/">Security</a></li></ul>
<!-- NavigationBar -->
</div>
</div>
@@ -109,9 +109,22 @@ Apache CXF -- FAQ
<td height="100%">
<!-- Content -->
<div class="wiki-content">
-<div id="ConfluenceContent"><h1 id="FAQ-FrequentlyAskedQuestions">Frequently
Asked Questions</h1><p></p><div class="toc-macro client-side-toc-macro"
data-headerelements="H2,H3,H4"></div><h2 id="FAQ-General">General</h2><h3
id="FAQ-CanCXFrunwithJDK1.8/Java8?">Can CXF run with JDK 1.8/Java
8?</h3><p>Most of CXF 3.0.0 can run with Java 8.  Building CXF cannot
currently be done with Java8 due to problems with various Maven plugins,
problems with JIBX, etc...   The tooling may require
a -Djavax.xml.accessExternalSchema=file  VM argument to allow JAXB to
process and parse schemas.   Many of the CXF tests fail for the same
reason.   We are hoping that with CXF 3.0.1, we can fix a majority of the
issues (JIBX issues are still outstanding) via updates to tests, new version of
JAXB, etc....</p><h3 id="FAQ-CanCXFrunwithJDK1.7/Java7?">Can CXF run with JDK
1.7/Java 7?</h3><p>Yes. CXF supports Java 7. Since Java 7 contains the 2.2.x
versions of both JAXB and JAX-WS A
PI jars, using CXF with Java 7 is much easier than with Java 6.</p><h3
id="FAQ-CanCXFrunwithJDK1.6?">Can CXF run with JDK 1.6?</h3><p>JDK 1.6
incorporates the JAXB reference implementation. However, it incorporates an old
version of the RI. CXF does not support this version. As of 1.6_04, this is
easy to deal with: you must put the versions of JAXB RI (the 'impl' and 'xjc'
jars) that we include with CXF in your classpath. As of this writing, these are
version 2.2.10.</p><div class="confluence-information-macro
confluence-information-macro-information"><span class="aui-icon aui-icon-small
aui-iconfont-info confluence-information-macro-icon"></span><div
class="confluence-information-macro-body"><p>The current plan is that CXF 3.1
will no longer support Java 6 and will require Java 7 or newer. Users are
strongly encouraged to start moving to Java 7.</p></div></div><p><span
style="color: rgb(0,0,0);font-size: 1.4em;line-height: 1.5625;">Can CXF run
with JDK 1.5?</span></p><p>Yes for CXF
2.6.x and older. Keep in mind though that Java 2 SE 5.0 with JDK 1.5 has
reached end of life (<a shape="rect" class="external-link"
href="http://www.oracle.com/technetwork/java/eol-135779.html"
rel="nofollow">EOL</a>). CXF 2.7.x no longer supports Java 5. In order to
upgrade to 2.7.x, you must be using Java 6 (or newer).</p><div
class="confluence-information-macro
confluence-information-macro-information"><span class="aui-icon aui-icon-small
aui-iconfont-info confluence-information-macro-icon"></span><div
class="confluence-information-macro-body"><p>There is one more planned release
for the 2.6.x series of CXF. After that, there are no more planned releases of
CXF that will support Java 5. Users are strongly encouraged to start moving to
Java 7 and to start migrating to newer versions of
CXF.</p></div></div><p> </p><h3
id="FAQ-CanCXFrunwithouttheSunreferenceSAAJimplementation?">Can CXF run without
the Sun reference SAAJ implementation?</h3><p>In many cases, CXF can run without
an SAAJ implementation. However, some features such as JAX-WS handlers and
WS-Security do require an SAAJ implementation. By default, CXF ships with the
Sun SAAJ implementation, but CXF also supports axis2-saaj version 1.4.1 as an
alternative. When using a Java6 JRE, CXF can also use the SAAJ implementation
built into Java.</p><h3
id="FAQ-AretherecommercialofferingsofCXFthatprovideservices,support,andadditionalfeatures?">Are
there commercial offerings of CXF that provide services, support, and
additional features?</h3><p>Several companies provide services, training,
documentation, support, etc... on top of CXF. Some of those companies also
produce products that are either based on Apache CXF or include Apache CXF. See
the <a shape="rect" href="commercial-cxf-offerings.html">Commercial CXF
Offerings</a> page for a list of companies and the services they
provide.</p><h3 id="FAQ-IsthereanApacheCXFcertificationprogram?">Is there an
Apache CXF certification program?</h3><p>No, but Oracl
e's <a shape="rect" class="external-link"
href="http://education.oracle.com/pls/web_prod-plq-dad/db_pages.getpage?page_id=41&p_exam_id=1Z0_862"
rel="nofollow">SCDJWS</a> certification covers the web services stack and
related areas. Note, that the popular SCJP certification is a prerequisite to
the SCDJWS. Also, check out the <a shape="rect" class="external-link"
href="http://www.coderanch.com/forums/f-80/java-Web-Services-SCDJWS"
rel="nofollow">SCDJWS Forum</a> at the Java Ranch for healthy discussions in
regards to the certification. Study notes can be found at <a shape="rect"
class="external-link" href="http://java.boot.by/scdjws5-guide/"
rel="nofollow">SCDJWS 5.0 Study Guide</a>, <a shape="rect"
class="external-link"
href="http://en.wikibooks.org/wiki/Sun_Certified_Web_Services_Developer_Certification"
rel="nofollow">WikiBooks</a> and <a shape="rect" class="external-link"
href="http://www.coderanch.com/how-to/content/Exam-Objectives-5.pdf"
rel="nofollow">Ivan A. Krizsan Stud
y Notes</a>. Java Ranch also provides and information <a shape="rect"
class="external-link" href="http://www.coderanch.com/how-to/java/ScdjwsLinks"
rel="nofollow">page</a> in regards to the certification.</p><h2
id="FAQ-JAX-WSRelated">JAX-WS Related</h2><h3
id="FAQ-Thepartsinmygeneratedwsdlhavenamesoftheform"arg0","arg1",...Whydon'ttheparts(andJavageneratedfromthem)usetheniceparameternamesItypedintotheinterfacedefinition?">The
parts in my generated wsdl have names of the form "arg0", "arg1", ... Why
don't the parts (and Java generated from them) use the nice parameter names I
typed into the interface definition?</h3><p><strong>Official answer:</strong>
The JAX-WS spec (specifically section 3.6.1) mandates that it be generated this
way. To customize the name, you have to use an @WebParam(name = "blah")
annotation to specify better names. (You can use @WebResult for the return
value, but you'll only see the results if you look at the
XML.)</p><p><strong>Reason:</st
rong> One of the mysteries of java is that abstract methods (and thus
interface methods) do NOT get their parameter names compiled into them even
with debug info. Thus, when the service model is built from an interface, there
is no way to determine the names that were using in the original code.</p><p>If
the service is built from a concrete class (instead of an interface) AND the
class was compiled with debug info, we can get the parameter names. The simple
frontend does this. However, this could cause potential problems. For example,
when you go from developement to production, you may turn off debug information
(remove -g from javac flags) and suddenly the application may break since the
generated wsdl (and thus expect soap messages) would change. Thus, the JAX-WS
spec writers went the safe route and mandate that you have to use the @WebParam
annotations to specify the more descriptive names.</p><h3
id="FAQ-HowcanIaddsoapheaderstotherequest/response?">How can I add soap headers
to
the request/response?</h3><p>There are several ways to do this depending on
how your project is written (code first or wsdl first) and requirements such as
portability.</p><ol><li>The "JAX-WS" standard way to do this is to write a SOAP
Handler that will add the headers to the SOAP message and register the handler
on the client/server. This is completely portable from jax-ws vendor to vendor,
but is also more difficult and can have performance implications. You have to
handle the conversion of the JAXB objects to XML yourself. It involves having
the entire soap message in a DOM which breaks streaming. Requires more memory.
etc... However, it doesn't require any changes to wsdl or SEI
interfaces.</li><li>JAX-WS standard "java first" way: if doing java first
development, you can just add an extra parameter to the method and annotate it
with @WebParam(header = true). If it's a response header, make it a Holder and
add the mode = Mode.OUT to @WebParam.</li><li>wsdl first way: you can ad
d elements to the message in the wsdl and then mark them as soap:headers in
the soap:binding section of the wsdl. The wsdl2java tool will generate the
@WebParam(header = true) annotations as above. With CXF, you can also put the
headers in their own message (not the same message as the request/response) and
mark them as headers in the soap:binding, but you will need to pass the -exsh
true flag to wsdl2java to get the paramters generated. This is not portable to
other jax-ws providers. Processing headers from other messages it optional in
the jaxws spec.</li><li>CXF proprietary way: In the context
(BindingProvider.getRequestContext() on client, WebServiceContext on server),
you can add a List<org.apache.cxf.headers.Header> with the key
Header.HEADER_LIST. The headers in the list are streamed at the appropriate
time to the wire according to the databinding object found in the Header
object. Like option 1, this doesn't require changes to wsdl or method
signatures. However, it's m
uch faster as it doesn't break streaming and the memory overhead is
less.</li></ol><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[List<Header> headers = new
ArrayList<Header>();
-Header dummyHeader = new Header(new QName("uri:org.apache.cxf",
"dummy"), "decapitated",
+<h1 id="FAQ-FrequentlyAskedQuestions">Frequently Asked Questions</h1><p><style
type="text/css">/*<![CDATA[*/
+div.rbtoc1435773593921 {padding: 0px;}
+div.rbtoc1435773593921 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1435773593921 li {margin-left: 0px;padding-left: 0px;}
+
+/*]]>*/</style></p><div class="toc-macro rbtoc1435773593921">
+<ul class="toc-indentation"><li><a shape="rect" href="#FAQ-General">General</a>
+<ul class="toc-indentation"><li><a shape="rect"
href="#FAQ-CanCXFrunwithJDK1.8/Java8?">Can CXF run with JDK 1.8/Java
8?</a></li><li><a shape="rect" href="#FAQ-CanCXFrunwithJDK1.7/Java7?">Can CXF
run with JDK 1.7/Java 7?</a></li><li><a shape="rect"
href="#FAQ-CanCXFrunwithJDK1.6?">Can CXF run with JDK 1.6?</a></li><li><a
shape="rect" href="#FAQ-CanCXFrunwithouttheSunreferenceSAAJimplementation?">Can
CXF run without the Sun reference SAAJ implementation?</a></li><li><a
shape="rect"
href="#FAQ-AretherecommercialofferingsofCXFthatprovideservices,support,andadditionalfeatures?">Are
there commercial offerings of CXF that provide services, support, and
additional features?</a></li><li><a shape="rect"
href="#FAQ-IsthereanApacheCXFcertificationprogram?">Is there an Apache CXF
certification program?</a></li></ul>
+</li><li><a shape="rect" href="#FAQ-JAX-WSRelated">JAX-WS Related</a>
+<ul class="toc-indentation"><li><a shape="rect"
href="#FAQ-Thepartsinmygeneratedwsdlhavenamesoftheform"arg0","arg1",...Whydon'ttheparts(andJavageneratedfromthem)usetheniceparameternamesItypedintotheinterfacedefinition?">The
parts in my generated wsdl have names of the form "arg0", "arg1", ... Why
don't the parts (and Java generated from them) use the nice parameter names I
typed into the interface definition?</a></li><li><a shape="rect"
href="#FAQ-HowcanIaddsoapheaderstotherequest/response?">How can I add soap
headers to the request/response?</a></li><li><a shape="rect"
href="#FAQ-HowcanIturnonschemavalidationforjaxwsendpoint?">How can I turn on
schema validation for jaxws endpoint?</a></li><li><a shape="rect"
href="#FAQ-AreJAX-WSclientproxiesthreadsafe?">Are JAX-WS client proxies thread
safe?</a></li><li><a shape="rect"
href="#FAQ-Thegeneratedwsdl(GETrequestonthe?wsdladdress)doesn'tcontainthemessages,types,portType,etc...WhatdidIdowrong?">The
generated wsdl (GET
request on the ?wsdl address) doesn't contain the messages, types, portType,
etc... What did I do wrong?</a></li></ul>
+</li><li><a shape="rect" href="#FAQ-SpringRelated">Spring Related</a>
+<ul class="toc-indentation"><li><a shape="rect"
href="#FAQ-WhenusingSpringAOPtoenablethingsliketransactionsandsecurity,thegeneratedWSDLisverymessedupwithwrongnamespaces,partnames,etc...">When
using Spring AOP to enable things like transactions and security, the
generated WSDL is very messed up with wrong namespaces, part names,
etc...</a></li></ul>
+</li></ul>
+</div><h2 id="FAQ-General">General</h2><h3
id="FAQ-CanCXFrunwithJDK1.8/Java8?">Can CXF run with JDK 1.8/Java
8?</h3><p>Most of CXF 3.0.0 can run with Java 8.  Building CXF cannot
currently be done with Java8 due to problems with various Maven plugins,
problems with JIBX, etc...   The tooling may require
a -Djavax.xml.accessExternalSchema=file  VM argument to allow JAXB to
process and parse schemas.   Many of the CXF tests fail for the same
reason.   We are hoping that with CXF 3.0.1, we can fix a majority of the
issues (JIBX issues are still outstanding) via updates to tests, new version of
JAXB, etc....</p><h3 id="FAQ-CanCXFrunwithJDK1.7/Java7?">Can CXF run with JDK
1.7/Java 7?</h3><p>Yes. CXF supports Java 7. Since Java 7 contains the 2.2.x
versions of both JAXB and JAX-WS API jars, using CXF with Java 7 is much easier
than with Java 6.</p><h3 id="FAQ-CanCXFrunwithJDK1.6?">Can CXF run with JDK
1.6?</h3><p>JDK 1.6 incorporates the JAXB reference implem
entation. However, it incorporates an old version of the RI. CXF does not
support this version. As of 1.6_04, this is easy to deal with: you must put the
versions of JAXB RI (the 'impl' and 'xjc' jars) that we include with CXF in
your classpath. As of this writing, these are version 2.2.10.</p><div
class="confluence-information-macro
confluence-information-macro-information"><span class="aui-icon aui-icon-small
aui-iconfont-info confluence-information-macro-icon"></span><div
class="confluence-information-macro-body"><p>The current plan is that CXF 3.1
will no longer support Java 6 and will require Java 7 or newer. Users are
strongly encouraged to start moving to Java 7.</p></div></div><p><span
style="color: rgb(0,0,0);font-size: 1.4em;line-height: 1.5625;">Can CXF run
with JDK 1.5?</span></p><p>Yes for CXF 2.6.x and older. Keep in mind though
that Java 2 SE 5.0 with JDK 1.5 has reached end of life (<a shape="rect"
class="external-link" href="http://www.oracle.com/technetwork/java/eo
l-135779.html" rel="nofollow">EOL</a>). CXF 2.7.x no longer supports Java 5.
In order to upgrade to 2.7.x, you must be using Java 6 (or newer).</p><div
class="confluence-information-macro
confluence-information-macro-information"><span class="aui-icon aui-icon-small
aui-iconfont-info confluence-information-macro-icon"></span><div
class="confluence-information-macro-body"><p>There is one more planned release
for the 2.6.x series of CXF. After that, there are no more planned releases of
CXF that will support Java 5. Users are strongly encouraged to start moving to
Java 7 and to start migrating to newer versions of
CXF.</p></div></div><p> </p><h3
id="FAQ-CanCXFrunwithouttheSunreferenceSAAJimplementation?">Can CXF run without
the Sun reference SAAJ implementation?</h3><p>In many cases, CXF can run
without an SAAJ implementation. However, some features such as JAX-WS handlers
and WS-Security do require an SAAJ implementation. By default, CXF ships with
the Sun SAAJ implementation, b
ut CXF also supports axis2-saaj version 1.4.1 as an alternative. When using a
Java6 JRE, CXF can also use the SAAJ implementation built into Java.</p><h3
id="FAQ-AretherecommercialofferingsofCXFthatprovideservices,support,andadditionalfeatures?">Are
there commercial offerings of CXF that provide services, support, and
additional features?</h3><p>Several companies provide services, training,
documentation, support, etc... on top of CXF. Some of those companies also
produce products that are either based on Apache CXF or include Apache CXF. See
the <a shape="rect" href="commercial-cxf-offerings.html">Commercial CXF
Offerings</a> page for a list of companies and the services they
provide.</p><h3 id="FAQ-IsthereanApacheCXFcertificationprogram?">Is there an
Apache CXF certification program?</h3><p>No, but Oracle's <a shape="rect"
class="external-link"
href="http://education.oracle.com/pls/web_prod-plq-dad/db_pages.getpage?page_id=41&p_exam_id=1Z0_862"
rel="nofollow">SCDJWS</a> certif
ication covers the web services stack and related areas. Note, that the
popular SCJP certification is a prerequisite to the SCDJWS. Also, check out the
<a shape="rect" class="external-link"
href="http://www.coderanch.com/forums/f-80/java-Web-Services-SCDJWS"
rel="nofollow">SCDJWS Forum</a> at the Java Ranch for healthy discussions in
regards to the certification. Study notes can be found at <a shape="rect"
class="external-link" href="http://java.boot.by/scdjws5-guide/"
rel="nofollow">SCDJWS 5.0 Study Guide</a>, <a shape="rect"
class="external-link"
href="http://en.wikibooks.org/wiki/Sun_Certified_Web_Services_Developer_Certification"
rel="nofollow">WikiBooks</a> and <a shape="rect" class="external-link"
href="http://www.coderanch.com/how-to/content/Exam-Objectives-5.pdf"
rel="nofollow">Ivan A. Krizsan Study Notes</a>. Java Ranch also provides and
information <a shape="rect" class="external-link"
href="http://www.coderanch.com/how-to/java/ScdjwsLinks" rel="nofollow">page</a>
in regar
ds to the certification.</p><h2 id="FAQ-JAX-WSRelated">JAX-WS Related</h2><h3
id="FAQ-Thepartsinmygeneratedwsdlhavenamesoftheform"arg0","arg1",...Whydon'ttheparts(andJavageneratedfromthem)usetheniceparameternamesItypedintotheinterfacedefinition?">The
parts in my generated wsdl have names of the form "arg0", "arg1", ... Why
don't the parts (and Java generated from them) use the nice parameter names I
typed into the interface definition?</h3><p><strong>Official answer:</strong>
The JAX-WS spec (specifically section 3.6.1) mandates that it be generated this
way. To customize the name, you have to use an @WebParam(name = "blah")
annotation to specify better names. (You can use @WebResult for the return
value, but you'll only see the results if you look at the
XML.)</p><p><strong>Reason:</strong> One of the mysteries of java is that
abstract methods (and thus interface methods) do NOT get their parameter names
compiled into them even with debug info. Thus, when the se
rvice model is built from an interface, there is no way to determine the names
that were using in the original code.</p><p>If the service is built from a
concrete class (instead of an interface) AND the class was compiled with debug
info, we can get the parameter names. The simple frontend does this. However,
this could cause potential problems. For example, when you go from developement
to production, you may turn off debug information (remove -g from javac flags)
and suddenly the application may break since the generated wsdl (and thus
expect soap messages) would change. Thus, the JAX-WS spec writers went the safe
route and mandate that you have to use the @WebParam annotations to specify the
more descriptive names.</p><h3
id="FAQ-HowcanIaddsoapheaderstotherequest/response?">How can I add soap headers
to the request/response?</h3><p>There are several ways to do this depending on
how your project is written (code first or wsdl first) and requirements such as
portability.</p><ol><li
>The "JAX-WS" standard way to do this is to write a SOAP Handler that will add
>the headers to the SOAP message and register the handler on the
>client/server. This is completely portable from jax-ws vendor to vendor, but
>is also more difficult and can have performance implications. You have to
>handle the conversion of the JAXB objects to XML yourself. It involves having
>the entire soap message in a DOM which breaks streaming. Requires more
>memory. etc... However, it doesn't require any changes to wsdl or SEI
>interfaces.</li><li>JAX-WS standard "java first" way: if doing java first
>development, you can just add an extra parameter to the method and annotate
>it with @WebParam(header = true). If it's a response header, make it a Holder
>and add the mode = Mode.OUT to @WebParam.</li><li>wsdl first way: you can add
>elements to the message in the wsdl and then mark them as soap:headers in the
>soap:binding section of the wsdl. The wsdl2java tool will generate the
>@WebParam(header = true) anno
tations as above. With CXF, you can also put the headers in their own message
(not the same message as the request/response) and mark them as headers in the
soap:binding, but you will need to pass the -exsh true flag to wsdl2java to get
the paramters generated. This is not portable to other jax-ws providers.
Processing headers from other messages it optional in the jaxws
spec.</li><li>CXF proprietary way: In the context
(BindingProvider.getRequestContext() on client, WebServiceContext on server),
you can add a List<org.apache.cxf.headers.Header> with the key
Header.HEADER_LIST. The headers in the list are streamed at the appropriate
time to the wire according to the databinding object found in the Header
object. Like option 1, this doesn't require changes to wsdl or method
signatures. However, it's much faster as it doesn't break streaming and the
memory overhead is less.</li></ol><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">List<Header> headers = new
ArrayList<Header>();
+Header dummyHeader = new Header(new QName("uri:org.apache.cxf", "dummy"),
"decapitated",
new JAXBDataBinding(String.class));
headers.add(dummyHeader);
@@ -120,45 +133,45 @@ context.getMessageContext().put(Header.H
//client side:
((BindingProvider)proxy).getRequestContext().put(Header.HEADER_LIST, headers);
-]]></script>
+</pre>
</div></div><h3 id="FAQ-HowcanIturnonschemavalidationforjaxwsendpoint?">How
can I turn on schema validation for jaxws endpoint?</h3><p>For the client
side</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[ <jaxws:client
name="{http://apache.org/hello_world_soap_http}SoapPort"
- createdFromAPI="true">
+<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"> <jaxws:client
name="{http://apache.org/hello_world_soap_http}SoapPort"
+ createdFromAPI="true">
<jaxws:properties>
- <entry key="schema-validation-enabled"
value="true" />
+ <entry key="schema-validation-enabled" value="true" />
</jaxws:properties>
</jaxws:client>
-]]></script>
+</pre>
</div></div><p>You may also do this programmatically:</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[((BindingProvider)port).getRequestContext().put("schema-validation-enabled",
"true");
-]]></script>
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">((BindingProvider)port).getRequestContext().put("schema-validation-enabled",
"true");
+</pre>
</div></div><p>For the server side</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[ <jaxws:endpoint
name="{http://apache.org/hello_world_soap_http}SoapPort"
- wsdlLocation="wsdl/hello_world.wsdl"
- createdFromAPI="true">
+<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"> <jaxws:endpoint
name="{http://apache.org/hello_world_soap_http}SoapPort"
+ wsdlLocation="wsdl/hello_world.wsdl"
+ createdFromAPI="true">
<jaxws:properties>
- <entry key="schema-validation-enabled"
value="true" />
+ <entry key="schema-validation-enabled" value="true" />
</jaxws:properties>
</jaxws:endpoint>
-]]></script>
+</pre>
</div></div><p>Starting with CXF 2.3 you have the additional option of using
the org.apache.cxf.annotations.SchemaValidation annotation.</p><h3
id="FAQ-AreJAX-WSclientproxiesthreadsafe?">Are JAX-WS client proxies thread
safe?</h3><p><strong>Official JAX-WS answer:</strong> No. According to the
JAX-WS spec, the client proxies are NOT thread safe. To write portable code,
you should treat them as non-thread safe and synchronize access or use a pool
of instances or similar.</p><p><strong>CXF answer:</strong> CXF proxies are
thread safe for MANY use cases. The exceptions are:</p><ul><li><p>Use of
((BindingProvider)proxy).getRequestContext() - per JAX-WS spec, the request
context is PER INSTANCE. Thus, anything set there will affect requests on other
threads. With CXF, you can do:</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[((BindingProvider)proxy).getRequestContext().put("thread.local.request.context",
"true");
-]]></script>
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">((BindingProvider)proxy).getRequestContext().put("thread.local.request.context",
"true");
+</pre>
</div></div><p>and future calls to getRequestContext() will use a thread local
request context. That allows the request context to be threadsafe. (Note: the
response context is always thread local in CXF)</p></li></ul><ul><li>Settings
on the conduit - if you use code or configuration to directly manipulate the
conduit (like to set TLS settings or similar), those are not thread safe. The
conduit is per-instance and thus those settings would be shared. Also, if you
use the FailoverFeature and LoadBalanceFeatures, the conduit is replaced on the
fly. Thus, settings set on the conduit could get lost before being used on the
setting thread.</li></ul><ul><li>Session support - if you turn on sessions
support (see jaxws spec), the session cookie is stored in the conduit. Thus, it
would fall into the above rules on conduit settings and thus be shared across
threads.</li></ul><ul><li>WS-Security tokens - If use WS-SecureConversation or
WS-Trust, the retrieved token is cached in the Endpoint/Pr
oxy to avoid the extra (and expensive) calls to the STS to obtain tokens.
Thus, multiple threads will share the token. If each thread has different
security credentials or requirements, you need to use separate proxy
instances.</li></ul><p>For the conduit issues, you COULD install a new
ConduitSelector that uses a thread local or similar. That's a bit complex
though.</p><p>For most "simple" use cases, you can use CXF proxies on multiple
threads. The above outlines the workarounds for the others.</p><h3
id="FAQ-Thegeneratedwsdl(GETrequestonthe?wsdladdress)doesn'tcontainthemessages,types,portType,etc...WhatdidIdowrong?">The
generated wsdl (GET request on the ?wsdl address) doesn't contain the
messages, types, portType, etc... What did I do wrong?</h3><p>Usually this
means the wsdl at that address contains the service and binding, but uses a
<wsdl:import> element to import another wsdl (usually at
?wsdl=MyService1.wsdl type address) that defines the types, messages, and
portType.
The cause of this is different targetNamespaces for the Service Interface
(mapped to the port type) and the service implementation (mapped to the
Service/Binding). By default, the targetNamespace is derived from the package
of each of those, so if they are in different packages, you will see this
issue. Also, if you define a targetNamespace attribute on the @WebService
annotation on one of them, but not the other, you will likely see this as well.
The easiest fix is to update the @WebService annotation on BOTH to have the
exact same targetNamespace defined.</p><h2 id="FAQ-SpringRelated">Spring
Related</h2><h3
id="FAQ-WhenusingSpringAOPtoenablethingsliketransactionsandsecurity,thegeneratedWSDLisverymessedupwithwrongnamespaces,partnames,etc...">When
using Spring AOP to enable things like transactions and security, the
generated WSDL is very messed up with wrong namespaces, part names,
etc...</h3><p><strong>Reason:</strong> When using Spring AOP, spring injects a
proxy to the bean int
o CXF instead of the actual bean. The Proxy does not have the annotations on
it (like the @WebService annotation) so we cannot query the information
directly from the object like we can in the non-AOP case. The "fix" is to also
specify the actual serviceClass of the object in the spring config:</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[<jaxws:server
- id="myService"
- serviceClass="my.package.MyServiceImpl"
- serviceBean="#myServiceImpl"
- address="/MyService" />
-]]></script>
+<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"><jaxws:server
+ id="myService"
+ serviceClass="my.package.MyServiceImpl"
+ serviceBean="#myServiceImpl"
+ address="/MyService" />
+</pre>
</div></div><p>or:</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[<jaxws:endpoint
- id="myService"
- implementorClass="my.package.MyServiceImpl"
- implementor="#myServiceImpl"
- address="/MyService" />
-]]></script>
-</div></div></div>
+<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"><jaxws:endpoint
+ id="myService"
+ implementorClass="my.package.MyServiceImpl"
+ implementor="#myServiceImpl"
+ address="/MyService" />
+</pre>
+</div></div>
</div>
<!-- Content -->
</td>