cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [CONF] Apache CXF Documentation > Defining Contract first webservices with wsdl generation from java
Date Wed, 16 Jan 2013 13:33:00 GMT
    <base href="">
            <link rel="stylesheet" href="/confluence/s/2042/9/1/_/styles/combined.css?spaceKey=CXF20DOC&amp;forWysiwyg=true"
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="">Defining
Contract first webservices with wsdl generation from java</a></h2>
        <b>comment added</b> by              <a href="">joakim
    <div class="notificationGreySide">
       <p>Great post and a very interesting subject! </p>

<p>Also read the comments @ liquid reality and i completly agree with you - it´s time
to question what contract-first really means! I don't se the differense if your contracts
origin is java code and generating plugins like java2wsdl or produced by other external tools,
it´s still contract first development since your implementation is based on the contract!

<p>Im currently working on a project with a very much similar design pattern of your
example, and the thing that bugs me the most is the gap between JSR303 (Bean Validation) and
JAX-B in context of JAX-WS. </p>

<p>We are using Bean Validation on our domain objects simply because we can't rely only
on schema validation only. This is achived through javax.validation.Validator, javax.validation.ConstraintViolation
and to get the recursive validation - javax.validation.Valid on our complex domain-objekts.

<p>But to support schema validation based on same constraints seemes like an impossible
task today, JAXB tags gets you as far as MinOccurs="0" (xs-wise) - but in an ideal future
the generating plugins like java2wsdl would also understand tags of JSR303 at schema generation
time, perhaps in form of an own DSL? </p>

<p>A short example of what im aming for below, where the @NotNull and @XmlElement(required=true)
really is redundant, but necessary if you want to be able to perform both schema validation
and run-time validation and at the same time keep all objects versatile... </p>

<p>@XmlAccessorType( XmlAccessType.FIELD )<br/>
public class OrderRequest {<br/>
    Customer customer;<br/>
    other attributes...<br/>
@XmlAccessorType( XmlAccessType.FIELD )<br/>
public class Customer {<br/>
    @Size(min=Constants.NAME_MIN_SIZE, max=Constants.NAME_MAX_SIZE, message=Constants.NAME_CONSTRAINT)<br/>
    String name;<br/>
    other attributes...</p>

Set&lt;ConstraintViolation&lt;OrderRequest&gt;&gt; validationResults = javax.validation.Validator.validate(request);</p>

<p>Would love to hear about news or other thoughts on the subject!</p>

    <div id="commentsSection" class="wiki-content pageSection">
       <div style="float: right;">
            <a href=""
class="grey">Change Notification Preferences</a>
       <a href="">View
       <a id="reply-30748896" href="">Reply
To This</a>


View raw message