cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache CXF Documentation > Defining Contract first webservices with wsdl generation from java
Date Wed, 16 Jan 2013 13:33:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/2042/9/1/_/styles/combined.css?spaceKey=CXF20DOC&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/CXF20DOC/Defining+Contract+first+webservices+with+wsdl+generation+from+java?focusedCommentId=30748896#comment-30748896">Defining
Contract first webservices with wsdl generation from java</a></h2>
        <h4>Page
        <b>comment added</b> by              <a href="https://cwiki.apache.org/confluence/display/~hedzap@gmail.com">joakim
hedlund</a>
    </h4>
    <br/>
    <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>

<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>

<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/>
    @Valid<br/>
    @NotNull(message=Constants.CUSTOMER_CONSTRAINT)<br/>
    @XmlElement(required=true)<br/>
    Customer customer;<br/>
    other attributes...<br/>
-------------<br/>
@XmlAccessorType( XmlAccessType.FIELD )<br/>
public class Customer {<br/>
    @XmlElement(required=true)<br/>
    @NotNull(message=Constants.NAME_CONSTRAINT)<br/>
    @Size(min=Constants.NAME_MIN_SIZE, max=Constants.NAME_MAX_SIZE, message=Constants.NAME_CONSTRAINT)<br/>
    String name;<br/>
    other attributes...</p>

<p>Runtime:<br/>
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>

        
    <div id="commentsSection" class="wiki-content pageSection">
       <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
       </div>
       <a href="https://cwiki.apache.org/confluence/display/CXF20DOC/Defining+Contract+first+webservices+with+wsdl+generation+from+java?focusedCommentId=30748896#comment-30748896">View
Online</a>
              |
       <a id="reply-30748896" href="https://cwiki.apache.org/confluence/display/CXF20DOC/Defining+Contract+first+webservices+with+wsdl+generation+from+java?replyToComment=30748896#comment-30748896">Reply
To This</a>
           </div>

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

Mime
View raw message