Dan, I'm seeing the exact same behavior (values null when received by
client) using the wsdl2java generated client and jax:ws endpoints.

-bh

On 7/27/07, Dan Diephouse <[EMAIL PROTECTED]> wrote:
>
> Hi Holger,
>
> I'm going to take a stab in the dark and say its because you're using the
> ClientProxyFactoryBean with the JaxWsServerFactoryBean. You should either
> be
> sure to use the JaxWsProxyFactoryBean with the JaxWsServerFactoryBean OR
> use
> the ServerFactoryBean with the ClientProxyFactoryBean. Hope that helps,
> - Dan
>
> On 7/25/07, Holger Stolzenberg <[EMAIL PROTECTED]> wrote:
> >
> > I have the following bug that where I cannnot figure out where the
> > problem is. I have a Web Service with the following definition:
> >
> > =========== INTERFACE ============
> >
> > @WebService( name = "SubscriptionService" )
> > public interface ISubscriptionService extends IBackendService
> > {
> >         @WebMethod( operationName = "getSubscriptionById" )
> >         @WebResult( name = "getSubscriptionByIdResult" )
> >         public Subscription getSubscriptionById(        @WebParam( name
> > = "auth" ) ServiceAuthentication auth,
> >
> > @WebParam( name = "subscriptionId" ) int subscriptionId ) throws
> > BackendServiceException;
> > }
> >
> >
> > =========== IMPL ===========
> >
> > @WebService( serviceName = "SubscriptionService", endpointInterface =
> > "ISubscriptionService" )
> > public class SubscriptionServiceImpl extends BackendServiceImpl
> > implements ISubscriptionService
> > {
> >         public Subscription getSubscriptionById( ServiceAuthentication
> > auth, int subscriptionId ) throws SubscriptionServiceException
> >         {
> >                 try
> >                 {
> >                         // here we use a Spring transaction proxy
> > (Hibernate, TransactionManager, TransactionDemarcation ...)
> >                         ISubscriptionDaoProxy proxy =
> > (ISubscriptionDaoProxy) getDaoProxyProvider().getDaoProxy(
> > ISubscriptionDaoProxy.class );
> >                         Subscription subscription =
> > proxy.getSubscriptionById( subscriptionId );
> >
> >                         return subscription; <<<<<<<<<<<<<<<<< If I set
> > a breakPoint here in my TestNG Test, I can see a valid object was loaded
> > and returned
> >                 }
> >                 catch ( Exception e )
> >                 {
> >                         ...
> >                 }
> >         }
> > }
> >
> > The web service itself is declared as spring bean (excerpt):
> >
> > <?xml version="1.0" encoding="UTF-8" ?>
> > <beans xmlns="http://www.springframework.org/schema/beans";
> >                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> >                 xmlns:jaxws="http://cxf.apache.org/jaxws";
> >
> > xsi:schemaLocation="http://www.springframework.org/schema/beans
> > http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
> >
> > http://cxf.apache.org/jaxws classpath:/schemas/jaxws.xsd">
> >
> >         <!-- Load Celtixfire configuration stuff -->
> >         <import resource="classpath:META-INF/cxf/cxf.xml" />
> >         <import resource="classpath:META-INF/cxf/cxf-extension-*.xml" />
> >         <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
> >
> >         ... all needed beans defined here ...
> >
> >         <!-- Subscription service -->
> >         <bean id="SubscriptionServiceImpl"
> > class="com.ewerk.eex.shop.backend.wsapi.subscription.SubscriptionService
> > Impl">
> >                 <property name="daoProxyProvider"
> > ref="DaoProxyProvider"/>
> >                 <property name="eventModule" ref="EventModule"/>
> >                 <property name="serviceAuthenticationValidator"
> > ref="ServiceAuthenticationValidator"/>
> >         </bean>
> >         <jaxws:endpoint id="SubscriptionService"
> > address="/SubscriptionService">
> >                 <jaxws:implementor>
> >                         <ref bean="SubscriptionServiceImpl" />
> >                 </jaxws:implementor>
> >         </jaxws:endpoint>
> >
> > </beans>
> >
> > Everything is working fine, the Tomcat starts up without problems and I
> > can access the WSDL of the service. I also can call the service via a
> > PHP client and a fully initialized Subscription object is returned.
> >
> > I also have an TestNG test class that test the service. Here lies the
> > problem:
> >
> > =========== TEST CODE ===========
> >
> > @Test( groups = "ServiceTestGroup" )
> > public void testGetSubscriptionById() throws Exception
> > {
> >         // start server
> >         JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean ();
> >         sf.setBus( bus );
> >         sf.setServiceClass( ISubscriptionService.class );
> >         sf.setServiceBean( impl ); <<<<< gets injected from spring
> > context
> >         sf.setAddress( "http://localhost:8080/SubscriptionService"; );
> >         sf.getServiceFactory().setDataBinding( new AegisDatabinding() );
> >         sf.create();
> >
> >         // create client
> >         ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
> >         factory.setBus( bus );
> >         factory.setServiceClass( ISubscriptionService.class );
> >         factory.setAddress( "http://localhost:8080/SubscriptionService";
> > );
> >         factory.getServiceFactory().setDataBinding( new
> > AegisDatabinding() );
> >
> >         ISubscriptionService client =
> > (ISubscriptionService)factory.create();
> >
> >         int testId = IBackendTestConstants.TEST_SUBSCRIPTION_ID;
> >         Subscription loaededSubscription = client.getSubscriptionById(
> > getServiceAuthentication(), testId ); <<<<<     when invoked I can see a
> > valid
> > Subscription object
> >
> > loaded at the breakpoint in the impl class BUT
> >
> >         assert ( subscription != null ) : "Subscription is null";
> >         assert ( subscription.getId() == testId ) : "Ids are not
> > matching";      <<<<<<          This assert fails because the local
> > variable
> > 'loadedSubscription' is only PARTIALLY initialized. Every field
> > is null except fields that are foreing key references.
> > Subscription.class bean is not only the return value of the web
> > service, it is also an annotated hibernate mapping bean.
> > }
> >
> > Can anyone tell my why the object returned from the client has
> > uninitialized fields ????
> >
> > I know that this problem report is pretty long but I did not know how to
> > clarify the problem in another way. Any help is really appreciated.
> > Thanks a lot!!!
> >
>
>
>
> --
> Dan Diephouse
> Envoi Solutions
> http://envoisolutions.com | http://netzooid.com/blog
>

Reply via email to