You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Julio Arias <ju...@rbxglobal.com> on 2008/02/09 17:43:45 UTC
Rest HTTP binding wrapped=false
I have the following service interface:
@Get
@HttpResource(location = "/student/{id}")
StudentSession startSession(StartSession startSession);
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType
public class StartSession {
protected long id;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
}
When the StartSession gets unmarshaled the id is always 0, I debug JAXBEncoderDecoder and the XMLStreamReader source seams to be fine what can be the problem?? I attach the WSDL with the schema defs.
--
Julio Arias
Java Developer
Roundbox Global : enterprise : technology : genius
-------------------------------------------------------------------------
Avenida 11 y Calle 7-9, Barrio Amón, San Jose, Costa Rica
tel: (011) 506.258.3695 ext. 2001 | cell: (011) 506.849.5981
email: julio.arias@rbxglobal.com | www.rbxglobal.com
-------------------------------------------------------------------------
Re: Rest HTTP binding wrapped=false
Posted by Julio Arias <ju...@rbxglobal.com>.
Found the problem I added the package-info.java with the following
annotation:
@javax.xml.bind.annotation.XmlSchema(namespace = "http:/
kaplan.scorelms.edu",
elementFormDefault =
javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
And everything start to work.
Julio Arias
Java Developer
Roundbox Global : enterprise : technology : genius
-------------------------------------------------------------------------
Avenida 11 y Calle 7-9, Barrio Amón, San Jose, Costa Rica
tel: (011) 506.258.3695 ext. 2001 | cell: (011) 506.849.5981
email: julio.arias@rbxglobal.com | www.rbxglobal.com
-------------------------------------------------------------------------
On Feb 9, 2008, at 10:43 AM, Julio Arias wrote:
> I have the following service interface:
>
> @Get
> @HttpResource(location = "/student/{id}")
> StudentSession startSession(StartSession startSession);
>
> @XmlAccessorType(XmlAccessType.FIELD)
> @XmlType
> public class StartSession {
> protected long id;
>
> public long getId() {
> return id;
> }
>
> public void setId(long id) {
> this.id = id;
> }
> }
>
> When the StartSession gets unmarshaled the id is always 0, I debug
> JAXBEncoderDecoder and the XMLStreamReader source seams to be fine
> what can be the problem?? I attach the WSDL with the schema defs.
>
> --
> Julio Arias
> Java Developer
> Roundbox Global : enterprise : technology : genius
> -------------------------------------------------------------------------
> Avenida 11 y Calle 7-9, Barrio Amón, San Jose, Costa Rica
> tel: (011) 506.258.3695 ext. 2001 | cell: (011) 506.849.5981
> email: julio.arias@rbxglobal.com | www.rbxglobal.com
> -------------------------------------------------------------------------
Re: Rest HTTP binding wrapped=false
Posted by Julio Arias <ju...@rbxglobal.com>.
This is my spring config:
<import resource="classpath:META-INF/cxf/cxf.xml"/>
<import resource="classpath:META-INF/cxf/cxf-extension-http-binding.xml"/>
<import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
<jaxws:endpoint id="rteServie"
implementor="#sessionService"
address="/"
bindingUri="http://apache.org/cxf/binding/http">
<jaxws:serviceFactory>
<bean class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean">
<property name="wrapped" value="false"/>
</bean>
</jaxws:serviceFactory>
</jaxws:endpoint>
And my server use for unit testing:
sessionService.setRandom(new Random(1));
JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
sf.setServiceClass(SessionService.class);
sf.getServiceFactory().setWrapped(false);
sf.setBindingId(HttpBindingFactory.HTTP_BINDING_ID);
sf.setAddress("http://localhost:9001/visits/");
sf.getServiceFactory().setInvoker(new BeanInvoker(sessionService));
svr = sf.create();
----- Original Message -----
From: "Jervis Liu" <je...@gmail.com>
To: cxf-user@incubator.apache.org
Sent: Saturday, February 9, 2008 7:50:51 PM (GMT-0600) America/Guatemala
Subject: Re: Rest HTTP binding wrapped=false
Are you sure you have set your wrapped style to false? i.e., using sth
like sf.getServiceFactory().setWrapped(false); or through spring
configuration. Your service does look alright as far as I can see, this kind
of problems normally happen when you messed up with wrapped style.
Cheers,
Jervis
On Feb 10, 2008 12:43 AM, Julio Arias <ju...@rbxglobal.com> wrote:
> I have the following service interface:
>
> @Get
> @HttpResource(location = "/student/{id}")
> StudentSession startSession(StartSession startSession);
>
> @XmlAccessorType(XmlAccessType.FIELD)
> @XmlType
> public class StartSession {
> protected long id;
>
> public long getId() {
> return id;
> }
>
> public void setId(long id) {
> this.id = id;
> }
> }
>
> When the StartSession gets unmarshaled the id is always 0, I debug
> JAXBEncoderDecoder and the XMLStreamReader source seams to be fine what can
> be the problem?? I attach the WSDL with the schema defs.
>
> --
> Julio Arias
> Java Developer
> Roundbox Global : enterprise : technology : genius
> -------------------------------------------------------------------------
> Avenida 11 y Calle 7-9, Barrio Amón, San Jose, Costa Rica
> tel: (011) 506.258.3695 ext. 2001 | cell: (011) 506.849.5981
> email: julio.arias@rbxglobal.com | www.rbxglobal.com
> -------------------------------------------------------------------------
>
--
Julio Arias
Java Developer
Roundbox Global : enterprise : technology : genius
-------------------------------------------------------------------------
Avenida 11 y Calle 7-9, Barrio Amón, San Jose, Costa Rica
tel: (011) 506.258.3695 ext. 2001 | cell: (011) 506.849.5981
email: julio.arias@rbxglobal.com | www.rbxglobal.com
-------------------------------------------------------------------------
Re: Rest HTTP binding wrapped=false
Posted by Jervis Liu <je...@gmail.com>.
Are you sure you have set your wrapped style to false? i.e., using sth
like sf.getServiceFactory().setWrapped(false); or through spring
configuration. Your service does look alright as far as I can see, this kind
of problems normally happen when you messed up with wrapped style.
Cheers,
Jervis
On Feb 10, 2008 12:43 AM, Julio Arias <ju...@rbxglobal.com> wrote:
> I have the following service interface:
>
> @Get
> @HttpResource(location = "/student/{id}")
> StudentSession startSession(StartSession startSession);
>
> @XmlAccessorType(XmlAccessType.FIELD)
> @XmlType
> public class StartSession {
> protected long id;
>
> public long getId() {
> return id;
> }
>
> public void setId(long id) {
> this.id = id;
> }
> }
>
> When the StartSession gets unmarshaled the id is always 0, I debug
> JAXBEncoderDecoder and the XMLStreamReader source seams to be fine what can
> be the problem?? I attach the WSDL with the schema defs.
>
> --
> Julio Arias
> Java Developer
> Roundbox Global : enterprise : technology : genius
> -------------------------------------------------------------------------
> Avenida 11 y Calle 7-9, Barrio Amón, San Jose, Costa Rica
> tel: (011) 506.258.3695 ext. 2001 | cell: (011) 506.849.5981
> email: julio.arias@rbxglobal.com | www.rbxglobal.com
> -------------------------------------------------------------------------
>