cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mick Knutson" <mickknut...@gmail.com>
Subject Re: [2.0.5] need help creating client in TestNG and Spring
Date Sat, 12 Apr 2008 22:53:19 GMT
*So I added a logging interceptor in my TestNG:*
           * JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();

            factory.getInInterceptors().add(new LoggingInInterceptor());
            factory.getOutInterceptors().add(new LoggingOutInterceptor());
            factory.setServiceClass(UserManager.class);
            factory.setAddress("
http://localhost:8080/webapp-2.2/cxf/UserService");
*

*So I now get this in my debug:*
*Encoding: UTF-8
Headers: {SOAPAction=[""], Accept=[*]}
Messages:
Payload: <soap:Envelope xmlns:soap="
http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns1:getUser
xmlns:ns1="http://service.baselogic.com/">
<userId>-1</userId></ns1:getUser></soap:Body></soap:Envelope>
--------------------------------------
12-Apr-2008 15:44:45 org.apache.cxf.interceptor.LoggingInInterceptor logging
INFO: Inbound Message
----------------------------
Encoding: UTF-8
Headers: {Content-Length=[1576], Date=[Sat, 12 Apr 2008 22:44:45 GMT],
SOAPAction=[""], Server=[Apache-Coyote/1.1], content-type=[text/xml;charse
t=UTF-8]}
Messages:
Message:

Payload: <soap:Envelope xmlns:soap="
http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns1:getUserResponse
xmlns:ns1="http://service.baselogi
c.com/"><return><ns2:address
xmlns:ns2="http://domain.baselogic.com"><ns2:address>725
Florida Street #5</ns2:address><ns2:city>San Francisco</ns2
:city><ns2:country>US</ns2:country><ns2:id>-1</ns2:id><ns2:postalCode>94110</ns2:postalCode><ns2:province>CA</ns2:province><ns2:version>1</ns2:ve
rsion></ns2:address><ns2:confirmPassword xmlns:ns2="
http://domain.baselogic.com" xmlns:ns3="
http://www.w3.org/2001/XMLSchema-instance" ns3:nil="t
rue" /><ns2:email xmlns:ns2="http://domain.baselogic.com">
mickknutson@removed.com</ns2:email><ns2:firstName xmlns:ns2="
http://domain.baselogic.com"
>Mick</ns2:firstName><ns2:id
xmlns:ns2="http://domain.baselogic.com">-1</ns2:id><ns2:lastName
xmlns:ns2="http://domain.baselogic.com">Knutson</ns
2:lastName><ns2:password
xmlns:ns2="http://domain.baselogic.com">12dea96fec20593566ab75692c9949596833adc9</ns2:password><ns2:passwordHint
xmlns:n
s2="http://domain.baselogic.com">A male
kitty.</ns2:passwordHint><ns2:phoneNumber xmlns:ns2="
http://domain.baselogic.com">(415) 648-1804</ns2:pho
neNumber><ns2:roles xmlns:ns2="http://domain.baselogic.com" xmlns:ns3="
http://www.w3.org/2001/XMLSchema-instance" ns3:nil="true" /><ns2:username
xmlns:ns2="http://domain.baselogic.com">mickknutson</ns2:username><ns2:version
xmlns:ns2="http://domain.baselogic.com">1</ns2:version><ns2:websit
e xmlns:ns2="http://domain.baselogic.com">http://baselogic.com
</ns2:website></return></ns1:getUserResponse></soap:Body></soap:Envelope>
*

*But When i actually try tot get the data from my UserManager:*
            *User user = userManager.getUser("-1");
            Address address = user.getAddress();
            //log.debug("userManager.getUser: " + user.getUsername());

log.debug("======================================================");
            log.debug("user: " + user.toString());

log.debug("======================================================");*

*I still get <null> for everything.*
*[myproject] DEBUG [main] UserServiceTest.testGetUser2(155) |
======================================================
[myproject] DEBUG [main] UserServiceTest.testGetUser2(156) | user:
com.baselogic.domain.User@97aaa6[username=<null>
,password=<null>,confirmPasswo
rd=<null>,passwordHint=<null>,firstName=<null>,lastName=<null>,address=<null>,email=<null>,phoneNumber=<null>,website=<null>,roles=[],enabled=fal
se,accountExpired=false,accountLocked=false,credentialsExpired=false,id=<null>,version=<null>]
*

Can someone help me understand what I am missing here? How do I get access
to this payload? it appears the data is returning correctly, I just can't
get access to it.



On Sat, Apr 12, 2008 at 12:24 PM, Mick Knutson <mickknutson@gmail.com>
wrote:

> I have tried the example
> http://cwiki.apache.org/CXF20DOC/writing-a-service-with-spring.html for
> setting up a service. My service has a DAO going against my database. This
> service works just fine external using SoapUI when deployed into tomcat.
>
> But I want to deploy to embeded tomcat, and execute via testNG. When I use
> the following test client:
>
>     *<bean id="userClient"
> class="com.baselogic.service.impl.UserManagerImpl"
>           factory-bean="userClientFactory" factory-method="create"/>
>
>     <!-- Factory to create the dynamic proxy -->
>     <bean id="userClientFactory"
> class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
>         <property name="serviceClass"
> value="com.baselogic.service.UserManager"/>
>         <property name="address" value="
> http://localhost:8080/webapp-2.2/cxf/UserService"/>
>     </bean>
>
>
> **From my UserManagerImpl:
> **
> **    public User getUser(String userId) throws UserNotFoundException {*
> *
> log.debug("======================================================");*
> *        log.debug("getUser(String userId) " + userId);*
> *
> log.debug("======================================================");*
>
> *        User user = userDao.read(Long.valueOf(userId));*
> *        if(user == null){*
> *            throw new UserNotFoundException("user " + userId + " Not
> Found");*
> *        }*
> *        return user;*
> *    }*
> *
> *
> I seem to get a version of com.baselogic.service.UserManager that was
> proxied that does not have any of my debug statements or the doa. Thus I get
> back a null object, and nothing is printed.
>
> So what is the proper usage for me to start a cxf client to access a
> deployed webservice to my embeded container so that is uses the deployed
> service, and does not re-create a new one?
>
>
>
> --
> Thanks,
> Mick Knutson
>
> http://www.baselogic.com
> http://www.blincmagazine.com
> http://www.linkedin.com/in/mickknutson
> http://www.djmick.com
> http://www.myspace.com/mickknutson
> http://www.myspace.com/BLiNCMagazine
> http://tahoe.baselogic.com
> ---




-- 
Thanks,
Mick Knutson

http://www.baselogic.com
http://www.blincmagazine.com
http://www.linkedin.com/in/mickknutson
http://www.djmick.com
http://www.myspace.com/mickknutson
http://www.myspace.com/BLiNCMagazine
http://tahoe.baselogic.com
---

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message