You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by giomes <gi...@gmail.com> on 2014/05/09 22:24:00 UTC

Wadl Generator produces empty grammar

Hello to all. 
I'm using CXF version 2.7.6.

This is my resource configuration:
	<cxf:rsServer id="exchangeCoinServer"
		address="http://localhost:8080/exchangecoins"
	
serviceClass="it.quigroup.titan.exchange.restfulep.service.CoinFacadeService"
		loggingFeatureEnabled="true">
		<cxf:providers>
			<ref bean="jsonProvider" />
			<ref bean="cxfExceptionMapper" />
			<ref bean="wadlGenerator" />
		</cxf:providers>
	</cxf:rsServer>

This is my resource class:

public class CoinFacadeService {

	@POST
	@Path("/")
	@Produces(MediaType.APPLICATION_JSON)
	@Consumes(MediaType.APPLICATION_JSON)
	public DefineCurrencyForVirtualCoinResponseDTO
defineCurrencyForVirtualCoin(
			DefineCurrencyForVirtualCoinDTO defineCurrencyForVirtualCoinDTO) {
		return null;
	}
}

This is DefineCurrencyForVirtualCoinDTO bean:

@XmlRootElement (name="DefineCurrencyForVirtualCoin")
public class DefineCurrencyForVirtualCoinDTO {
	@XmlElement
	@NotNull
	private String codSourcePurse;

	@XmlElement
	@NotNull
	private String codTargetCurrency;

	public String getCodSourcePurse() {
		return codSourcePurse;
	}

	public void setCodSourcePurse(String codSourcePurse) {
		this.codSourcePurse = codSourcePurse;
	}

	public String getCodTargetCurrency() {
		return codTargetCurrency;
	}

	public void setCodTargetCurrency(String codTargetCurrency) {
		this.codTargetCurrency = codTargetCurrency;
	}
}

When I try to invoke ?_wadl URL I get a wadl without grammar:
<application xmlns="http://wadl.dev.java.net/2009/02"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
   <grammars/>
   <resources base="http://localhost:9071/exchangecoins">
      <resource path="/">
         <method name="POST">
            <request>
               <representation mediaType="application/json"/>
            </request>
            <response>
               <representation mediaType="application/json"/>
            </response>
         </method>
      </resource>
   </resources>
</application>

What am I doing wrong? 
Thank you.




--
View this message in context: http://cxf.547215.n5.nabble.com/Wadl-Generator-produces-empty-grammar-tp5743829.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Wadl Generator produces empty grammar

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi

you need to enable a "linkJsonToXmlSchema" WADLGenerator property

Cheers, Sergey
On 09/05/14 21:24, giomes wrote:
> Hello to all.
> I'm using CXF version 2.7.6.
>
> This is my resource configuration:
> 	<cxf:rsServer id="exchangeCoinServer"
> 		address="http://localhost:8080/exchangecoins"
> 	
> serviceClass="it.quigroup.titan.exchange.restfulep.service.CoinFacadeService"
> 		loggingFeatureEnabled="true">
> 		<cxf:providers>
> 			<ref bean="jsonProvider" />
> 			<ref bean="cxfExceptionMapper" />
> 			<ref bean="wadlGenerator" />
> 		</cxf:providers>
> 	</cxf:rsServer>
>
> This is my resource class:
>
> public class CoinFacadeService {
>
> 	@POST
> 	@Path("/")
> 	@Produces(MediaType.APPLICATION_JSON)
> 	@Consumes(MediaType.APPLICATION_JSON)
> 	public DefineCurrencyForVirtualCoinResponseDTO
> defineCurrencyForVirtualCoin(
> 			DefineCurrencyForVirtualCoinDTO defineCurrencyForVirtualCoinDTO) {
> 		return null;
> 	}
> }
>
> This is DefineCurrencyForVirtualCoinDTO bean:
>
> @XmlRootElement (name="DefineCurrencyForVirtualCoin")
> public class DefineCurrencyForVirtualCoinDTO {
> 	@XmlElement
> 	@NotNull
> 	private String codSourcePurse;
>
> 	@XmlElement
> 	@NotNull
> 	private String codTargetCurrency;
>
> 	public String getCodSourcePurse() {
> 		return codSourcePurse;
> 	}
>
> 	public void setCodSourcePurse(String codSourcePurse) {
> 		this.codSourcePurse = codSourcePurse;
> 	}
>
> 	public String getCodTargetCurrency() {
> 		return codTargetCurrency;
> 	}
>
> 	public void setCodTargetCurrency(String codTargetCurrency) {
> 		this.codTargetCurrency = codTargetCurrency;
> 	}
> }
>
> When I try to invoke ?_wadl URL I get a wadl without grammar:
> <application xmlns="http://wadl.dev.java.net/2009/02"
> xmlns:xs="http://www.w3.org/2001/XMLSchema">
>     <grammars/>
>     <resources base="http://localhost:9071/exchangecoins">
>        <resource path="/">
>           <method name="POST">
>              <request>
>                 <representation mediaType="application/json"/>
>              </request>
>              <response>
>                 <representation mediaType="application/json"/>
>              </response>
>           </method>
>        </resource>
>     </resources>
> </application>
>
> What am I doing wrong?
> Thank you.
>
>
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/Wadl-Generator-produces-empty-grammar-tp5743829.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com