You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Jason Pell <ja...@pellcorp.com> on 2010/12/20 10:11:38 UTC

Re: CXF 2.3.1 + @XmlRequired + asm wrappers

Hi,

When I include an @XmlRequired attribute the generated WSDL wrapper
element has the namespace of the service rather than the WebParam
element itself.  So I have the following interface:

@WebService(name="PersonService",
targetNamespace="http://pellcorp.com/PersonService")
public interface PersonService {
	@WebResult(name = "PersonResult", targetNamespace="http://pellcorp.com/Person")
	@WebMethod(operationName = "retrievePersonScore")
	PersonResult retrievePersonScore(
		@XmlElement(required = true) @WebParam(name = "Person",
targetNamespace="http://pellcorp.com/Person") Person request);
}

Without including @XmlElement(required = true) the Person element in
the WSDL is in the http://pellcorp.com/Person namespace.  When I
include the @XmlElement(required = true) its in the
http://pellcorp.com/PersonService namespace.  I tried this same
operation with JAX-WS 2.2.1 metro and it works as I expected.  This
looks like a bug to me.  I can workaround it by providing my own
@RequestWrapper

I know there were changes made in 2.3.1 to fix the fact that the
@XmlElement(required = true) was being ignored.  Any chance that the
GeneratedWrapper has another bug?  The Person jaxb class has a
XmlRootElement like so:

@XmlRootElement(name="Person", namespace="http://pellcorp.com/Person")

Thanks for any advice

Cheers
Jason

Re: CXF 2.3.1 + @XmlRequired + asm wrappers

Posted by Daniel Kulp <dk...@apache.org>.
On Monday 20 December 2010 4:11:38 am Jason Pell wrote:
> Hi,
> 
> When I include an @XmlRequired attribute the generated WSDL wrapper
> element has the namespace of the service rather than the WebParam
> element itself.  So I have the following interface:
> 
> @WebService(name="PersonService",
> targetNamespace="http://pellcorp.com/PersonService")
> public interface PersonService {
> 	@WebResult(name = "PersonResult",
> targetNamespace="http://pellcorp.com/Person") @WebMethod(operationName =
> "retrievePersonScore")
> 	PersonResult retrievePersonScore(
> 		@XmlElement(required = true) @WebParam(name = "Person",
> targetNamespace="http://pellcorp.com/Person") Person request);
> }
> 
> Without including @XmlElement(required = true) the Person element in
> the WSDL is in the http://pellcorp.com/Person namespace.  When I
> include the @XmlElement(required = true) its in the
> http://pellcorp.com/PersonService namespace.  I tried this same
> operation with JAX-WS 2.2.1 metro and it works as I expected.  This
> looks like a bug to me.  I can workaround it by providing my own
> @RequestWrapper

This does sound like a bug.   Can you log it?   I THINK that we are just 
copying the XmlElement annotation directly if it's there.   Thus, if you add 
the namespace and name attributes to the XmlElement annotation, then it's 
likely to work.

Dan


> I know there were changes made in 2.3.1 to fix the fact that the
> @XmlElement(required = true) was being ignored.  Any chance that the
> GeneratedWrapper has another bug?  The Person jaxb class has a
> XmlRootElement like so:
> 
> @XmlRootElement(name="Person", namespace="http://pellcorp.com/Person")
> 
> Thanks for any advice
> 
> Cheers
> Jason

-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog