cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache CXF 2.0 Documentation: Developing a Consumer (page edited)
Date Thu, 01 Nov 2007 16:07:00 GMT
<html>
<head>
    <base href="http://cwiki.apache.org/confluence" />
    <style type="text/css">
    <!--
    body, p, td, table, tr, .bodytext, .stepfield {
	font-family: Verdana, arial, sans-serif;
	font-size: 11px;
	line-height: 16px;
	color: #000000;
	font-weight: normal;
}
#PageContent {
	text-align: left;
	background-color: #fff;
	padding: 0px;
	margin: 0px;
    padding-bottom:20px;
}
/*
** when this stylesheet is used for the Tiny MCE Wysiwyg editor's edit area, we can't
** use an id=PageContent or class=wiki-content, so we must
** set the body style to that used for PageContent, and p to that used for wiki-content.
*/

body {
	margin: 0px;
	padding: 0px;
	text-align: center;
    background-color: #f0f0f0;
}

@media print {

body {
    background-color: #fff;
}

}

.monospaceInput {
    font:12px monospace
}

.wiki-content p, .commentblock p {
    margin: 16px 0px 16px 0px;
    padding: 0px;
}

.wiki-content-preview {
    padding: 5px;
    border-left: 1px solid #3c78b5;
    border-right: 1px solid #3c78b5;
}

ul, ol {
    margin-top: 2px;
    margin-bottom: 2px;
    padding-top: 0px;
    padding-bottom: 0px;
}

pre {
    padding: 0px;
    margin-top: 5px;
    margin-left: 15px;
    margin-bottom: 5px;
    margin-right: 5px;
    text-align: left;
}

.helpheading {
    font-weight: bold;
    background-color: #D0D9BD;
        border-bottom: 1px solid #3c78b5;
        padding: 4px 4px 4px 4px;
        margin: 0px;
        margin-top: 10px;
}
.helpcontent {
        padding: 4px 4px 20px 4px;
    background-color: #f5f7f1;
}

.code {
 	border: 1px dashed #3c78b5;
    font-size: 11px;
	font-family: Courier;
    margin: 10px;
	line-height: 13px;
}

.focusedComment {
    background: #ffffce;
}

.commentBox, .focusedComment {
    padding: 10px;
    margin: 5px 0 5px 0;
    border: 1px #bbb solid;
}

.codeHeader {
    background-color: #f0f0f0;
 	border-bottom: 1px dashed #3c78b5;
    padding: 3px;
	text-align: center;
}

.codeContent {
    text-align: left;
    background-color: #f0f0f0;
    padding: 3px;
}

.preformatted {
 	border: 1px dashed #3c78b5;
    font-size: 11px;
	font-family: Courier;
    margin: 10px;
	line-height: 13px;
}

.preformattedHeader {
    background-color: #f0f0f0;
 	border-bottom: 1px dashed #3c78b5;
    padding: 3px;
	text-align: center;
}

.preformattedContent {
    background-color: #f0f0f0;
    padding: 3px;
}

.panel {
 	border: 1px dashed #3c78b5;
    margin: 10px;
    margin-top: 0px;
}

.panelHeader {
    background-color: #f0f0f0;
 	border-bottom: 1px dashed #3c78b5;
    padding: 3px;
	text-align: center;
}

.panelContent {
    background-color: #f0f0f0;
    padding: 5px;
}

.anonymousAlert {
    background-color: #f0f0f0;
 	border: 1px dashed red;
    font-size: 11px;
    padding: 10px 5px 10px 5px;
    margin: 4px;
	line-height: 13px;
}

.lockAlert {
    background-color: #f0f0f0;
    width: 50%;
 	border: 1px dashed red;
    font-size: 11px;
    padding: 10px 5px 10px 5px;
    margin: 4px;
	line-height: 13px;
}


.code-keyword {
  color: #000091;
  background-color: inherit;
}

.code-object {
  color: #910091;
  background-color: inherit;
}

.code-quote {
  color: #009100;
  background-color: inherit;
}

.code-comment {
  color: #808080;
  background-color: inherit;
}


.code-xml .code-keyword {
  color: inherit;
  font-weight: bold;
}

.code-tag {
  color: #000091;
  background-color: inherit;
}

.breadcrumbs {
    background-color: #f0f0f0;
 	border-color: #3c78b5;
	border-width: 1px 0px 1px 0px;
	border-style: solid;
    font-size: 11px;
    padding: 3px 0px 3px 0px;
}

.navmenu {
    border: 1px solid #ccc;
}

.menuheading {
    font-weight: bold;
    background-color: #f0f0f0;
 	border-bottom: 1px solid #3c78b5;
	padding: 4px 4px 2px 4px;
}

.menuitems {
	padding: 4px 4px 20px 4px;
}

.rightpanel {
    border-left: 1px solid #ccc;
    border-bottom: 1px solid #ccc;
}

#helpheading {
    text-align: left;
    font-weight: bold;
    background-color: #D0D9BD;
 	border-bottom: 1px solid #3c78b5;
	padding: 4px 4px 4px 4px;
	margin: 0px;
}
#helpcontent {
	padding: 4px 4px 4px 4px;
    background-color: #f5f7f1;
}
.helptab-unselected {
    font-weight: bold;
	padding: 5px;
    background-color: #f5f7f1;
}
.helptab-selected {
    font-weight: bold;
    background-color: #D0D9BD;
	padding: 5px;
}
.helptabs {
    margin: 0px;
    background-color: #f5f7f1;
	padding: 5px;
}
.infopanel-heading {
    font-weight: bold;
	padding: 4px 0px 2px 0px;
}

.pagebody {
}

.pageheader {
	padding: 5px 5px 5px 0px;
 	border-bottom: 1px solid #3c78b5;
}

.pagetitle {
	font-size: 22px;
	font-weight: bold;
	font-family: Arial, sans-serif;
	color: #003366;
}

.newpagetitle {
    color: #ccc !important;
}

.steptitle {
	font-size: 18px;
	font-weight: bold;
	font-family: Arial, sans-serif;
	color: #003366;
	margin-bottom: 7px;
}

.substeptitle {
    font-size: 12px;
    font-weight: bold;
    font-family: Arial, sans-serif;
    color: #003366;
    margin: 2px 4px 4px 4px;
    padding: 2px 4px 1px 4px;
}

.stepdesc {
    font-family: Verdana, arial, sans-serif;
	font-size: 11px;
	line-height: 16px;
	font-weight: normal;
    color: #666666;
    margin-top: 7px;
    margin-bottom: 7px;
}

.steplabel {
    font-weight: bold;
    margin-right: 4px;
    color: black;
    float: left;
    width: 15%;
    text-align: right;
}

.stepfield {
    background: #f0f0f0;
    padding: 5px;
}

.submitButtons{
    margin-top:5px;
    text-align:right;
}

.formtitle {
	font-size: 12px;
	font-weight: bold;
	font-family: Arial, sans-serif;
	color: #003366;
}

.sectionbottom {
    border-bottom: 1px solid #3c78b5;
}

.topRow {
    border-top: 2px solid #3c78b5;
}

.tabletitle {
	font-size: 14px;
	font-weight: bold;
	font-family: Arial, sans-serif;
    padding: 3px 0px 2px 0px;
    margin: 8px 4px 2px 0px;
	color: #003366;
	border-bottom: 2px solid #3c78b5;
}
.pagesubheading {
    color: #666666;
    font-size: 10px;
    padding: 0px 0px 5px 0px;
}

HR {
	color: 3c78b5;
	height: 1;
}

A:link, A:visited, A:active, A:hover {
	color: #003366;
}

h1 A:link, h1 A:visited, h1 A:active {
	text-decoration: none;
}

h1 A:hover {
    border-bottom: 1px dotted #003366;
}

.wiki-content > :first-child, .commentblock > :first-child {
    margin-top: 3px;
}

.logocell {
    padding: 10px;
}

input {
	font-family: verdana, geneva, arial, sans-serif;
	font-size: 11px;
	color: #000000;
}

textarea, textarea.editor {
	font-family: verdana, geneva, arial, sans-serif;
	font-size: 11px;
	color: #333333;
}

/* use logoSpaceLink instead.
.spacenametitle {
	font: 21px/31px Impact, Arial, Helvetica;
    font-weight: 100;
    color: #999999;
	margin: 0px;
}
.spacenametitle img {
  margin: 0 0 -4px 0;
}
.spacenametitle a {
    text-decoration: none;
    color: #999999;
}
.spacenametitle a:visited {
    text-decoration: none;
    color: #999999;
}*/

.spacenametitle-printable {
	font: 20px/25px Impact, Arial, Helvetica;
    font-weight: 100;
    color: #999999;
	margin: 0px;
}
.spacenametitle-printable a {
    text-decoration: none;
    color: #999999;
}
.spacenametitle-printable a:visited {
    text-decoration: none;
    color: #999999;
}

.blogDate {
	font-weight: bold;
	text-decoration: none;
	color: black;
}

.blogSurtitle {
    background: #f0f0f0;
 	border: 1px solid #ddd;
	padding: 3px;
	margin: 1px 1px 10px 1px;
}

.blogHeading {
    font-size: 20px;
    line-height: normal;
    font-weight: bold;
    padding: 0px;
    margin: 0px;
}

.blogHeading a {
   text-decoration: none;
   color: black;
}

.endsection {
	align: right;
	color: #666666;
	margin-top: 10px;
}
.endsectionleftnav {
	align: right;
	color: #666666;
	margin-top: 10px;
}

h1 {
	font-size: 24px;
	line-height: normal;
	font-weight: bold;
	background-color: #f0f0f0;
	color: #003366;
 	border-bottom: 1px solid #3c78b5;
	padding: 2px;
	margin: 36px 0px 4px 0px;
}

h2 {
	font-size: 18px;
	line-height: normal;
	font-weight: bold;
	background-color: #f0f0f0;
 	border-bottom: 1px solid #3c78b5;
	padding: 2px;
	margin: 27px 0px 4px 0px;
}

h3 {
	font-size: 14px;
	line-height: normal;
	font-weight: bold;
	background-color: #f0f0f0;
	padding: 2px;
	margin: 21px 0px 4px 0px;
}

h4 {
	font-size: 12px;
	line-height: normal;
	font-weight: bold;
	background-color: #f0f0f0;
	padding: 2px;
	margin: 18px 0px 4px 0px;
}

h4.search {
	font-size: 12px;
	line-height: normal;
	font-weight: normal;
	background-color: #f0f0f0;
	padding: 4px;
	margin: 18px 0px 4px 0px;
}

h5 {
	font-size: 10px;
	line-height: normal;
	font-weight: bold;
	background-color: #f0f0f0;
	padding: 2px;
	margin: 14px 0px 4px 0px;
}

h6 {
	font-size: 8px;
	line-height: normal;
	font-weight: bold;
	background-color: #f0f0f0;
	padding: 2px;
	margin: 14px 0px 4px 0px;
}

.smallfont {
    font-size: 10px;
}
.descfont {
    font-size: 10px;
    color: #666666;
}
.smallerfont {
    font-size: 9px;
}
.smalltext {
    color: #666666;
    font-size: 10px;
}
.smalltext a {
    color: #666666;
}
.smalltext-blue {
    color: #3c78b5;
    font-size: 10px;
}
.surtitle {
    margin-left: 1px;
    margin-bottom: 5px;
    font-size: 14px;
    color: #666666;
}

