I don't understand why you are getting DataSource for the type of all the representations - perhaps the schema that defines the elements like nm:ExtractAndNormalize is not referenced in the WADL ?
A quick fix would be to remove the element attribute from the representation elements, that should remove the duplicated methods.
Also you shouldn't need the Accept, Content-Length or ContentType params are these headers are set automatically by the generated code.
Marc.
On Dec 9, 2009, at 12:04 PM, Andrew Glowik wrote:
> Sept 11, 2009 version of wadl2java can not disambiguate multiple REQUEST representations with multiple RESPONSE representations. Here is a sample WADL snippet...
>
> <resource path="norm">
> <method id="normalization-and-extraction" name="POST">
> <doc>Post single list for normalization and/or extraction. HTTP respose contains the results.</doc>
> <request>
> <param style="header" name="Accept" type="xsd:string" required="true">
> <doc>Payload type</doc>
> </param>
> <param style="header" name="Content-Length" type="xsd:integer">
> <doc>Payload size in bytes. Do not include if also including an HTTP Transfer-Encoding header of "chunked". For HTTP/1.1, the application accepts the "chunked" transfer-coding.</doc>
> </param>
> <param style="header" name="Content-Type" type="xsd:string" required="true">
> <doc>Payload type</doc>
> </param>
> <param style="header" name="Authorization" type="xsd:string" required="true">
> <doc>Scheme of HTTP Basic: Basic base64String(user:password)</doc>
> </param>
> <representation id="AttachmentXml" mediaType="application/xml" status="200" element="nm:ExtractAndNormalize">
> <doc>ExtractAndNormalize.xsd</doc>
> </representation>
> <representation id="AttachmentJson" mediaType="application/json" status="200">
> <doc>JSON equivalent of ExtractAndNormalize.xsd</doc>
> </representation>
> </request>
> <response>
> <representation id="AcceptXml" mediaType="application/xml" status="200" element="nm:ExtractAndNormalize"/>
> <representation id="AcceptJson" mediaType="application/json" status="200"/>
> <fault status="415">
> <doc>Unsupported media type.</doc>
> </fault>
> <fault status="404">
> <doc>Not found.</doc>
> </fault>
> <fault status="401">
> <doc>Unauthorized.</doc>
> </fault>
> </response>
> </method>
> </resource>
>
> Maven output...
>
> [INFO] ------------------------------------------------------------------------
> [ERROR] BUILD FAILURE
> [INFO] ------------------------------------------------------------------------
> [INFO] Compilation failure
> /home/tedworkspace-cr-maven2/maven/CoralReefClient/target/generated-sources/wadl/com/berico/client/Endpoint.java:[825,26] postAcceptxmlAsApplicationXml(javax.activation.DataSource,java.lang.String,java.lang.String,java.lang.String) is already defined in com.berico.client.Endpoint.Norm
>
> /home/tedworkspace-cr-maven2/maven/CoralReefClient/target/generated-sources/wadl/com/berico/client/Endpoint.java:[861,26] postAcceptxmlAsApplicationXml(javax.activation.DataSource,java.lang.String,java.lang.String,java.lang.String,java.lang.Integer) is already defined in com.berico.client.Endpoint.Norm
>
> /home/ted/workspace-cr-maven2/maven/CoralReefClient/target/generated-sources/wadl/com/berico/client/Endpoint.java:[896,26] postAcceptjsonAsApplicationJson(javax.activation.DataSource,java.lang.String,java.lang.String,java.lang.String) is already defined in com.berico.client.Endpoint.Norm
>
> Class output .... Does not compile ....
>
> public Norm()
> throws JAXBException
> {
> _jc = JAXBContext.newInstance("coralreef");
> _jaxbDispatcher = new JAXBDispatcher(_jc);
> _dsDispatcher = new DSDispatcher();
> _uriBuilder = new UriBuilder();
> List<String> _matrixParamSet;
> _matrixParamSet = _uriBuilder.addPathSegment("https://localhost:8181/coralreef-resource/");
> _matrixParamSet = _uriBuilder.addPathSegment("norm");
> _templateAndMatrixParameterValues = new HashMap<String, Object>();
> }
> /**
> * Post single list for normalization and/or extraction. HTTP respose contains the results.
> *
> * @param input
> * ExtractAndNormalize.xsd
> * @param accept
> * Payload type
> * @param authorization
> * Scheme of HTTP Basic: Basic base64String(user:password)
> * @param contentType
> * Payload type
> */
> public DataSource postAcceptxmlAsApplicationXml(DataSource input, String accept, String contentType, String authorization)
> throws IOException, MalformedURLException
> {
> HashMap<String, Object> _queryParameterValues = new HashMap<String, Object>();
> HashMap<String, Object> _headerParameterValues = new HashMap<String, Object>();
> if (accept == null) {
> throw new IllegalArgumentException("Parameter Accept of method postAcceptxmlAsApplicationXml is required and must not be null");
> }
> _headerParameterValues.put("Accept", accept);
> if (contentType == null) {
> throw new IllegalArgumentException("Parameter Content-Type of method postAcceptxmlAsApplicationXml is required and must not be null");
> }
> _headerParameterValues.put("Content-Type", contentType);
> if (authorization == null) {
> throw new IllegalArgumentException("Parameter Authorization of method postAcceptxmlAsApplicationXml is required and must not be null");
> }
> _headerParameterValues.put("Authorization", authorization);
> String _url = _uriBuilder.buildUri(_templateAndMatrixParameterValues, _queryParameterValues);
> DataSource _retVal = _dsDispatcher.doPOST(input, "application/xml", _url, _headerParameterValues, "application/xml");
> return _retVal;
> }
> /**
> * Post single list for normalization and/or extraction. HTTP respose contains the results.
> *
> * @param input
> * ExtractAndNormalize.xsd
> * @param accept
> * Payload type
> * @param authorization
> * Scheme of HTTP Basic: Basic base64String(user:password)
> * @param contentType
> * Payload type
> * @param contentLength
> * Payload size in bytes. Do not include if also including an HTTP Transfer-Encoding header of "chunked". For HTTP/1.1, the application accepts the "chunked" transfer-coding.
> */
> public DataSource postAcceptxmlAsApplicationXml(DataSource input, String accept, String contentType, String authorization, Integer contentLength)
> throws IOException, MalformedURLException
> {
> HashMap<String, Object> _queryParameterValues = new HashMap<String, Object>();
> HashMap<String, Object> _headerParameterValues = new HashMap<String, Object>();
> if (accept == null) {
> throw new IllegalArgumentException("Parameter Accept of method postAcceptxmlAsApplicationXml is required and must not be null");
> }
> _headerParameterValues.put("Accept", accept);
> if (contentType == null) {
> throw new IllegalArgumentException("Parameter Content-Type of method postAcceptxmlAsApplicationXml is required and must not be null");
> }
> _headerParameterValues.put("Content-Type", contentType);
> if (authorization == null) {
> throw new IllegalArgumentException("Parameter Authorization of method postAcceptxmlAsApplicationXml is required and must not be null");
> }
> _headerParameterValues.put("Authorization", authorization);
> _headerParameterValues.put("Content-Length", contentLength);
> String _url = _uriBuilder.buildUri(_templateAndMatrixParameterValues, _queryParameterValues);
> DataSource _retVal = _dsDispatcher.doPOST(input, "application/xml", _url, _headerParameterValues, "application/xml");
> return _retVal;
> }
> /**
> * Post single list for normalization and/or extraction. HTTP respose contains the results.
> *
> * @param input
> * ExtractAndNormalize.xsd
> * @param accept
> * Payload type
> * @param authorization
> * Scheme of HTTP Basic: Basic base64String(user:password)
> * @param contentType
> * Payload type
> */
> public DataSource postAcceptjsonAsApplicationJson(DataSource input, String accept, String contentType, String authorization)
> throws IOException, MalformedURLException
> {
> HashMap<String, Object> _queryParameterValues = new HashMap<String, Object>();
> HashMap<String, Object> _headerParameterValues = new HashMap<String, Object>();
> if (accept == null) {
> throw new IllegalArgumentException("Parameter Accept of method postAcceptjsonAsApplicationJson is required and must not be null");
> }
> _headerParameterValues.put("Accept", accept);
> if (contentType == null) {
> throw new IllegalArgumentException("Parameter Content-Type of method postAcceptjsonAsApplicationJson is required and must not be null");
> }
> _headerParameterValues.put("Content-Type", contentType);
> if (authorization == null) {
> throw new IllegalArgumentException("Parameter Authorization of method postAcceptjsonAsApplicationJson is required and must not be null");
> }
> _headerParameterValues.put("Authorization", authorization);
> String _url = _uriBuilder.buildUri(_templateAndMatrixParameterValues, _queryParameterValues);
> DataSource _retVal = _dsDispatcher.doPOST(input, "application/xml", _url, _headerParameterValues, "application/json");
> return _retVal;
> }
> /**
> * Post single list for normalization and/or extraction. HTTP respose contains the results.
> *
> * @param input
> * ExtractAndNormalize.xsd
> * @param accept
> * Payload type
> * @param authorization
> * Scheme of HTTP Basic: Basic base64String(user:password)
> * @param contentType
> * Payload type
> * @param contentLength
> * Payload size in bytes. Do not include if also including an HTTP Transfer-Encoding header of "chunked". For HTTP/1.1, the application accepts the "chunked" transfer-coding.
> */
> public DataSource postAcceptjsonAsApplicationJson(DataSource input, String accept, String contentType, String authorization, Integer contentLength)
> throws IOException, MalformedURLException
> {
> HashMap<String, Object> _queryParameterValues = new HashMap<String, Object>();
> HashMap<String, Object> _headerParameterValues = new HashMap<String, Object>();
> if (accept == null) {
> throw new IllegalArgumentException("Parameter Accept of method postAcceptjsonAsApplicationJson is required and must not be null");
> }
> _headerParameterValues.put("Accept", accept);
> if (contentType == null) {
> throw new IllegalArgumentException("Parameter Content-Type of method postAcceptjsonAsApplicationJson is required and must not be null");
> }
> _headerParameterValues.put("Content-Type", contentType);
> if (authorization == null) {
> throw new IllegalArgumentException("Parameter Authorization of method postAcceptjsonAsApplicationJson is required and must not be null");
> }
> _headerParameterValues.put("Authorization", authorization);
> _headerParameterValues.put("Content-Length", contentLength);
> String _url = _uriBuilder.buildUri(_templateAndMatrixParameterValues, _queryParameterValues);
> DataSource _retVal = _dsDispatcher.doPOST(input, "application/xml", _url, _headerParameterValues, "application/json");
> return _retVal;
> }
> /**
> * Post single list for normalization and/or extraction. HTTP respose contains the results.
> *
> * @param input
> * JSON equivalent of ExtractAndNormalize.xsd
> * @param accept
> * Payload type
> * @param authorization
> * Scheme of HTTP Basic: Basic base64String(user:password)
> * @param contentType
> * Payload type
> */
> public DataSource postAcceptxmlAsApplicationXml(DataSource input, String accept, String contentType, String authorization)
> throws IOException, MalformedURLException
> {
> HashMap<String, Object> _queryParameterValues = new HashMap<String, Object>();
> HashMap<String, Object> _headerParameterValues = new HashMap<String, Object>();
> if (accept == null) {
> throw new IllegalArgumentException("Parameter Accept of method postAcceptxmlAsApplicationXml is required and must not be null");
> }
> _headerParameterValues.put("Accept", accept);
> if (contentType == null) {
> throw new IllegalArgumentException("Parameter Content-Type of method postAcceptxmlAsApplicationXml is required and must not be null");
> }
> _headerParameterValues.put("Content-Type", contentType);
> if (authorization == null) {
> throw new IllegalArgumentException("Parameter Authorization of method postAcceptxmlAsApplicationXml is required and must not be null");
> }
> _headerParameterValues.put("Authorization", authorization);
> String _url = _uriBuilder.buildUri(_templateAndMatrixParameterValues, _queryParameterValues);
> DataSource _retVal = _dsDispatcher.doPOST(input, "application/json", _url, _headerParameterValues, "application/xml");
> return _retVal;
> }
> /**
> * Post single list for normalization and/or extraction. HTTP respose contains the results.
> *
> * @param input
> * JSON equivalent of ExtractAndNormalize.xsd
> * @param accept
> * Payload type
> * @param authorization
> * Scheme of HTTP Basic: Basic base64String(user:password)
> * @param contentType
> * Payload type
> * @param contentLength
> * Payload size in bytes. Do not include if also including an HTTP Transfer-Encoding header of "chunked". For HTTP/1.1, the application accepts the "chunked" transfer-coding.
> */
> public DataSource postAcceptxmlAsApplicationXml(DataSource input, String accept, String contentType, String authorization, Integer contentLength)
> throws IOException, MalformedURLException
> {
> HashMap<String, Object> _queryParameterValues = new HashMap<String, Object>();
> HashMap<String, Object> _headerParameterValues = new HashMap<String, Object>();
> if (accept == null) {
> throw new IllegalArgumentException("Parameter Accept of method postAcceptxmlAsApplicationXml is required and must not be null");
> }
> _headerParameterValues.put("Accept", accept);
> if (contentType == null) {
> throw new IllegalArgumentException("Parameter Content-Type of method postAcceptxmlAsApplicationXml is required and must not be null");
> }
> _headerParameterValues.put("Content-Type", contentType);
> if (authorization == null) {
> throw new IllegalArgumentException("Parameter Authorization of method postAcceptxmlAsApplicationXml is required and must not be null");
> }
> _headerParameterValues.put("Authorization", authorization);
> _headerParameterValues.put("Content-Length", contentLength);
> String _url = _uriBuilder.buildUri(_templateAndMatrixParameterValues, _queryParameterValues);
> DataSource _retVal = _dsDispatcher.doPOST(input, "application/json", _url, _headerParameterValues, "application/xml");
> return _retVal;
> }
> /**
> * Post single list for normalization and/or extraction. HTTP respose contains the results.
> *
> * @param input
> * JSON equivalent of ExtractAndNormalize.xsd
> * @param accept
> * Payload type
> * @param authorization
> * Scheme of HTTP Basic: Basic base64String(user:password)
> * @param contentType
> * Payload type
> */
> public DataSource postAcceptjsonAsApplicationJson(DataSource input, String accept, String contentType, String authorization)
> throws IOException, MalformedURLException
> {
> HashMap<String, Object> _queryParameterValues = new HashMap<String, Object>();
> HashMap<String, Object> _headerParameterValues = new HashMap<String, Object>();
> if (accept == null) {
> throw new IllegalArgumentException("Parameter Accept of method postAcceptjsonAsApplicationJson is required and must not be null");
> }
> _headerParameterValues.put("Accept", accept);
> if (contentType == null) {
> throw new IllegalArgumentException("Parameter Content-Type of method postAcceptjsonAsApplicationJson is required and must not be null");
> }
> _headerParameterValues.put("Content-Type", contentType);
> if (authorization == null) {
> throw new IllegalArgumentException("Parameter Authorization of method postAcceptjsonAsApplicationJson is required and must not be null");
> }
> _headerParameterValues.put("Authorization", authorization);
> String _url = _uriBuilder.buildUri(_templateAndMatrixParameterValues, _queryParameterValues);
> DataSource _retVal = _dsDispatcher.doPOST(input, "application/json", _url, _headerParameterValues, "application/json");
> return _retVal;
> }
> /**
> * Post single list for normalization and/or extraction. HTTP respose contains the results.
> *
> * @param input
> * JSON equivalent of ExtractAndNormalize.xsd
> * @param accept
> * Payload type
> * @param authorization
> * Scheme of HTTP Basic: Basic base64String(user:password)
> * @param contentType
> * Payload type
> * @param contentLength
> * Payload size in bytes. Do not include if also including an HTTP Transfer-Encoding header of "chunked". For HTTP/1.1, the application accepts the "chunked" transfer-coding.
> */
> public DataSource postAcceptjsonAsApplicationJson(DataSource input, String accept, String contentType, String authorization, Integer contentLength)
> throws IOException, MalformedURLException
> {
> HashMap<String, Object> _queryParameterValues = new HashMap<String, Object>();
> HashMap<String, Object> _headerParameterValues = new HashMap<String, Object>();
> if (accept == null) {
> throw new IllegalArgumentException("Parameter Accept of method postAcceptjsonAsApplicationJson is required and must not be null");
> }
> _headerParameterValues.put("Accept", accept);
> if (contentType == null) {
> throw new IllegalArgumentException("Parameter Content-Type of method postAcceptjsonAsApplicationJson is required and must not be null");
> }
> _headerParameterValues.put("Content-Type", contentType);
> if (authorization == null) {
> throw new IllegalArgumentException("Parameter Authorization of method postAcceptjsonAsApplicationJson is required and must not be null");
> }
> _headerParameterValues.put("Authorization", authorization);
> _headerParameterValues.put("Content-Length", contentLength);
> String _url = _uriBuilder.buildUri(_templateAndMatrixParameterValues, _queryParameterValues);
> DataSource _retVal = _dsDispatcher.doPOST(input, "application/json", _url, _headerParameterValues, "application/json");
> return _retVal;
> }
> }