You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Mick Knutson <mi...@gmail.com> on 2009/09/18 20:03:56 UTC
issue with Spring client setting Object fields to null
I have a simple cxf service that returns a User Object. When I run this is
SOAPUI with the following call:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ser="http://service.baselogic.com/">
<soapenv:Header/>
<soapenv:Body>
*<ser:findUser>
<arg0>9687</arg0>
</ser:findUser>*
</soapenv:Body>
</soapenv:Envelope>
I get a valid response User:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns1:findUserResponse xmlns:ns1="http://service.baselogic.com/">
<return>
*<ns2:id xmlns:ns2="http://domain.baselogic.com">9687</ns2:id>
<ns2:name xmlns:ns2="http://domain.baselogic.com">Mick
Knutson</ns2:name>*
</return>
</ns1:findUserResponse>
</soap:Body>
</soap:Envelope>
But with this Spring client in my Unit Test, I get a User object that has id
and name as null:
<jaxws:client id="messageServiceClient"
serviceClass="com.baselogic.service.MessageService"
address="http://localhost:8889/webapp/cxf/MessageService" />
Can anyone help me understand what is wrong with my client?
---
Thank You…
Mick Knutson, President
BASE Logic, Inc.
Enterprise Architecture, Design, Mentoring & Agile Consulting
p. (866) BLiNC-411: (254-6241-1)
f. (415) 685-4233
Website: http://baselogic.com
Linked IN: http://linkedin.com/in/mickknutson
Vacation Rental: http://tahoe.baselogic.com
---
Re: issue with Spring client setting Object fields to null
Posted by Mick Knutson <mi...@gmail.com>.
I also tried:
<bean id="proxyFactory"
class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
<property name="serviceClass"
value="com.baselogic.service.MessageService" />
<property name="address" value="${test.client.address}" />
</bean>
<bean id="messageServiceClient"
class="com.baselogic.service.MessageService" factory-bean="proxyFactory"
factory-method="create" />
but that also did not help.
I have tested more, and it appears that a new User object is actually
returned to this <jaxws:client... instead of the one that is actually
returned by the Server.
Either that, or for some reason the client can not map the returned
namespaces and thus creates a blank User object in its place.
---
Thank You…
Mick Knutson, President
BASE Logic, Inc.
Enterprise Architecture, Design, Mentoring & Agile Consulting
p. (866) BLiNC-411: (254-6241-1)
f. (415) 685-4233
Website: http://baselogic.com
Linked IN: http://linkedin.com/in/mickknutson
Vacation Rental: http://tahoe.baselogic.com
---
On Fri, Sep 18, 2009 at 2:03 PM, Mick Knutson <mi...@gmail.com> wrote:
> I have a simple cxf service that returns a User Object. When I run this is
> SOAPUI with the following call:
>
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:ser="http://service.baselogic.com/">
> <soapenv:Header/>
> <soapenv:Body>
> *<ser:findUser>
> <arg0>9687</arg0>
> </ser:findUser>*
> </soapenv:Body>
> </soapenv:Envelope>
>
>
> I get a valid response User:
>
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
> <soap:Body>
> <ns1:findUserResponse xmlns:ns1="http://service.baselogic.com/">
> <return>
> *<ns2:id xmlns:ns2="http://domain.baselogic.com">9687</ns2:id>
> <ns2:name xmlns:ns2="http://domain.baselogic.com">Mick
> Knutson</ns2:name>*
> </return>
> </ns1:findUserResponse>
> </soap:Body>
> </soap:Envelope>
>
>
> But with this Spring client in my Unit Test, I get a User object that has
> id and name as null:
>
> <jaxws:client id="messageServiceClient"
> serviceClass="com.baselogic.service.MessageService"
> address="http://localhost:8889/webapp/cxf/MessageService" />
>
>
> Can anyone help me understand what is wrong with my client?
>
>
> ---
> Thank You…
>
> Mick Knutson, President
>
> BASE Logic, Inc.
> Enterprise Architecture, Design, Mentoring & Agile Consulting
> p. (866) BLiNC-411: (254-6241-1)
> f. (415) 685-4233
>
> Website: http://baselogic.com
> Linked IN: http://linkedin.com/in/mickknutson
> Vacation Rental: http://tahoe.baselogic.com
> ---
>
>
RE: issue with Spring client setting Object fields to null
Posted by Tom Cassimon <to...@cassimon.mine.nu>.
Hi,
can you try to set a breakpoint on the setter of name & id
on the client domain object to see i fit gets called by CXF?
Regards,
Tom
-----Oorspronkelijk bericht-----
Van: mknutson@baselogic.com [mailto:mknutson@baselogic.com] Namens Mick
Knutson
Verzonden: vrijdag 18 september 2009 20:55
Aan: users@cxf.apache.org
Onderwerp: Re: issue with Spring client setting Object fields to null
I added this to the User Domain:
@XmlElement(required=true)
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public void setName(String name) {
this.name = name;
}
@XmlElement(required=true)
public String getName() {
return name;
}
but still get nothing:
[blinc] DEBUG [main] DefaultListableBeanFactory.doGetBean(214) | Returning
cached instan
[blinc] DEBUG [main] MessageWebServiceTest.testFindAll(51) |
--------------------
[blinc] DEBUG [main] MessageWebServiceTest.testFindAll(52) | result: *
{id=null,name=null}*
[blinc] DEBUG [main] MessageWebServiceTest.testFindAll(53) |
--------------------
I also tried to annotate this in the Service:
@XmlElement(name="user")
User findUser(long pk);
But still nothing in the Spring Client.
---
Thank You.
Mick Knutson, President
BASE Logic, Inc.
Enterprise Architecture, Design, Mentoring & Agile Consulting
p. (866) BLiNC-411: (254-6241-1)
f. (415) 685-4233
Website: http://baselogic.com
Linked IN: http://linkedin.com/in/mickknutson
Vacation Rental: http://tahoe.baselogic.com
---
On Fri, Sep 18, 2009 at 2:32 PM, Tom Cassimon <to...@cassimon.mine.nu> wrote:
> I almost had the same problem, I solved it by putting the following
> annotation above the getter in the User model on both server & client:
>
> @XmlElement(required=true)
>
> Try it and see if the id and name are filled in then.
>
> Regards,
>
> Tom
>
> -----Oorspronkelijk bericht-----
> Van: mknutson@baselogic.com [mailto:mknutson@baselogic.com] Namens Mick
> Knutson
> Verzonden: vrijdag 18 september 2009 20:04
> Aan: CXF Users
> Onderwerp: issue with Spring client setting Object fields to null
>
> I have a simple cxf service that returns a User Object. When I run this is
> SOAPUI with the following call:
>
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/
> "
> xmlns:ser="http://service.baselogic.com/">
> <soapenv:Header/>
> <soapenv:Body>
> *<ser:findUser>
> <arg0>9687</arg0>
> </ser:findUser>*
> </soapenv:Body>
> </soapenv:Envelope>
>
>
> I get a valid response User:
>
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
> <soap:Body>
> <ns1:findUserResponse xmlns:ns1="http://service.baselogic.com/">
> <return>
> *<ns2:id xmlns:ns2="http://domain.baselogic.com">9687</ns2:id>
> <ns2:name xmlns:ns2="http://domain.baselogic.com">Mick
> Knutson</ns2:name>*
> </return>
> </ns1:findUserResponse>
> </soap:Body>
> </soap:Envelope>
>
>
> But with this Spring client in my Unit Test, I get a User object that has
> id
> and name as null:
>
> <jaxws:client id="messageServiceClient"
> serviceClass="com.baselogic.service.MessageService"
> address="http://localhost:8889/webapp/cxf/MessageService" />
>
>
> Can anyone help me understand what is wrong with my client?
>
>
> ---
> Thank You.
>
> Mick Knutson, President
>
> BASE Logic, Inc.
> Enterprise Architecture, Design, Mentoring & Agile Consulting
> p. (866) BLiNC-411: (254-6241-1)
> f. (415) 685-4233
>
> Website: http://baselogic.com
> Linked IN: http://linkedin.com/in/mickknutson
> Vacation Rental: http://tahoe.baselogic.com
> ---
>
>
Re: issue with Spring client setting Object fields to null
Posted by Mick Knutson <mi...@gmail.com>.
I added this to the User Domain:
@XmlElement(required=true)
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public void setName(String name) {
this.name = name;
}
@XmlElement(required=true)
public String getName() {
return name;
}
but still get nothing:
[blinc] DEBUG [main] DefaultListableBeanFactory.doGetBean(214) | Returning
cached instan
[blinc] DEBUG [main] MessageWebServiceTest.testFindAll(51) |
--------------------
[blinc] DEBUG [main] MessageWebServiceTest.testFindAll(52) | result: *
{id=null,name=null}*
[blinc] DEBUG [main] MessageWebServiceTest.testFindAll(53) |
--------------------
I also tried to annotate this in the Service:
@XmlElement(name="user")
User findUser(long pk);
But still nothing in the Spring Client.
---
Thank You…
Mick Knutson, President
BASE Logic, Inc.
Enterprise Architecture, Design, Mentoring & Agile Consulting
p. (866) BLiNC-411: (254-6241-1)
f. (415) 685-4233
Website: http://baselogic.com
Linked IN: http://linkedin.com/in/mickknutson
Vacation Rental: http://tahoe.baselogic.com
---
On Fri, Sep 18, 2009 at 2:32 PM, Tom Cassimon <to...@cassimon.mine.nu> wrote:
> I almost had the same problem, I solved it by putting the following
> annotation above the getter in the User model on both server & client:
>
> @XmlElement(required=true)
>
> Try it and see if the id and name are filled in then.
>
> Regards,
>
> Tom
>
> -----Oorspronkelijk bericht-----
> Van: mknutson@baselogic.com [mailto:mknutson@baselogic.com] Namens Mick
> Knutson
> Verzonden: vrijdag 18 september 2009 20:04
> Aan: CXF Users
> Onderwerp: issue with Spring client setting Object fields to null
>
> I have a simple cxf service that returns a User Object. When I run this is
> SOAPUI with the following call:
>
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/
> "
> xmlns:ser="http://service.baselogic.com/">
> <soapenv:Header/>
> <soapenv:Body>
> *<ser:findUser>
> <arg0>9687</arg0>
> </ser:findUser>*
> </soapenv:Body>
> </soapenv:Envelope>
>
>
> I get a valid response User:
>
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
> <soap:Body>
> <ns1:findUserResponse xmlns:ns1="http://service.baselogic.com/">
> <return>
> *<ns2:id xmlns:ns2="http://domain.baselogic.com">9687</ns2:id>
> <ns2:name xmlns:ns2="http://domain.baselogic.com">Mick
> Knutson</ns2:name>*
> </return>
> </ns1:findUserResponse>
> </soap:Body>
> </soap:Envelope>
>
>
> But with this Spring client in my Unit Test, I get a User object that has
> id
> and name as null:
>
> <jaxws:client id="messageServiceClient"
> serviceClass="com.baselogic.service.MessageService"
> address="http://localhost:8889/webapp/cxf/MessageService" />
>
>
> Can anyone help me understand what is wrong with my client?
>
>
> ---
> Thank You.
>
> Mick Knutson, President
>
> BASE Logic, Inc.
> Enterprise Architecture, Design, Mentoring & Agile Consulting
> p. (866) BLiNC-411: (254-6241-1)
> f. (415) 685-4233
>
> Website: http://baselogic.com
> Linked IN: http://linkedin.com/in/mickknutson
> Vacation Rental: http://tahoe.baselogic.com
> ---
>
>
RE: issue with Spring client setting Object fields to null
Posted by Tom Cassimon <to...@cassimon.mine.nu>.
I almost had the same problem, I solved it by putting the following
annotation above the getter in the User model on both server & client:
@XmlElement(required=true)
Try it and see if the id and name are filled in then.
Regards,
Tom
-----Oorspronkelijk bericht-----
Van: mknutson@baselogic.com [mailto:mknutson@baselogic.com] Namens Mick
Knutson
Verzonden: vrijdag 18 september 2009 20:04
Aan: CXF Users
Onderwerp: issue with Spring client setting Object fields to null
I have a simple cxf service that returns a User Object. When I run this is
SOAPUI with the following call:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ser="http://service.baselogic.com/">
<soapenv:Header/>
<soapenv:Body>
*<ser:findUser>
<arg0>9687</arg0>
</ser:findUser>*
</soapenv:Body>
</soapenv:Envelope>
I get a valid response User:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns1:findUserResponse xmlns:ns1="http://service.baselogic.com/">
<return>
*<ns2:id xmlns:ns2="http://domain.baselogic.com">9687</ns2:id>
<ns2:name xmlns:ns2="http://domain.baselogic.com">Mick
Knutson</ns2:name>*
</return>
</ns1:findUserResponse>
</soap:Body>
</soap:Envelope>
But with this Spring client in my Unit Test, I get a User object that has id
and name as null:
<jaxws:client id="messageServiceClient"
serviceClass="com.baselogic.service.MessageService"
address="http://localhost:8889/webapp/cxf/MessageService" />
Can anyone help me understand what is wrong with my client?
---
Thank You.
Mick Knutson, President
BASE Logic, Inc.
Enterprise Architecture, Design, Mentoring & Agile Consulting
p. (866) BLiNC-411: (254-6241-1)
f. (415) 685-4233
Website: http://baselogic.com
Linked IN: http://linkedin.com/in/mickknutson
Vacation Rental: http://tahoe.baselogic.com
---