/* css hack found here:  http://www.fo3nix.pwp.blueyonder.co.uk/tutorials/css/hacks/ */
.navItemOver { font-size: 10px; font-weight: bold; color: #ffffff; background-color: #003366; cursor: hand; voice-family: '\'}\''; voice-family:inherit; cursor: pointer;}
.navItemOver a { color: #ffffff; background-color:#003366; text-decoration: none; }
.navItemOver a:visited { color: #ffffff; background-color:#003366; text-decoration: none; }
.navItemOver a:hover { color: #ffffff; background-color:#003366; text-decoration: none; }
.navItem { font-size: 10px; font-weight: bold; color: #ffffff; background-color: #3c78b5; }
.navItem a { color: #ffffff; text-decoration: none; }
.navItem a:hover { color: #ffffff; text-decoration: none; }
.navItem a:visited { color: #ffffff; text-decoration: none; }

div.padded { padding: 4px; }
div.thickPadded { padding: 10px; }
h3.macrolibrariestitle {
    margin: 0px 0px 0px 0px;
}

div.centered { text-align: center; margin: 10px; }
div.centered table {margin: 0px auto; text-align: left; }

.tableview table {
    margin: 0;
}

.tableview th {
    text-align: left;
    color: #003366;
    font-size: 12px;
    padding: 5px 0px 0px 5px;
    border-bottom: 2px solid #3c78b5;
}
.tableview td {
    text-align: left;
    border-color: #ccc;
    border-width: 0px 0px 1px 0px;
    border-style: solid;
    margin: 0;
    padding: 4px 10px 4px 5px;
}

.grid {
    margin: 2px 0px 5px 0px;
    border-collapse: collapse;
}
.grid th  {
    border: 1px solid #ccc;
    padding: 2px 4px 2px 4px;
    background: #f0f0f0;
    text-align: center;
}
.grid td  {
    border: 1px solid #ccc;
    padding: 3px 4px 3px 4px;
}
.gridHover {
	background-color: #f9f9f9;
}

td.infocell {
    background-color: #f0f0f0;
}
.label {
	font-weight: bold;
	color: #003366;
}

label {
	font-weight: bold;
	color: #003366;
}

.error {
	background-color: #fcc;
}

.errorBox {
	background-color: #fcc;
    border: 1px solid #c00;
    padding: 5px;
    margin: 5px;
}

.errorMessage {
	color: #c00;
}

.success {
	background-color: #dfd;
}

.successBox {
	background-color: #dfd;
    border: 1px solid #090;
    padding: 5px;
    margin-top:5px;
    margin-bottom:5px;
}

blockquote {
	padding-left: 10px;
	padding-right: 10px;
	margin-left: 5px;
	margin-right: 0px;
	border-left: 1px solid #3c78b5;
}

table.confluenceTable
{
    margin: 5px;
    border-collapse: collapse;
}

/* Added as a temporary fix for CONF-4223. The table elements appear to be inheriting the border: none attribute from the sectionMacro class */
table.confluenceTable td.confluenceTd
{
    border-width: 1px;
    border-style: solid;
    border-color: #ccc;
    padding: 3px 4px 3px 4px;
}

/* Added as a temporary fix for CONF-4223. The table elements appear to be inheriting the border: none attribute from the sectionMacro class */
table.confluenceTable th.confluenceTh
{
    border-width: 1px;
    border-style: solid;
    border-color: #ccc;
    padding: 3px 4px 3px 4px;
    background-color: #f0f0f0;
    text-align: center;
}

td.confluenceTd
{
    border-width: 1px;
    border-style: solid;
    border-color: #ccc;
    padding: 3px 4px 3px 4px;
}

th.confluenceTh
{
    border-width: 1px;
    border-style: solid;
    border-color: #ccc;
    padding: 3px 4px 3px 4px;
    background-color: #f0f0f0;
    text-align: center;
}

DIV.small {
	font-size: 9px;
}

H1.pagename {
	margin-top: 0px;
}

IMG.inline  {}

.loginform {
    margin: 5px;
    border: 1px solid #ccc;
}

/* The text how the "This is a preview" comment should be shown. */
.previewnote { text-align: center;
                font-size: 11px;
                    color: red; }

/* How the preview content should be shown */
.previewcontent { background: #E0E0E0; }

/* How the system messages should be shown (DisplayMessage.jsp) */
.messagecontent { background: #E0E0E0; }

/* How the "This page has been modified..." -comment should be shown. */
.conflictnote { }

.createlink {
    color: maroon;
}
a.createlink {
    color: maroon;
}
.templateparameter {
    font-size: 9px;
    color: darkblue;
}

.diffadded {
    background: #ddffdd;
    padding: 1px 1px 1px 4px;
	border-left: 4px solid darkgreen;
}
.diffdeleted {
    color: #999;
    background: #ffdddd;
    padding: 1px 1px 1px 4px;
	border-left: 4px solid darkred;
}
.diffnochange {
    padding: 1px 1px 1px 4px;
	border-left: 4px solid lightgrey;
}
.differror {
    background: brown;
}
.diff {
    font-family: lucida console, courier new, fixed-width;
	font-size: 12px;
	line-height: 14px;
}
.diffaddedchars {
    background-color:#99ff99;
    font-weight:bolder;
}
.diffremovedchars {
    background-color:#ff9999;
    text-decoration: line-through;
    font-weight:bolder;
}

.greybackground {
    background: #f0f0f0
}

.greybox {
 	border: 1px solid #ddd;
	padding: 3px;
	margin: 1px 1px 10px 1px;
}

.borderedGreyBox {
    border: 1px solid #cccccc;
    background-color: #f0f0f0;
    padding: 10px;
}

.greyboxfilled {
 	border: 1px solid #ddd;
    background: #f0f0f0;
    padding: 3px;
	margin: 1px 1px 10px 1px;
}

.navBackgroundBox {
    padding: 5px 5px 5px 5px;
    font-size: 22px;
	font-weight: bold;
	font-family: Arial, sans-serif;
	color: white;
    background: #3c78b5;
    text-decoration: none;
}

.previewBoxTop {
	background-color: #f0f0f0;
    border-width: 1px 1px 0px 1px;
    border-style: solid;
    border-color: #3c78b5;
    padding: 5px;
    margin: 5px 0px 0px 0px;
    text-align: center;
}
.previewContent {
    background-color: #fff;
 	border-color: #3c78b5;
	border-width: 0px 1px 0px 1px;
	border-style: solid;
	padding: 10px;
	margin: 0px;
}
.previewBoxBottom {
	background-color: #f0f0f0;
    border-width: 0px 1px 1px 1px;
    border-style: solid;
    border-color: #3c78b5;
    padding: 5px;
    margin: 0px 0px 5px 0px;
    text-align: center;
}

.functionbox {
    background-color: #f0f0f0;
 	border: 1px solid #3c78b5;
	padding: 3px;
	margin: 1px 1px 10px 1px;
}

.functionbox-greyborder {
    background-color: #f0f0f0;
 	border: 1px solid #ddd;
	padding: 3px;
	margin: 1px 1px 10px 1px;
}

.search-highlight {
    background-color: #ffffcc;
}

/* normal (white) background */
.rowNormal {
    background-color: #ffffff;
 }

/* alternate (pale yellow) background */
.rowAlternate {
    background-color: #f7f7f7;
}

/* used in the list attachments table */
.rowAlternateNoBottomColor {
    background-color: #f7f7f7;
}

.rowAlternateNoBottomNoColor {
}

.rowAlternateNoBottomColor td {
    border-bottom: 0px;
}

.rowAlternateNoBottomNoColor td {
    border-bottom: 0px;
}

/* row highlight (grey) background */
.rowHighlight {
    background-color: #f0f0f0;

}

TD.greenbar {FONT-SIZE: 2px; BACKGROUND: #00df00; BORDER: 1px solid #9c9c9c; PADDING: 0px; }
TD.redbar {FONT-SIZE: 2px; BACKGROUND: #df0000; BORDER: 1px solid #9c9c9c; PADDING: 0px; }
TD.darkredbar {FONT-SIZE: 2px; BACKGROUND: #af0000; BORDER: 1px solid #9c9c9c; PADDING: 0px; }

TR.testpassed {FONT-SIZE: 2px; BACKGROUND: #ddffdd; PADDING: 0px; }
TR.testfailed {FONT-SIZE: 2px; BACKGROUND: #ffdddd; PADDING: 0px; }

.toolbar  {
    margin: 0px;
    border-collapse: collapse;
}

.toolbar td  {
    border: 1px solid #ccc;
    padding: 2px 2px 2px 2px;
    color: #ccc;
}

td.noformatting {
    border-width: 0px;
    border-style: none;
    text-align: center;
	padding: 0px;
}

.commentblock {
    margin: 12px 0 12px 0;
}

/*
 * Divs displaying the license information, if necessary.
 */
.license-eval, .license-none, .license-nonprofit {
    border-top: 1px solid #bbbbbb;
    text-align: center;
    font-size: 10px;
    font-family: Verdana, Arial, Helvetica, sans-serif;
}

.license-eval, .license-none {
    background-color: #ffcccc;
}

.license-eval b, .license-none b {
    color: #990000
}

.license-nonprofit {
    background-color: #ffffff;
}

/*
 * The shadow at the bottom of the page between the main content and the
 * "powered by" section.
 */
.bottomshadow {
    height: 12px;
    background-image: url("$req.contextPath/images/border/border_bottom.gif");
    background-repeat: repeat-x;
}

/*
 * Styling of the operations box
 */
.navmenu .operations li, .navmenu .operations ul {
    list-style: none;
    margin-left: 0;
    padding-left: 0;
}

.navmenu .operations ul {
    margin-bottom: 9px;
}

.navmenu .label {
    font-weight: inherit;
}

/*
 * Styling of ops as a toolbar
 */
.toolbar div {
    display: none;
}

.toolbar .label {
    display: none;
}

.toolbar .operations {
    display: block;
}

.toolbar .operations ul {
    display: inline;
    list-style: none;
    margin-left: 10px;
    padding-left: 0;
}

.toolbar .operations li {
    list-style: none;
    display: inline;
}

/* list page navigational tabs */
#foldertab {
padding: 3px 0px 3px 8px;
margin-left: 0;
border-bottom: 1px solid #3c78b5;
font: bold 11px Verdana, sans-serif;
}

#foldertab li {
list-style: none;
margin: 0;
display: inline;
}

#foldertab li a {
padding: 3px 0.5em;
margin-left: 3px;
border: 1px solid #3c78b5;
border-bottom: none;
background: #3c78b5;
text-decoration: none;
}

#foldertab li a:link { color: #ffffff; }
#foldertab li a:visited { color: #ffffff; }

#foldertab li a:hover {
color: #ffffff;
background: #003366;
border-color: #003366;
}

#foldertab li a.current {
background: white;
border-bottom: 1px solid white;
color: black;
}

#foldertab li a.current:link { color: black; }
#foldertab li a.current:visited { color: black; }
#foldertab li a.current:hover {
background: white;
border-bottom: 1px solid white;
color: black;
}

/* alphabet list */
ul#squaretab {
margin-left: 0;
padding-left: 0;
white-space: nowrap;
font: bold 8px Verdana, sans-serif;
}

#squaretab li {
display: inline;
list-style-type: none;
}

#squaretab a {
padding: 2px 6px;
border: 1px solid #3c78b5;
}

#squaretab a:link, #squaretab a:visited {
color: #fff;
background-color: #3c78b5;
text-decoration: none;
}

#squaretab a:hover {
color: #ffffff;
background-color: #003366;
border-color: #003366;
text-decoration: none;
}

#squaretab li a#current {
background: white;
color: black;
}

.blogcalendar * {
    font-family:verdana, arial, sans-serif;
    font-size:x-small;
    font-weight:normal;
    line-height:140%;
    padding:2px;
}


table.blogcalendar {
    border: 1px solid #3c78b5;
}

.blogcalendar th.calendarhead, a.calendarhead {
    font-size:x-small;
    font-weight:bold;
    padding:2px;
    text-transform:uppercase;
    background-color: #3c78b5;
    color: #ffffff;
    letter-spacing: .3em;
    text-transform: uppercase;
}

.calendarhead:visited {color: white;}
.calendarhead:active {color: white;}
.calendarhead:hover {color: white;}

.blogcalendar th {
    font-size:x-small;
    font-weight:bold;
    padding:2px;
    background-color:#f0f0f0;
}

.blogcalendar td {
    font-size:x-small;
    font-weight:normal;
}

.searchGroup { padding: 0 0 10px 0; background: #f0f0f0; }
.searchGroupHeading { font-size: 10px; font-weight: bold; color: #ffffff; background-color: #3c78b5; padding: 2px 4px 1px 4px; }
.searchItem { padding: 1px 4px 1px 4px; }
.searchItemSelected { padding: 1px 4px 1px 4px; font-weight: bold; background: #ddd; }

/* permissions page styles */
.permissionHeading {
    border-bottom: #bbb; border-width: 0 0 1px 0; border-style: solid; font-size: 16px; text-align: left;
}
.permissionTab {
    border-width: 0 0 0 1px; border-style: solid; background: #3c78b5; color: #ffffff; font-size: 10px;
}
.permissionSuperTab {
    border-width: 0 0 0 1px; border-style: solid; background: #003366; color: #ffffff;
}
.permissionCell {
    border-left: #bbb; border-width: 0 0 0 1px; border-style: solid;
}

/* warning panel */
.warningPanel { background: #FFFFCE; border:#F0C000 1px solid; padding: 8px; margin: 10px; }
/* alert panel */
.alertPanel { background: #FFCCCC; border:#C00 1px solid; padding: 8px; margin: 10px; }
/* info panel */
.infoPanel { background: #D8E4F1; border:#3c78b5 1px solid; padding: 8px; margin: 10px; }

/* side menu highlighting (e.g. space content screen) */
.optionPadded { padding: 2px; }
.optionSelected { background-color: #ffffcc; padding: 2px; border: 1px solid #ddd; margin: -1px; }
.optionSelected a { font-weight: bold; text-decoration: none; color: black; }

/* information macros */
.noteMacro { border-style: solid; border-width: 1px; border-color: #F0C000; background-color: #FFFFCE; text-align:left; margin-top: 5px; margin-bottom: 5px}
.warningMacro { border-style: solid; border-width: 1px; border-color: #c00; background-color: #fcc; text-align:left; margin-top: 5px; margin-bottom: 5px}
.infoMacro { border-style: solid; border-width: 1px; border-color: #3c78b5; background-color: #D8E4F1; text-align:left; margin-top: 5px; margin-bottom: 5px}
.tipMacro { border-style: solid; border-width: 1px; border-color: #090; background-color: #dfd; text-align:left; margin-top: 5px; margin-bottom: 5px}
.informationMacroPadding { padding: 5px 0 0 5px; }

table.infoMacro td, table.warningMacro td, table.tipMacro td, table.noteMacro td, table.sectionMacro td {
    border: none;
}

table.sectionMacroWithBorder td.columnMacro { border-style: dashed; border-width: 1px; border-color: #cccccc;}

.pagecontent
{
    padding: 10px;
    text-align: left;
}

/* styles for links in the top bar */
.topBarDiv a:link {color: #ffffff;}
.topBarDiv a:visited {color: #ffffff;}
.topBarDiv a:active {color: #ffffff;}
.topBarDiv a:hover {color: #ffffff;}
.topBarDiv {color: #ffffff;}

.topBar {
    background-color: #003366;
}


/* styles for extended operations */
.greyLinks a:link {color: #666666; text-decoration:underline;}
.greyLinks a:visited {color: #666666; text-decoration:underline;}
.greyLinks a:active {color: #666666; text-decoration:underline;}
.greyLinks a:hover {color: #666666; text-decoration:underline;}
.greyLinks {color: #666666; display:block; padding: 10px}

.logoSpaceLink {color: #999999; text-decoration: none}
.logoSpaceLink a:link {color: #999999; text-decoration: none}
.logoSpaceLink a:visited {color: #999999; text-decoration: none}
.logoSpaceLink a:active {color: #999999; text-decoration: none}
.logoSpaceLink a:hover {color: #003366; text-decoration: none}

/* basic panel (basicpanel.vmd) style */
.basicPanelContainer {border: 1px solid #3c78b5; margin-top: 2px; margin-bottom: 8px; width: 100%}
.basicPanelTitle {padding: 5px; margin: 0px; background-color: #f0f0f0; color: black; font-weight: bold;}
.basicPanelBody {padding: 5px; margin: 0px}

.separatorLinks a:link {color: white}
.separatorLinks a:visited {color: white}
.separatorLinks a:active {color: white}

.greynavbar {background-color: #f0f0f0; border-top: 1px solid #3c78b5; margin-top: 2px}

div.headerField {
    float: left;
    width: auto;
    height: 100%;
}

.headerFloat {
    margin-left: auto;
    width: 50%;
}

.headerFloatLeft {
    float: left;
    margin-right: 20px;
    margin-bottom: 10px;
}

#headerRow {
    padding: 10px;
}

div.license-personal {
   background-color: #003366;
   color: #ffffff;
}

div.license-personal a {
   color: #ffffff;
}

.greyFormBox {
    border: 1px solid #cccccc;
    padding: 5px;
}

/* IE automatically adds a margin before and after form tags. Use this style to remove that */
.marginlessForm {
    margin: 0px;
}

.openPageHighlight {
    background-color: #ffffcc;
    padding: 2px;
    border: 1px solid #ddd;
}

.editPageInsertLinks, .editPageInsertLinks a
{
    color: #666666;
    font-weight: bold;
    font-size: 10px;
}

/* Style for label heatmap. */
.top10 a {
    font-weight: bold;
    font-size: 2em;
    color: #003366;
}
.top25 a {
    font-weight: bold;
    font-size: 1.6em;
    color: #003366;
}
.top50 a {
    font-size: 1.4em;
    color: #003366;
}
.top100 a {
    font-size: 1.2em;
    color: #003366;
}

.heatmap {
    list-style:none;
    width: 95%;
    margin: 0px auto;
}

.heatmap a {
    text-decoration:none;
}

.heatmap a:hover {
    text-decoration:underline;
}

.heatmap li {
    display: inline;
}

.minitab {
padding: 3px 0px 3px 8px;
margin-left: 0;
margin-top: 1px;
margin-bottom: 0px;
border-bottom: 1px solid #3c78b5;
font: bold 9px Verdana, sans-serif;
text-decoration: none;
float:none;
}
.selectedminitab {
padding: 3px 0.5em;
margin-left: 3px;
margin-top: 1px;
border: 1px solid #3c78b5;
background: white;
border-bottom: 1px solid white;
color: #000000;
text-decoration: none;
}
.unselectedminitab {
padding: 3px 0.5em;
margin-left: 3px;
margin-top: 1px;
border: 1px solid #3c78b5;
border-bottom: none;
background: #3c78b5;
color: #ffffff;
text-decoration: none;
}

a.unselectedminitab:hover {
color: #ffffff;
background: #003366;
border-color: #003366;
}

a.unselectedminitab:link { color: white; }
a.unselectedminitab:visited { color: white; }

a.selectedminitab:link { color: black; }
a.selectedminitab:visited { color: black; }

.linkerror { background-color: #fcc;}

a.labelOperationLink:link {text-decoration: underline}
a.labelOperationLink:active {text-decoration: underline}
a.labelOperationLink:visited {text-decoration: underline}
a.labelOperationLink:hover {text-decoration: underline}

a.newLabel:link {background-color: #ddffdd}
a.newLabel:active {background-color: #ddffdd}
a.newLabel:visited {background-color: #ddffdd}
a.newLabel:hover {background-color: #ddffdd}

ul.square {list-style-type: square}

.inline-control-link {
    background: #ffc;
    font-size: 9px;
    color: #666;
    padding: 2px;
    text-transform: uppercase;
    text-decoration: none;
}


.inline-control-link a:link {text-decoration: none}
.inline-control-link a:active {text-decoration: none}
.inline-control-link a:visited {text-decoration: none}
.inline-control-link a:hover {text-decoration: none}

.inline-control-link {
    background: #ffc;
    font-size: 9px;
    color: #666;
    padding: 2px;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
}

div.auto_complete {
    width: 350px;
    background: #fff;
}
div.auto_complete ul {
    border: 1px solid #888;
    margin: 0;
    padding: 0;
    width: 100%;
    list-style-type: none;
}
div.auto_complete ul li {
    margin: 0;
    padding: 3px;
}
div.auto_complete ul li.selected {
    background-color: #ffb;
}
div.auto_complete ul strong.highlight {
    color: #800;
    margin: 0;
    padding: 0;
}

/******* Edit Page Styles *******/
.toogleFormDiv{
    border:1px solid #A7A6AA;
    background-color:white;
    padding:5px;
    margin-top: 5px;
}

.toogleInfoDiv{
    border:1px solid #A7A6AA;
    background-color:white;
    display:none;
    padding:5px;
    margin-top: 10px;
}

.inputSection{
    margin-bottom:20px;
}

#editBox{
   border:1px solid lightgray;
   background-color:#F0F0F0;
}

/******* Left Navigation Theme Styles ********/
.leftnav li a {
    text-decoration:none;
    color:white;
    margin:0px;
    display:block;
    padding:2px;
    padding-left:5px;
    background-color: #3c78b5;
    border-top:1px solid #3c78b5;
}

.leftnav li a:active {color:white;}
.leftnav li a:visited {color:white;}
.leftnav li a:hover {background-color: #003366; color:white;}

/* Added by Shaun during i18n */
.replaced
{
    background-color: #33CC66;
}

.topPadding
{
    margin-top: 20px;
}

/* new form style */
.form-block {
    padding: 6px;
}
.form-error-block {
    padding: 6px;
    background: #fcc;
    border-top: #f0f0f0 1px solid;
    border-bottom: #f0f0f0 1px solid;
    margin-bottom: 6px;
    padding: 0 12px 0 12px;
}
.form-element-large {
    font-size: 16px;
    font-weight: bold;
    font-family: Arial, sans-serif;
    color: #003366;
}

.form-element-small {
    font-size: 12px;
    font-weight: bold;
    font-family: Arial, sans-serif;
    color: #003366;
}

.form-header {
    background: lightyellow;
    border-top: #f0f0f0 1px solid;
    border-bottom: #f0f0f0 1px solid;
    margin-bottom: 6px;
    padding: 0 12px 0 12px;
}
.form-header p, .form-block p, .form-error-block p {
    line-height: normal;
    margin: 12px 0 12px 0;
}
.form-example {
    color: #888;
    font-size: 11px;
}
.form-divider {
    border-bottom: #ccc 1px solid;
    margin-bottom: 6px;
}
.form-buttons {
    margin-top: 6px;
    border-top: #ccc 1px solid;
    border-bottom: #ccc 1px solid;
    background: #f0f0f0;
    padding: 10px;
    text-align: center;
}
.form-buttons input {
    width: 100px;
}
.form-block .error {
    padding: 6px;
    margin-bottom: 6px;
}
    -->
    </style>
</head>
<body>

<div id="PageContent">
<table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%"><tr>
<td valign="top" class="pagebody">

    <div class="pageheader">
        <span class="pagetitle">
            Page Edited :
            <a href="http://cwiki.apache.org/confluence/display/CXF20DOC">CXF20DOC</a> :
            <a href="http://cwiki.apache.org/confluence/display/CXF20DOC/Developing+a+Consumer">Developing a Consumer</a>
        </span>
    </div>

     <p>
        <a href="http://cwiki.apache.org/confluence/display/CXF20DOC/Developing+a+Consumer">Developing a Consumer</a>
        has been edited by             <a href="http://cwiki.apache.org/confluence/display/~tkurosaka">T Kuro Kurosaka</a>
            <span class="smallfont">(Oct 12, 2007)</span>.
     </p>
    
     <p>
                 <a href="http://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=27179&originalVersion=7&revisedVersion=8">(View changes)</a>
     </p>

    <span class="label">Content:</span><br/>
    <div class="greybox wiki-content"><h1><a name="DevelopingaConsumer-DevelopingaConsumerwithCXF"></a>Developing a Consumer with CXF</h1>
<h2><a name="DevelopingaConsumer-GeneratingtheStubCode"></a>Generating the Stub Code</h2>
<p>The starting point for developing a service consumer (or client) in CXF is a WSDL contract, complete with port type, binding, and service definitions. You can then use the <span class="nobr"><a href="http://cwiki.apache.org/CXF20DOC/wsdl-to-java.html" title="Visit page outside Confluence" rel="nofollow">wsdl2java<sup><img class="rendericon" src="/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"/></sup></a></span> utility to generate the Java stub code from the WSDL contract. The stub code provides the supporting code that is required to invoke operations on the remote service.<br/>
For CXF clients, the wsdl2java utility can generate the following kinds of code:</p>
<ul>
	<li>Stub code - supporting files for implementing a CXF client.</li>
	<li>Client starting point code - sample client code that connects to the remote service and invokes every operation on the remote service.</li>
	<li>Ant build file - a <tt>build.xml</tt> file intended for use with the ant build utility. It has targets for building and for running the sample client application.</li>
</ul>


<h4><a name="DevelopingaConsumer-BasicHelloWorldWSDLcontract"></a>Basic HelloWorld WSDL contract</h4>

<p><a href="#DevelopingaConsumer-Example1" title="Example1 on Developing a Consumer">Example1</a> shows the HelloWorld WSDL contract. This contract defines a single port type, <tt>Greeter</tt>, with a SOAP binding, <tt>Greeter_SOAPBinding</tt>, and a service, <tt>SOAPService</tt>, which has a single port, <tt>SoapPort</tt>.</p>

<p><a name="DevelopingaConsumer-Example1"></a><div class="code"><div class="codeHeader"><b>Example 1:HelloWorld WSDL Contract</b></div><div class="codeContent">
<pre class="code-java">&lt;?xml version=<span class="code-quote">"1.0"</span> encoding=<span class="code-quote">"UTF-8"</span>?&gt;
&lt;wsdl:definitions name=<span class="code-quote">"HelloWorld"</span> targetNamespace=<span class="code-quote">"http:<span class="code-comment">//apache.org/hello_world_soap_http"</span> 
</span>    xmlns=<span class="code-quote">"http:<span class="code-comment">//schemas.xmlsoap.org/wsdl/"</span> 
</span>    xmlns:soap=<span class="code-quote">"http:<span class="code-comment">//schemas.xmlsoap.org/wsdl/soap/"</span> 
</span>    xmlns:tns=<span class="code-quote">"http:<span class="code-comment">//apache.org/hello_world_soap_http"</span>
</span>    xmlns:x1=<span class="code-quote">"http:<span class="code-comment">//apache.org/hello_world_soap_http/types"</span>
</span>    xmlns:wsdl=<span class="code-quote">"http:<span class="code-comment">//schemas.xmlsoap.org/wsdl/"</span> 
</span>    xmlns:xsd=<span class="code-quote">"http:<span class="code-comment">//www.w3.org/2001/XMLSchema"</span>&gt;
</span>    &lt;wsdl:types&gt;
        &lt;schema targetNamespace=<span class="code-quote">"http:<span class="code-comment">//apache.org/hello_world_soap_http/types"</span> 
</span>            xmlns=<span class="code-quote">"http:<span class="code-comment">//www.w3.org/2001/XMLSchema"</span>
</span>	    xmlns:tns=<span class="code-quote">"http:<span class="code-comment">//apache.org/hello_world_soap_http/types"</span>
</span>            elementFormDefault=<span class="code-quote">"qualified"</span>&gt;
	    &lt;simpleType name=<span class="code-quote">"MyStringType"</span>&gt;
		&lt;restriction base=<span class="code-quote">"string"</span>&gt;
		    &lt;maxLength value=<span class="code-quote">"30"</span> /&gt;
		&lt;/restriction&gt;
	    &lt;/simpleType&gt;

            &lt;element name=<span class="code-quote">"sayHi"</span>&gt;
                &lt;complexType/&gt;
            &lt;/element&gt;
            &lt;element name=<span class="code-quote">"sayHiResponse"</span>&gt;
                &lt;complexType&gt;
                    &lt;sequence&gt;
                        &lt;element name=<span class="code-quote">"responseType"</span> type=<span class="code-quote">"string"</span>/&gt;
                    &lt;/sequence&gt;
                &lt;/complexType&gt;
            &lt;/element&gt;
            &lt;element name=<span class="code-quote">"greetMe"</span>&gt;
                &lt;complexType&gt;
                    &lt;sequence&gt;
                        &lt;element name=<span class="code-quote">"requestType"</span> type=<span class="code-quote">"tns:MyStringType"</span>/&gt;
                    &lt;/sequence&gt;
                &lt;/complexType&gt;
            &lt;/element&gt;
            &lt;element name=<span class="code-quote">"greetMeResponse"</span>&gt;
                &lt;complexType&gt;
                    &lt;sequence&gt;
                        &lt;element name=<span class="code-quote">"responseType"</span> type=<span class="code-quote">"string"</span>/&gt;
                    &lt;/sequence&gt;
                &lt;/complexType&gt;
            &lt;/element&gt;
            &lt;element name=<span class="code-quote">"greetMeOneWay"</span>&gt;
                &lt;complexType&gt;
                    &lt;sequence&gt;
                        &lt;element name=<span class="code-quote">"requestType"</span> type=<span class="code-quote">"string"</span>/&gt;
                    &lt;/sequence&gt;
                &lt;/complexType&gt;
            &lt;/element&gt;
            &lt;element name=<span class="code-quote">"pingMe"</span>&gt;
                &lt;complexType/&gt;
            &lt;/element&gt;
            &lt;element name=<span class="code-quote">"pingMeResponse"</span>&gt;
                &lt;complexType/&gt;
            &lt;/element&gt;
            &lt;element name=<span class="code-quote">"faultDetail"</span>&gt;
                &lt;complexType&gt;
                    &lt;sequence&gt;
                        &lt;element name=<span class="code-quote">"minor"</span> type=<span class="code-quote">"<span class="code-object">short</span>"</span>/&gt;
                        &lt;element name=<span class="code-quote">"major"</span> type=<span class="code-quote">"<span class="code-object">short</span>"</span>/&gt;
                    &lt;/sequence&gt;
                &lt;/complexType&gt;
            &lt;/element&gt;
        &lt;/schema&gt;
    &lt;/wsdl:types&gt;
    &lt;wsdl:message name=<span class="code-quote">"sayHiRequest"</span>&gt;
        &lt;wsdl:part element=<span class="code-quote">"x1:sayHi"</span> name=<span class="code-quote">"in"</span>/&gt;
    &lt;/wsdl:message&gt;
    &lt;wsdl:message name=<span class="code-quote">"sayHiResponse"</span>&gt;
        &lt;wsdl:part element=<span class="code-quote">"x1:sayHiResponse"</span> name=<span class="code-quote">"out"</span>/&gt;
    &lt;/wsdl:message&gt;
    &lt;wsdl:message name=<span class="code-quote">"greetMeRequest"</span>&gt;
        &lt;wsdl:part element=<span class="code-quote">"x1:greetMe"</span> name=<span class="code-quote">"in"</span>/&gt;
    &lt;/wsdl:message&gt;
    &lt;wsdl:message name=<span class="code-quote">"greetMeResponse"</span>&gt;
        &lt;wsdl:part element=<span class="code-quote">"x1:greetMeResponse"</span> name=<span class="code-quote">"out"</span>/&gt;
    &lt;/wsdl:message&gt;
    &lt;wsdl:message name=<span class="code-quote">"greetMeOneWayRequest"</span>&gt;
        &lt;wsdl:part element=<span class="code-quote">"x1:greetMeOneWay"</span> name=<span class="code-quote">"in"</span>/&gt;
    &lt;/wsdl:message&gt;
    &lt;wsdl:message name=<span class="code-quote">"pingMeRequest"</span>&gt;
        &lt;wsdl:part name=<span class="code-quote">"in"</span> element=<span class="code-quote">"x1:pingMe"</span>/&gt;
    &lt;/wsdl:message&gt;
    &lt;wsdl:message name=<span class="code-quote">"pingMeResponse"</span>&gt;
        &lt;wsdl:part name=<span class="code-quote">"out"</span> element=<span class="code-quote">"x1:pingMeResponse"</span>/&gt;
    &lt;/wsdl:message&gt;		
    &lt;wsdl:message name=<span class="code-quote">"pingMeFault"</span>&gt;
        &lt;wsdl:part name=<span class="code-quote">"faultDetail"</span> element=<span class="code-quote">"x1:faultDetail"</span>/&gt;
    &lt;/wsdl:message&gt;
    
    &lt;wsdl:portType name=<span class="code-quote">"Greeter"</span>&gt;
        &lt;wsdl:operation name=<span class="code-quote">"sayHi"</span>&gt;
            &lt;wsdl:input message=<span class="code-quote">"tns:sayHiRequest"</span> name=<span class="code-quote">"sayHiRequest"</span>/&gt;
            &lt;wsdl:output message=<span class="code-quote">"tns:sayHiResponse"</span> name=<span class="code-quote">"sayHiResponse"</span>/&gt;
        &lt;/wsdl:operation&gt;
        
        &lt;wsdl:operation name=<span class="code-quote">"greetMe"</span>&gt;
            &lt;wsdl:input message=<span class="code-quote">"tns:greetMeRequest"</span> name=<span class="code-quote">"greetMeRequest"</span>/&gt;
            &lt;wsdl:output message=<span class="code-quote">"tns:greetMeResponse"</span> name=<span class="code-quote">"greetMeResponse"</span>/&gt;
        &lt;/wsdl:operation&gt;
        
        &lt;wsdl:operation name=<span class="code-quote">"greetMeOneWay"</span>&gt;
            &lt;wsdl:input message=<span class="code-quote">"tns:greetMeOneWayRequest"</span> name=<span class="code-quote">"greetMeOneWayRequest"</span>/&gt;
        &lt;/wsdl:operation&gt;

        &lt;wsdl:operation name=<span class="code-quote">"pingMe"</span>&gt;
            &lt;wsdl:input name=<span class="code-quote">"pingMeRequest"</span> message=<span class="code-quote">"tns:pingMeRequest"</span>/&gt;
            &lt;wsdl:output name=<span class="code-quote">"pingMeResponse"</span> message=<span class="code-quote">"tns:pingMeResponse"</span>/&gt;
            &lt;wsdl:fault name=<span class="code-quote">"pingMeFault"</span> message=<span class="code-quote">"tns:pingMeFault"</span>/&gt;
        &lt;/wsdl:operation&gt; 
    &lt;/wsdl:portType&gt;
    &lt;wsdl:binding name=<span class="code-quote">"Greeter_SOAPBinding"</span> type=<span class="code-quote">"tns:Greeter"</span>&gt;
        &lt;soap:binding style=<span class="code-quote">"document"</span> transport=<span class="code-quote">"http:<span class="code-comment">//schemas.xmlsoap.org/soap/http"</span>/&gt;
</span>        
        &lt;wsdl:operation name=<span class="code-quote">"sayHi"</span>&gt;
            &lt;soap:operation soapAction=<span class="code-quote">"" style="</span>document"/&gt;
            &lt;wsdl:input name=<span class="code-quote">"sayHiRequest"</span>&gt;
                &lt;soap:body use=<span class="code-quote">"literal"</span>/&gt;
            &lt;/wsdl:input&gt;
            &lt;wsdl:output name=<span class="code-quote">"sayHiResponse"</span>&gt;
                &lt;soap:body use=<span class="code-quote">"literal"</span>/&gt;
            &lt;/wsdl:output&gt;
        &lt;/wsdl:operation&gt;
        
        &lt;wsdl:operation name=<span class="code-quote">"greetMe"</span>&gt;
            &lt;soap:operation soapAction=<span class="code-quote">"" style="</span>document"/&gt;
            &lt;wsdl:input name=<span class="code-quote">"greetMeRequest"</span>&gt;
                &lt;soap:body use=<span class="code-quote">"literal"</span>/&gt;
            &lt;/wsdl:input&gt;
            &lt;wsdl:output name=<span class="code-quote">"greetMeResponse"</span>&gt;
                &lt;soap:body use=<span class="code-quote">"literal"</span>/&gt;
            &lt;/wsdl:output&gt;
        &lt;/wsdl:operation&gt;
        
        &lt;wsdl:operation name=<span class="code-quote">"greetMeOneWay"</span>&gt;
            &lt;soap:operation soapAction=<span class="code-quote">"" style="</span>document"/&gt;
            &lt;wsdl:input name=<span class="code-quote">"greetMeOneWayRequest"</span>&gt;
                &lt;soap:body use=<span class="code-quote">"literal"</span>/&gt;
            &lt;/wsdl:input&gt;
        &lt;/wsdl:operation&gt;

        &lt;wsdl:operation name=<span class="code-quote">"pingMe"</span>&gt;
            &lt;soap:operation style=<span class="code-quote">"document"</span>/&gt;
            &lt;wsdl:input&gt;
                &lt;soap:body use=<span class="code-quote">"literal"</span>/&gt;
            &lt;/wsdl:input&gt;
            &lt;wsdl:output&gt;
                &lt;soap:body use=<span class="code-quote">"literal"</span>/&gt;
            &lt;/wsdl:output&gt;
            &lt;wsdl:fault name=<span class="code-quote">"pingMeFault"</span>&gt;
                &lt;soap:fault name=<span class="code-quote">"pingMeFault"</span> use=<span class="code-quote">"literal"</span>/&gt;
            &lt;/wsdl:fault&gt;
        &lt;/wsdl:operation&gt;
        
    &lt;/wsdl:binding&gt;
    &lt;wsdl:service name=<span class="code-quote">"SOAPService"</span>&gt;
        &lt;wsdl:port binding=<span class="code-quote">"tns:Greeter_SOAPBinding"</span> name=<span class="code-quote">"SoapPort"</span>&gt;
            &lt;soap:address location=<span class="code-quote">"http:<span class="code-comment">//localhost:9000/SoapContext/SoapPort"</span>/&gt;
</span>        &lt;/wsdl:port&gt;
    &lt;/wsdl:service&gt;
&lt;/wsdl:definitions&gt;</pre>
</div></div></p>

<p>The <tt>Greeter</tt> port type from <a href="#DevelopingaConsumer-Example1" title="Example1 on Developing a Consumer">Example1</a> defines the following WSDL operations:</p>
<ul>
	<li><tt>sayHi</tt> - has a single output parameter, of <tt>xsd:string</tt>.</li>
	<li><tt>greetMe</tt> - has an input parameter, of <tt>xsd:string</tt>, and an output parameter, of <tt>xsd:string</tt>.</li>
	<li><tt>greetMeOneWay</tt> - has a single input parameter, of <tt>xsd:string</tt>. Because this operation has no output parameters, CXF can optimize this call to be a oneway invocation (that is, the client does not wait for a response from the server).</li>
	<li><tt>pingMe</tt> - has no input parameters and no output parameters, but it can raise a fault exception.</li>
</ul>


<p><a href="#DevelopingaConsumer-Example1" title="Example1 on Developing a Consumer">Example1</a> also defines a binding, <tt>Greeter_SOAPBinding</tt>, for the SOAP protocol. In practice, the binding is normally generated<br/>
automatically - for example, by running either of the CXF wsdl2soap or wsdl2xml utilities. Likewise, the <tt>SOAPService</tt> service can be generated automatically by running the CXF wsdl2service utility.</p>

<h4><a name="DevelopingaConsumer-Generatingthestubcode"></a>Generating the stub code</h4>

<p>After defining the WSDL contract, you can generate client code using the CXF wsdl2java utility. Enter the following command at a command-line prompt:</p>

<div class="panel"><div class="panelContent">
<p><tt>wsdl2java -ant -client -d <em>ClientDir</em> hello_world.wsdl</tt></p>
</div></div>

<p>Where <em>ClientDir</em> is the location of a directory where you would like to put the generated files and<br/>
<tt>hello_world.wsdl</tt> is a file containing the contract shown in <a href="#DevelopingaConsumer-Example1" title="Example1 on Developing a Consumer">Example1</a>. The <tt>-ant</tt> option generates an ant <tt>build.xml</tt> file, for use with the ant build utility. The <tt>-client</tt> option generates starting point code for a client <tt>main()</tt> method.</p>

<p>The preceding wsdl2java command generates the following Java packages:</p>

<ul>
	<li><tt>org.apache.hello_world_soap_http</tt><br/>
This package name is generated from the <tt><span class="nobr"><a href="http://apache.org/hello_world_soap_http" title="Visit page outside Confluence" rel="nofollow">http://apache.org/hello_world_soap_http<sup><img class="rendericon" src="/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"/></sup></a></span></tt> target namespace. All of the WSDL entities defined in this target namespace (for example, the Greeter port type and the SOAPService service) map to Java classes in the corresponding Java package.</li>
	<li><tt>org.apache.hello_world_soap_http.types</tt><br/>
This package name is generated from the <tt><span class="nobr"><a href="http://apache.org/hello_world_soap_http/types" title="Visit page outside Confluence" rel="nofollow">http://apache.org/hello_world_soap_http/types<sup><img class="rendericon" src="/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"/></sup></a></span></tt> target namespace. All of the XML types defined in this target namespace (that is, everything defined in the <tt>wsdl:types</tt> element of the HelloWorld contract) map to Java classes in the corresponding Java package.</li>
</ul>


<p>The stub files generated by the wsdl2java command fall into the following categories:</p>

<ul>
	<li>Classes representing WSDL entities (in the <tt>org.apache.hello_world_soap_http</tt> package) - the following classes are generated to represent WSDL entities:
	<ul>
		<li><tt>Greeter</tt> is a Java interface that represents the Greeter WSDL port type. In JAX-WS terminology, this Java interface is a service endpoint interface.</li>
		<li><tt>SOAPService</tt> is a Java class that represents the SOAPService WSDL <tt>service</tt> element.</li>
		<li><tt>PingMeFault</tt> is a Java exception class (extending <tt>java.lang.Exception</tt>) that represents the pingMeFault WSDL <tt>fault</tt> element.</li>
	</ul>
	</li>
	<li>Classes representing XML types (in the <tt>org.apache.hello_world_soap_http.types</tt> package) - in the HelloWorld example, the only generated types are the various wrappers for the request and reply messages. Some of these data types are useful for the<br/>
asynchronous invocation model.</li>
</ul>


<h2><a name="DevelopingaConsumer-ImplementingaCXFClient"></a>Implementing a CXF Client</h2>

<p>This section describes how to write the code for a simple Java client, based on the WSDL contract from <a href="#DevelopingaConsumer-Example1" title="Example1 on Developing a Consumer">Example1</a>. To implement the client, you need to use the following stub classes:</p>

<ul>
	<li>Service class (that is, <tt>SOAPService</tt>).</li>
	<li>Service endpoint interface (that is, <tt>Greeter</tt>).</li>
</ul>


<h4><a name="DevelopingaConsumer-Generatedserviceclass"></a>Generated service class</h4>

<p><a href="#DevelopingaConsumer-Example2" title="Example2 on Developing a Consumer">Example2</a> shows the typical outline a generated service class, <tt>ServiceName</tt>, which extends the <tt>javax.xml.ws.Service</tt> base class.</p>

<p><a name="DevelopingaConsumer-Example2"></a><div class="code"><div class="codeHeader"><b>Example 2:Outline of a Generated Service Class</b></div><div class="codeContent">
<pre class="code-java"><span class="code-keyword">public</span> class ServiceName <span class="code-keyword">extends</span> javax.xml.ws.Service
{
  ...
  <span class="code-keyword">public</span> ServiceName(URL wsdlLocation, QName serviceName) { }
  
  <span class="code-keyword">public</span> ServiceName() { }

  <span class="code-keyword">public</span> Greeter getPortName() { }
  .
  .
  .
}</pre>
</div></div></p>

<p>The <tt>ServiceName</tt> class in <a href="#DevelopingaConsumer-Example2" title="Example2 on Developing a Consumer">Example2</a> defines the following methods:</p>
<ul>
	<li>Constructor methods - the following forms of constructor are defined:
	<ul>
		<li><tt><em>ServiceName</em>(URL <em>wsdlLocation</em>, QName <em>serviceName</em>)</tt> constructs a service object based on the data in the <em>serviceName</em> service in the WSDL contract that is obtainable from <em>wsdlLocation</em>.</li>
		<li><tt><em>ServiceName</em>()</tt> is the default constructor, which constructs a service object based on the service name and WSDL contract that were provided at the time the stub code was generated (for example, when running the CeltiXfire wsdl2java command). Using this constructor presupposes that the WSDL contract remains available at its original location.</li>
	</ul>
	</li>
	<li><tt>get_PortName_()</tt> methods - for every <em>PortName</em> port defined on the <em>ServiceName</em> service, CXF generates a corresponding <tt>get_PortName_()</tt> method in Java. Therefore, a <tt>wsdl:service</tt> element that defines multiple ports will generate a service class with multiple <tt>get_PortName_()</tt> methods.</li>
</ul>


<h4><a name="DevelopingaConsumer-Serviceendpointinterface"></a>Service endpoint interface</h4>

<p>For every port type defined in the original WSDL contract, you can generate a corresponding service endpoint interface in Java. A service endpoint interface is the Java mapping of a WSDL port type. Each operation defined in the original WSDL port type maps to a corresponding method in the service endpoint interface. The operation's parameters are mapped as follows:</p>
<ol>
	<li>The input parameters are mapped to method arguments.</li>
	<li>The first output parameter is mapped to a return value.</li>
	<li>If there is more than one output parameter, the second and subsequent output parameters map to method arguments (moreover, the values of these arguments must be passed using Holder types).</li>
</ol>


<p>For example, <a href="#DevelopingaConsumer-Example3" title="Example3 on Developing a Consumer">Example3</a> shows the Greeter service endpoint interface, which is generated from the Greeter port type defined in <a href="#DevelopingaConsumer-Example1" title="Example1 on Developing a Consumer">Example1</a>. For simplicity, <a href="#DevelopingaConsumer-Example3" title="Example3 on Developing a Consumer">Example3</a> omits the standard JAXB and JAX-WS annotations.</p>

<p><a name="DevelopingaConsumer-Example3"></a><div class="code"><div class="codeHeader"><b>Example 3:The Greeter Service Endpoint Interface</b></div><div class="codeContent">
<pre class="code-java">/* Generated by WSDLToJava <span class="code-object">Compiler</span>. */

<span class="code-keyword">package</span> org.objectweb.hello_world_soap_http;
  ...
<span class="code-keyword">public</span> <span class="code-keyword">interface</span> Greeter
{
  <span class="code-keyword">public</span> java.lang.<span class="code-object">String</span> sayHi();
  
  <span class="code-keyword">public</span> java.lang.<span class="code-object">String</span> greetMe(java.lang.<span class="code-object">String</span> requestType);

  <span class="code-keyword">public</span> void greetMeOneWay(java.lang.<span class="code-object">String</span> requestType);

  <span class="code-keyword">public</span> void pingMe() <span class="code-keyword">throws</span> PingMeFault;
}</pre>
</div></div></p>

<h4><a name="DevelopingaConsumer-Clientmainfunction"></a>Client main function</h4>
<p><a href="#DevelopingaConsumer-Example4" title="Example4 on Developing a Consumer">Example4</a> shows the Java code that implements the HelloWorld client. In summary, the client connects to the <tt>SoapPort</tt> port on the <tt>SOAPService</tt> service and then proceeds to invoke each of the operations supported by the <tt>Greeter</tt> port type.</p>

<p><a name="DevelopingaConsumer-Example4"></a><div class="code"><div class="codeHeader"><b>Example 4:Client Implementation Code</b></div><div class="codeContent">
<pre class="code-java"><span class="code-keyword">package</span> demo.hw.client;

<span class="code-keyword">import</span> java.io.File;
<span class="code-keyword">import</span> java.net.URL;
<span class="code-keyword">import</span> javax.xml.namespace.QName;
<span class="code-keyword">import</span> org.apache.hello_world_soap_http.Greeter;
<span class="code-keyword">import</span> org.apache.hello_world_soap_http.PingMeFault;
<span class="code-keyword">import</span> org.apche.hello_world_soap_http.SOAPService;

<span class="code-keyword">public</span> <span class="code-keyword">final</span> class Client {

  <span class="code-keyword">private</span> <span class="code-keyword">static</span> <span class="code-keyword">final</span> QName SERVICE_NAME = 
    <span class="code-keyword">new</span> QName(<span class="code-quote">"http:<span class="code-comment">//apache.org/hello_world_soap_http"</span>, <span class="code-quote">"SOAPService"</span>);
</span>
  <span class="code-keyword">private</span> Client()
  {
  }

  <span class="code-keyword">public</span> <span class="code-keyword">static</span> void main(<span class="code-object">String</span> args[]) <span class="code-keyword">throws</span> Exception
  {
    <span class="code-keyword">if</span> (args.length == 0)
    {
      <span class="code-object">System</span>.out.println(<span class="code-quote">"please specify wsdl"</span>);
      <span class="code-object">System</span>.exit(1);
    }

    URL wsdlURL;
    File wsdlFile = <span class="code-keyword">new</span> File(args[0]);
    <span class="code-keyword">if</span> (wsdlFile.exists())
    {
      wsdlURL = wsdlFile.toURL();
    }
    <span class="code-keyword">else</span>
    {
      wsdlURL = <span class="code-keyword">new</span> URL(args[0]);
    }

    <span class="code-object">System</span>.out.println(wsdlURL);
    SOAPService ss = <span class="code-keyword">new</span> SOAPService(wsdlURL, SERVICE_NAME);
    Greeter port = ss.getSoapPort();
    <span class="code-object">String</span> resp;

    <span class="code-object">System</span>.out.println(<span class="code-quote">"Invoking sayHi..."</span>);
    resp = port.sayHi();
    <span class="code-object">System</span>.out.println(<span class="code-quote">"Server responded with: "</span> + resp);
    <span class="code-object">System</span>.out.println();

    <span class="code-object">System</span>.out.println(<span class="code-quote">"Invoking greetMe..."</span>);
    resp = port.greetMe(<span class="code-object">System</span>.getProperty(<span class="code-quote">"user.name"</span>));
    <span class="code-object">System</span>.out.println(<span class="code-quote">"Server responded with: "</span> + resp);
    <span class="code-object">System</span>.out.println();

    <span class="code-object">System</span>.out.println(<span class="code-quote">"Invoking greetMeOneWay..."</span>);
    port.greetMeOneWay(<span class="code-object">System</span>.getProperty(<span class="code-quote">"user.name"</span>));
    <span class="code-object">System</span>.out.println(<span class="code-quote">"No response from server as method is OneWay"</span>);
    <span class="code-object">System</span>.out.println();

    <span class="code-keyword">try</span> {
      <span class="code-object">System</span>.out.println(<span class="code-quote">"Invoking pingMe, expecting exception..."</span>);
      port.pingMe();
    } <span class="code-keyword">catch</span> (PingMeFault ex) {
      <span class="code-object">System</span>.out.println(<span class="code-quote">"Expected exception: PingMeFault has occurred."</span>);
      <span class="code-object">System</span>.out.println(ex.toString());
    }
    <span class="code-object">System</span>.exit(0);
  }
}</pre>
</div></div><br/>
The <tt>Client.main()</tt> function from <a href="#DevelopingaConsumer-Example4" title="Example4 on Developing a Consumer">Example4</a> proceeds as follows:&lt;/para&gt;</p>
<ol>
	<li>The CXF runtime is implicitly initialized - that is, provided the CXF runtime classes are loaded. Hence, there is no need to call a special function in order to initialize CXF.</li>
	<li>The client expects a single string argument that gives the location of the WSDL contract for HelloWorld. The WSDL location is stored in <tt>wsdlURL</tt>.</li>
	<li>A new port object (which enables you to access the remote server endpoint) is created in two steps, as shown in the following code fragment:
<div class="code"><div class="codeContent">
<pre class="code-java">SOAPService ss = <span class="code-keyword">new</span> SOAPService(wsdlURL, SERVICE_NAME);
Greeter port = ss.getSoapPort();</pre>
</div></div>
<p>To create a new port object, you first create a service object (passing in the WSDL location and service name) and then call the appropriate <tt>get <em>PortName</em> ()</tt> method to obtain an instance of the particular port you need. In this case, the <tt>SOAPService</tt> service supports only the <tt>SoapPort</tt> port, which is of <tt>Greeter</tt> type.</p></li>
	<li>The client proceeds to call each of the methods supported by the <tt>Greeter</tt> service endpoint interface.</li>
	<li>In the case of the <tt>pingMe()</tt> operation, the example code shows how to catch the <tt>PingMeFault</tt> fault exception.</li>
</ol>


<h2><a name="DevelopingaConsumer-SettingConnectionPropertieswithContexts"></a>Setting Connection Properties with Contexts</h2>

<p>You can use JAX-WS contexts to customize the properties of a client proxy. In particular, contexts can be used to modify connection properties and to send data in protocol headers. For example, you could use contexts to add a SOAP header, either to a request message or to a response message. The following types of context are supported on the client side:</p>

<ul>
	<li><b>Request context</b> - on the client side, the request context enables you to set properties that affect outbound messages. Request context properties are applied to a specific port instance and, once set, the properties affect every subsequent operation invocation made on the port, until such time as a property is explicitly cleared. For example, you might use a request context  property to set a connection timeout or to initialize data for sending in a header.&lt;/para&gt;</li>
	<li><b>Response context</b> - on the client side, you can access the response context to read the property values set by the inbound message from the last operation invocation. Response context properties are reset after every operation invocation. For example, you might access a response context property to read header information received from the last inbound message.</li>
</ul>


<h4><a name="DevelopingaConsumer-Settingarequestcontext"></a>Setting a request context</h4>

<p>To set a particular request context property, <em>ContextPropertyName</em>, to the value, <em>PropertyValue</em>, use the code shown in <a href="#DevelopingaConsumer-Example4" title="Example4 on Developing a Consumer">Example4</a>.</p>

<p><a name="DevelopingaConsumer-Example4"></a><div class="code"><div class="codeHeader"><b>Example 4:Setting a Request Context Property on the Client Side</b></div><div class="codeContent">
<pre class="code-java"><span class="code-comment">// Set request context property.
</span>java.util.Map&lt;<span class="code-object">String</span>, <span class="code-object">Object</span>&gt; requestContext =
  ((javax.xml.ws.BindingProvider)port).getRequestContext();
requestContext.put(ContextPropertyName, PropertyValue);

<span class="code-comment">// Invoke an operation.
</span>port.SomeOperation();</pre>
</div></div></p>

<p>You have to cast the port object to <tt>javax.xml.ws.BindingProvider</tt> in order to access the request context. The request context itself is of type, <tt>java.util.Map&lt;String, Object&gt;</tt>, which is a hash map that has keys of <tt>String</tt> and values of arbitrary type. Use <tt>java.util.Map.put()</tt> to create a new entry in the hash map.</p>

<h4><a name="DevelopingaConsumer-Readingaresponsecontext"></a>Reading a response context</h4>
<p>To retrieve a particular response context property, <em>ContextPropertyName</em>, use the code shown in <a href="#DevelopingaConsumer-Example5" title="Example5 on Developing a Consumer">Example5</a>.</p>

<p><a name="DevelopingaConsumer-Example5"></a><div class="code"><div class="codeHeader"><b>Example 5:Reading a Response Context Property on the Client Side</b></div><div class="codeContent">
<pre class="code-java"><span class="code-comment">// Invoke an operation.
</span>port.SomeOperation();

<span class="code-comment">// Read response context property.
</span>java.util.Map&lt;<span class="code-object">String</span>, <span class="code-object">Object</span>&gt; responseContext =
  ((javax.xml.ws.BindingProvider)port).getResponseContext();
PropertyType propValue = (PropertyType) responseContext.get(ContextPropertyName);</pre>
</div></div><br/>
The response context is of type, <tt>java.util.Map&lt;String, Object&gt;</tt>, which is a hash map that has keys of type <tt>String</tt> and values of an arbitrary type. Use <tt>java.util.Map.get()</tt> to access an entry in the hash map of response context properties.</p>

<h4><a name="DevelopingaConsumer-Supportedcontexts"></a>Supported contexts</h4>
<p>CXF supports the following context properties:</p>

<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'>Context Property Name</th>
<th class='confluenceTh'>Context Property Type</th>
</tr>
<tr>
<td class='confluenceTd'><tt>org.apache.cxf.ws.addressing.JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES</tt></td>
<td class='confluenceTd'><tt>org.apache.cxf.ws.addressing.AddressingProperties</tt></td>
</tr>
</tbody></table>

<h2><a name="DevelopingaConsumer-AsynchronousInvocationModel"></a>Asynchronous Invocation Model</h2>
<p>In addition to the usual synchronous mode of invocation, CXF also supports two forms of asynchronous invocation, as follows:</p>
<ul>
	<li><b>Polling approach</b> - in this case, to invoke the remote operation, you call a special method that has no output parameters, but returns a <tt>javax.xml.ws.Response</tt> instance. The <tt>Response</tt> object (which inherits from the <tt>javax.util.concurrency.Future</tt> interface) can be polled to check whether or not a response message has arrived.</li>
	<li><b>Callback approach</b> - in this case, to invoke the remote operation, you call another special method that takes a reference to a callback object (of <tt>javax.xml.ws.AsyncHandler</tt> type) as one of its parameters. Whenever the response message arrives at the client, the CXF runtime calls back on the <tt>AsyncHandler</tt> object to give it the contents of the response message.</li>
</ul>


<p>Both of these asynchronous invocation approaches are described here and illustrated by code examples.</p>

<h4><a name="DevelopingaConsumer-Contractforasynchronousexample"></a>Contract for asynchronous example</h4>

<p><a href="#DevelopingaConsumer-Example6" title="Example6 on Developing a Consumer">Example6</a> shows the WSDL contract that is used for the asynchronous example. The contract defines a single port type, <tt>GreeterAsync</tt>, which contains a single operation, <tt>greetMeSometime</tt>.</p>

<p><a name="DevelopingaConsumer-Example6"></a><div class="code"><div class="codeHeader"><b>Example 6:HelloWorld WSDL Contract for Asynchronous Example</b></div><div class="codeContent">
<pre class="code-java">&lt;wsdl:definitions xmlns=<span class="code-quote">"http:<span class="code-comment">//schemas.xmlsoap.org/wsdl/"</span>
</span>                  xmlns:soap=<span class="code-quote">"http:<span class="code-comment">//schemas.xmlsoap.org/wsdl/soap/"</span>
</span>                  xmlns:tns=<span class="code-quote">"http:<span class="code-comment">//apache.org/hello_world_async_soap_http"</span>
</span>                  xmlns:x1=<span class="code-quote">"http:<span class="code-comment">//apache.org/hello_world_async_soap_http/types"</span>
</span>                  xmlns:wsdl=<span class="code-quote">"http:<span class="code-comment">//schemas.xmlsoap.org/wsdl/"</span>
</span>                  xmlns:xsd=<span class="code-quote">"http:<span class="code-comment">//www.w3.org/2001/XMLSchema"</span>
</span>                  targetNamespace=<span class="code-quote">"http:<span class="code-comment">//apache.org/hello_world_async_soap_http"</span>
</span>                  name=<span class="code-quote">"HelloWorld"</span>&gt;
    &lt;wsdl:types&gt;
        &lt;schema targetNamespace=<span class="code-quote">"http:<span class="code-comment">//apache.org/hello_world_async_soap_http/types"</span>
</span>                xmlns=<span class="code-quote">"http:<span class="code-comment">//www.w3.org/2001/XMLSchema"</span>
</span>                xmlns:x1=<span class="code-quote">"http:<span class="code-comment">//apache.org/hello_world_async_soap_http/types"</span>
</span>                elementFormDefault=<span class="code-quote">"qualified"</span>&gt;
            &lt;element name=<span class="code-quote">"greetMeSometime"</span>&gt;
                &lt;complexType&gt;
                    &lt;sequence&gt;
                        &lt;element name=<span class="code-quote">"requestType"</span> type=<span class="code-quote">"xsd:string"</span>/&gt;
                    &lt;/sequence&gt;
                &lt;/complexType&gt;
            &lt;/element&gt;
            &lt;element name=<span class="code-quote">"greetMeSometimeResponse"</span>&gt;
                &lt;complexType&gt;
                    &lt;sequence&gt;
                        &lt;element name=<span class="code-quote">"responseType"</span> type=<span class="code-quote">"xsd:string"</span>/&gt;
                    &lt;/sequence&gt;
                &lt;/complexType&gt;
            &lt;/element&gt;      
        &lt;/schema&gt;
    &lt;/wsdl:types&gt;
    &lt;wsdl:message name=<span class="code-quote">"greetMeSometimeRequest"</span>&gt;
        &lt;wsdl:part name=<span class="code-quote">"in"</span> element=<span class="code-quote">"x1:greetMeSometime"</span>/&gt;
    &lt;/wsdl:message&gt;
    &lt;wsdl:message name=<span class="code-quote">"greetMeSometimeResponse"</span>&gt;
        &lt;wsdl:part name=<span class="code-quote">"out"</span> element=<span class="code-quote">"x1:greetMeSometimeResponse"</span>/&gt;
    &lt;/wsdl:message&gt;
    &lt;wsdl:portType name=<span class="code-quote">"GreeterAsync"</span>&gt;
        &lt;wsdl:operation name=<span class="code-quote">"greetMeSometime"</span>&gt;
            &lt;wsdl:input name=<span class="code-quote">"greetMeSometimeRequest"</span> message=<span class="code-quote">"tns:greetMeSometimeRequest"</span>/&gt;
            &lt;wsdl:output name=<span class="code-quote">"greetMeSometimeResponse"</span> message=<span class="code-quote">"tns:greetMeSometimeResponse"</span>/&gt;
        &lt;/wsdl:operation&gt;
    &lt;/wsdl:portType&gt;
    &lt;wsdl:binding name=<span class="code-quote">"GreeterAsync_SOAPBinding"</span> type=<span class="code-quote">"tns:GreeterAsync"</span>&gt;
        &lt;soap:binding style=<span class="code-quote">"document"</span> transport=<span class="code-quote">"http:<span class="code-comment">//schemas.xmlsoap.org/soap/http"</span>/&gt;
</span>        &lt;wsdl:operation name=<span class="code-quote">"greetMeSometime"</span>&gt;
            &lt;soap:operation style=<span class="code-quote">"document"</span>/&gt;
            &lt;wsdl:input&gt;
                &lt;soap:body use=<span class="code-quote">"literal"</span>/&gt;
            &lt;/wsdl:input&gt;
            &lt;wsdl:output&gt;
                &lt;soap:body use=<span class="code-quote">"literal"</span>/&gt;
            &lt;/wsdl:output&gt;
        &lt;/wsdl:operation&gt;
    &lt;/wsdl:binding&gt;
    &lt;wsdl:service name=<span class="code-quote">"SOAPService"</span>&gt;
        &lt;wsdl:port name=<span class="code-quote">"SoapPort"</span> binding=<span class="code-quote">"tns:GreeterAsync_SOAPBinding"</span>&gt;
            &lt;soap:address location=<span class="code-quote">"http:<span class="code-comment">//localhost:9000/SoapContext/SoapPort"</span>/&gt;
</span>        &lt;/wsdl:port&gt;
    &lt;/wsdl:service&gt;
&lt;/wsdl:definitions&gt;</pre>
</div></div></p>

<h4><a name="DevelopingaConsumer-Generatingtheasynchronousstubcode"></a>Generating the asynchronous stub code</h4>

<p>The asynchronous style of invocation requires extra stub code (for example, dedicated asychronous methods defined on the service endpoint interface). This special stub code is not generated by default, however. To switch on the asynchronous feature and generate the requisite stub code, you must use the mapping customization feature from the WSDL 2.0 specification.</p>

<p>Customization enables you to modify the way the wsdl2java utility generates stub code. In particular, it enables you to modify the WSDL-to-Java mapping and to switch on certain features. Here, customization is used to switch on the asynchronous invocation feature. Customizations are specified using a binding declaration, which you define using a <tt>jaxws:bindings</tt> tag (where the jaxws prefix is tied to the <tt><span class="nobr"><a href="http://java.sun.com/xml/ns/jaxws" title="Visit page outside Confluence" rel="nofollow">http://java.sun.com/xml/ns/jaxws<sup><img class="rendericon" src="/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"/></sup></a></span></tt> namespace). There are two alternative ways of specifying a binding declaration:</p>

<ul>
	<li><b>External binding declaration</b> - the <tt>jaxws:bindings</tt> element is defined in a file separately from the WSDL contract. You specify the location of the binding declaration file to the wsdl2java utility when you generate the stub code.</li>
	<li><b>Embedded binding declaration</b> - you can also embed the <tt>jaxws:bindings</tt> element directly in a WSDL contract, treating it as a WSDL extension. In this case, the settings in <tt>jaxws:bindings</tt> apply only to the immediate parent element.</li>
</ul>


<p>This section considers only the first approach, the external binding declaration. The template for a binding declaration file that switches on asynchronous invocations is shown in <a href="#DevelopingaConsumer-Example7" title="Example7 on Developing a Consumer">Example7</a>.</p>

<p><a name="DevelopingaConsumer-Example7"></a><div class="code"><div class="codeHeader"><b>Example 7:Template for an Asynchronous Binding Declaration</b></div><div class="codeContent">
<pre class="code-java">&lt;bindings xmlns:xsd=<span class="code-quote">"http:<span class="code-comment">//www.w3.org/2001/XMLSchema"</span>
</span>          xmlns:wsdl=<span class="code-quote">"http:<span class="code-comment">//schemas.xmlsoap.org/wsdl/"</span>
</span>          wsdlLocation=<span class="code-quote">"@WSDL_LOCATION@/hello_world_async.wsdl"</span>
          xmlns=<span class="code-quote">"http:<span class="code-comment">//java.sun.com/xml/ns/jaxws"</span>&gt;
</span>  &lt;bindings node=<span class="code-quote">"wsdl:definitions"</span>&gt;
    &lt;enableAsyncMapping&gt;<span class="code-keyword">true</span>&lt;/enableAsyncMapping&gt;
  &lt;/bindings&gt;
&lt;/bindings&gt;</pre>
</div></div></p>

<p>&lt;para&gt;Where <em>AffectedWSDLContract</em> specifies the URL of the WSDL contract that is affected by this binding declaration. The <em>AffectedNode</em> is an XPath value that specifies which node (or nodes) from the WSDL contract are affected by this binding declaration. You can set <em>AffectedNode</em> to <tt>wsdl:definitions</tt>, if you want the entire WSDL contract to be affected. The {jaxws:enableAsyncMapping}} element is set to <tt>true</tt> to enable the asynchronous invocation feature.</p>

<p>For example, if you want to generate asynchronous methods only for the <tt>GreeterAsync</tt> port type, you could specify <tt>&lt;bindings node="wsdl:definitions/wsdl:portType<span class="error">&#91;@name='GreeterAsync'&#93;</span>"&gt;</tt> in the preceding binding declaration.</p>

<p>Assuming that the binding declaration is stored in a file, <tt>async_binding.xml</tt>, you can generate the requisite stub files with asynchronous support by entering the following wsdl2java command:</p>

<div class="panel"><div class="panelContent">
<p><tt>wsdl2java -ant -client -d ClientDir -b async_binding.xml hello_world.wsdl</tt></p>
</div></div>

<p>When you run the wsdl2java command, you specify the location of the binding declaration file using the -b option. After generating the stub code in this way, the <tt>GreeterAsync</tt> service endpoint interface (in the file <tt>GreeterAsync.java</tt>) is defined as shown in <a href="#DevelopingaConsumer-Example8" title="Example8 on Developing a Consumer">Example8</a>.</p>

<p><a name="DevelopingaConsumer-Example8"></a><div class="code"><div class="codeHeader"><b>Example 8:Service Endpoint Interface with Methods for Asynchronous Invocations</b></div><div class="codeContent">
<pre class="code-java">/* Generated by WSDLToJava <span class="code-object">Compiler</span>. */
<span class="code-keyword">package</span> org.apache.hello_world_async_soap_http;
...
<span class="code-keyword">import</span> java.util.concurrent.Future;
<span class="code-keyword">import</span> javax.xml.ws.AsyncHandler;
<span class="code-keyword">import</span> javax.xml.ws.Response;
...
<span class="code-keyword">public</span> <span class="code-keyword">interface</span> GreeterAsync {

  <span class="code-keyword">public</span> Future&lt;?&gt; greetMeSometimeAsync(
    java.lang.<span class="code-object">String</span> requestType,
    AsyncHandler&lt;org.apache.hello_world_async_soap_http.types.GreetMeSometimeResponse&gt; asyncHandler
  );

  <span class="code-keyword">public</span> Response&lt;org.pache.hello_world_async_soap_http.types.GreetMeSometimeResponse&gt; greetMeSometimeAsync(
    java.lang.<span class="code-object">String</span> requestType
  );

  <span class="code-keyword">public</span> java.lang.<span class="code-object">String</span> greetMeSometime(
    java.lang.<span class="code-object">String</span> requestType
  );
}</pre>
</div></div></p>

<p>In addition to the usual synchronous method, <tt>greetMeSometime()</tt>, two asynchronous methods are also generated for the <tt>greetMeSometime</tt> operation, as follows:</p>

<ul>
	<li><tt>greetMeSometimeAsync()</tt> method with <tt>Future&lt;?&gt;</tt> return type and an extra <tt>javax.xml.ws.AsyncHandler</tt> parameter - call this method for the callback approach to asynchronous invocation.</li>
	<li><tt>greetMeSometimeAsync()</tt> method with <tt>Response&lt;GreetMeSometimeResponse&gt;</tt> return type - call this method for the polling approach to asynchronous invocation.</li>
</ul>


<p>The details of the callback approach and the polling approach are discussed in the following subsections.</p>

<h4><a name="DevelopingaConsumer-Implementinganasynchronousclientwiththepollingapproach"></a>Implementing an asynchronous client with the polling approach</h4>
<p><a href="#DevelopingaConsumer-Example9" title="Example9 on Developing a Consumer">Example9</a> illustrates the polling approach to making an asynchronous operation call. Using this approach, the client invokes the<br/>
operation by calling the special Java method, <tt>_OperationName_Async()</tt>, that returns a <tt>javax.xml.ws.Response&lt;T&gt;</tt> object, where T is the type of the operation's response message. The <tt>Response&lt;T&gt;</tt> object can be polled at a later stage to check whether the operation's response message has arrived.</p>

<p><a name="DevelopingaConsumer-Example9"></a><div class="code"><div class="codeHeader"><b>Example 9:Polling Approach for an Asynchronous Operation Call</b></div><div class="codeContent">
<pre class="code-java"><span class="code-keyword">package</span> demo.hw.client;

<span class="code-keyword">import</span> java.io.File;
<span class="code-keyword">import</span> java.util.concurrent.Future;

<span class="code-keyword">import</span> javax.xml.namespace.QName;
<span class="code-keyword">import</span> javax.xml.ws.Response;

<span class="code-keyword">import</span> org.apache.hello_world_async_soap_http.GreeterAsync;
<span class="code-keyword">import</span> org.apache.hello_world_async_soap_http.SOAPService;
<span class="code-keyword">import</span> org.apche.hello_world_async_soap_http.types.GreetMeSometimeResponse;

<span class="code-keyword">public</span> <span class="code-keyword">final</span> class Client {
  <span class="code-keyword">private</span> <span class="code-keyword">static</span> <span class="code-keyword">final</span> QName SERVICE_NAME
    = <span class="code-keyword">new</span> QName(<span class="code-quote">"http:<span class="code-comment">//objectweb.org/hello_world_async_soap_http"</span>, <span class="code-quote">"SOAPService"</span>);
</span>
  <span class="code-keyword">private</span> Client() {}

  <span class="code-keyword">public</span> <span class="code-keyword">static</span> void main(<span class="code-object">String</span> args[]) <span class="code-keyword">throws</span> Exception {
    ...
    <span class="code-comment">// Polling approach:
</span>    Response&lt;GreetMeSometimeResponse&gt; greetMeSomeTimeResp =
      port.greetMeSometimeAsync(<span class="code-object">System</span>.getProperty(<span class="code-quote">"user.name"</span>));
      <span class="code-keyword">while</span> (!greetMeSomeTimeResp.isDone()) {
        <span class="code-object">Thread</span>.sleep(100);
      }
      GreetMeSometimeResponse reply = greetMeSomeTimeResp.get();
      ...
      <span class="code-object">System</span>.exit(0);
  }
}</pre>
</div></div></p>

<p>The <tt>greetMeSometimeAsync()</tt> method invokes the <tt>greetMeSometimes</tt> operation, transmitting the input parameters to the remote service and returning a reference to a <tt>javax.xml.ws.Response&lt;GreetMeSometimeResponse&gt;</tt> object. The  <tt>Response</tt> class is defined by extending the standard <tt>java.util.concurrency.Future&lt;T&gt;</tt> interface, which is specifically designed for polling the outcome of work performed by a concurrent thread. There are essentially two basic approaches to polling using the <tt>Response</tt> object:</p>
<ul>
	<li><b>Non-blocking polling</b> - before attempting to get the result, check whether the response has arrived by calling the non-blocking<br/>
<tt>Response&lt;T&gt;.isDone()</tt> method. For example:
<div class="code"><div class="codeContent">
<pre class="code-java">Response&lt;GreetMeSometimeResponse&gt; greetMeSomeTimeResp = ...;

<span class="code-keyword">if</span> (greetMeSomeTimeResp.isDone()) {
  GreetMeSometimeResponse reply = greetMeSomeTimeResp.get();
}</pre>
</div></div></li>
	<li><b>Blocking polling</b> - call <tt>Response&lt;T&gt;.get()</tt> right away and block until the response arrives (optionally specifying a timeout). For example, to poll for a response, with a 60 second timeout:
<div class="code"><div class="codeContent">
<pre class="code-java">Response&lt;GreetMeSometimeResponse&gt; greetMeSomeTimeResp = ...;

GreetMeSometimeResponse reply = greetMeSomeTimeResp.get(
  60L,
  java.util.concurrent.TimeUnit.SECONDS
  );</pre>
</div></div></li>
</ul>


<h4><a name="DevelopingaConsumer-Implementinganasynchronousclientwiththecallbackapproach"></a>Implementing an asynchronous client with the callback approach</h4>

<p>An alternative approach to making an asynchronous operation invocation is to implement a callback class, by deriving from the<br/>
<tt>javax.xml.ws.AsyncHandler</tt> interface. This callback class must implement a <tt>handleResponse()</tt> method, which is called by the CXF runtime to notify the client that the response has arrived. <a href="#DevelopingaConsumer-Example10" title="Example10 on Developing a Consumer">Example10</a> shows an outline of the <tt>AsyncHandler</tt> interface that you need to implement.</p>

<p><a name="DevelopingaConsumer-Example10"></a><div class="code"><div class="codeHeader"><b>Example10: The javax.xml.ws.AsyncHandler Interface</b></div><div class="codeContent">
<pre class="code-java"><span class="code-keyword">package</span> javax.xml.ws;

<span class="code-keyword">public</span> <span class="code-keyword">interface</span> AsyncHandler&lt;T&gt;
{
  void handleResponse(Response&lt;T&gt; res);
}</pre>
</div></div></p>

<p>In this example, a callback class, <tt>TestAsyncHandler</tt>, is defined as shown in <a href="#DevelopingaConsumer-Example11" title="Example11 on Developing a Consumer">Example11</a>.</p>

<p><a name="DevelopingaConsumer-Example11"></a><div class="code"><div class="codeHeader"><b>Example 11: The TestAsyncHandler Callback Class</b></div><div class="codeContent">
<pre class="code-java"><span class="code-keyword">package</span> demo.hw.client;

<span class="code-keyword">import</span> javax.xml.ws.AsyncHandler;
<span class="code-keyword">import</span> javax.xml.ws.Response;

<span class="code-keyword">import</span> org.apache.hello_world_async_soap_http.types.GreetMeSometimeResponse;

<span class="code-keyword">public</span> class TestAsyncHandler <span class="code-keyword">implements</span> AsyncHandler&lt;GreetMeSometimeResponse&gt; {
  <span class="code-keyword">private</span> GreetMeSometimeResponse reply;

  <span class="code-keyword">public</span> void handleResponse(Response&lt;GreetMeSometimeResponse&gt; response) {
    <span class="code-keyword">try</span> {
      reply = response.get();
    } <span class="code-keyword">catch</span> (Exception ex) {
      ex.printStackTrace();
    }
  }

  <span class="code-keyword">public</span> <span class="code-object">String</span> getResponse() {
    <span class="code-keyword">return</span> reply.getResponseType();
  }
}</pre>
</div></div></p>

<p>The implementation of <tt>handleResponse()</tt> shown in <a href="#DevelopingaConsumer-Example11" title="Example11 on Developing a Consumer">Example11</a> simply gets the response data and stores it in a member variable, <tt>reply</tt>. The extra <tt>getResponse()</tt> method is just a convenience method that extracts the sole output parameter (that is, <tt>responseType</tt>) from the response.</p>

<p><a href="#DevelopingaConsumer-Example12" title="Example12 on Developing a Consumer">Example12</a> illustrates the callback approach to making an asynchronous operation call. Using this approach, the client invokes the operation by calling the special Java method, <tt>_OperationName_Async()</tt>, that returns a <tt>java.util.concurrency.Future&lt;?&gt;</tt> object and takes an extra parameter of <tt>AsyncHandler&lt;T&gt;</tt>.</p>

<p><a name="DevelopingaConsumer-Example12"></a><div class="code"><div class="codeHeader"><b>Callback Approach for an Asynchronous Operation Call</b></div><div class="codeContent">
<pre class="code-java"><span class="code-keyword">package</span> demo.hw.client;

<span class="code-keyword">import</span> java.io.File;
<span class="code-keyword">import</span> java.util.concurrent.Future;

<span class="code-keyword">import</span> javax.xml.namespace.QName;
<span class="code-keyword">import</span> javax.xml.ws.Response;

<span class="code-keyword">import</span> org.apache.hello_world_async_soap_http.GreeterAsync;
<span class="code-keyword">import</span> org.apache.hello_world_async_soap_http.SOAPService;
<span class="code-keyword">import</span> org.apache.hello_world_async_soap_http.types.GreetMeSometimeResponse;

<span class="code-keyword">public</span> <span class="code-keyword">final</span> class Client {
  <span class="code-keyword">private</span> <span class="code-keyword">static</span> <span class="code-keyword">final</span> QName SERVICE_NAME
    = <span class="code-keyword">new</span> QName(<span class="code-quote">"http:<span class="code-comment">//apache.org/hello_world_async_soap_http"</span>, <span class="code-quote">"SOAPService"</span>);
</span>
  <span class="code-keyword">private</span> Client() {}

  <span class="code-keyword">public</span> <span class="code-keyword">static</span> void main(<span class="code-object">String</span> args[]) <span class="code-keyword">throws</span> Exception {
    ...
    <span class="code-comment">// Callback approach
</span>    TestAsyncHandler testAsyncHandler = <span class="code-keyword">new</span> TestAsyncHandler();
    <span class="code-object">System</span>.out.println(<span class="code-quote">"Invoking greetMeSometimeAsync using callback object..."</span>);
    Future&lt;?&gt; response = port.greetMeSometimeAsync(<span class="code-object">System</span>.getProperty(<span class="code-quote">"user.name"</span>), testAsyncHandler);
    <span class="code-keyword">while</span> (!response.isDone()) {
      <span class="code-object">Thread</span>.sleep(100);
    }
    resp = testAsyncHandler.getResponse();
    ...
    <span class="code-object">System</span>.exit(0);
  }
}</pre>
</div></div></p>

<p>The <tt>Future&lt;?&gt;</tt> object returned by <tt>greetMeSometimeAsync()</tt> can be used only to test whether or not a response has arrived yet - for example, by calling <tt>response.isDone()</tt>. The value of the response is only made available to the callback object, <tt>testAsyncHandler</tt>.</p></div>


</td></tr></table></div>
<p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
    <tr>
        <td height="12" background="http://cwiki.apache.org/confluence/images/border/border_bottom.gif"><img src="http://cwiki.apache.org/confluence/images/border/spacer.gif" width="1" height="1" border="0"/></td>
    </tr>
</table>

<div class="smalltext">
    Powered by
    <a href="http://www.atlassian.com/software/confluence/default.jsp?clicked=footer" class="smalltext">Atlassian Confluence</a>
    (Version: 2.2.9 Build:#527 Sep 07, 2006)
    -
    <a href="http://jira.atlassian.com/secure/BrowseProject.jspa?id=10470" class="smalltext">Bug/feature request</a><br/>
    <br>
    <a href="http://cwiki.apache.org/confluence/users/viewnotifications.action">Unsubscribe or edit your notifications preferences</a>

</div>

</body>
</html>


Mime
View raw message