If you generated code with wsdl2java, it's a JAX-WS interface (with 
@WebService and @WebParam and such).  Thus, use:

ClientProxyFactoryBean factory = new JaxWsProxyFactoryBean();

Otherwise, those annotations and such won't be picked up (simple 
frontend).

Dan





On Wednesday 08 October 2008, cmoulliard wrote:
> Hi,
>
> I have a strange problem when I use ClientProxyFactoryBean. I have
> created a Cxf project (using cxf 2.1.2) and generated code from my
> WSDL file using wsdl2java generator.
>
> In the following unit test, the result of the web service call is
> NULL.
>
>       private static String ADDRESS =
> "http://localhost:9000/unittesttrack";;
>
>       @BeforeClass
>     public static void startServer() throws Exception {
>         // We need to start a server that exposes or webservice during
> the unit testing
>         // We use jaxws to do this pretty simple
>       TrackerServiceImpl server = new TrackerServiceImpl();
>         Endpoint.publish(ADDRESS, server);
>
>     }
>
>       @Test
>       public void serverStarted() throws Exception {
>       // Start server
>       this.startServer();
>       }
>
>
>       @Test
>       public void shouldGenerateWsdl() throws Exception {
>               URL url = new URL(ADDRESS + "?wsdl");
>               URLConnection connection = url.openConnection();
>               Assert.assertNotNull(connection.getContent());
>               showResponse(connection);
>       }
>
>       @Test
>       public void shouldHaveParcelViaWebService() throws Exception {
>               XMLGregorianCalendar calendar =
> DatatypeFactory.newInstance().newXMLGregorianCalendar( new
> GregorianCalendar());
>       calendar.setDay(7);
>       calendar.setMonth(10);
>       calendar.setYear(2008);
>
>       // Create web service client
>       createWebServiceClient();
>
>       TrackParcelEndpoint client = createWebServiceClient();
>               InputTrackParcel parcel = new InputTrackParcel();
>               parcel.setName("chm");
>               parcel.setDestination("Brussels");
>               parcel.setOrigin("Florennes");
>               parcel.setDeliveryDate(calendar);
>
>               OutputTrackParcel result = client.PostParcel(parcel);
>               Log.info("Result : " + result.getReference()); <<<<<  NULL 
> POINTER
> EXCEPTION IS GENERATED HERE
>               Assert.assertNotNull(result);
>       }
>
>       private TrackParcelEndpoint createWebServiceClient() {
>
>               ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
>               factory.setServiceClass(TrackParcelEndpoint.class);
>               factory.setAddress(ADDRESS);
>               TrackParcelEndpoint client = (TrackParcelEndpoint) 
> factory.create();
>               return client;
>       }
>
> Surprisingly, if I try to connect to the server using the SOAPUI
> client, my SOAPUI client receives a reply from the service.
>
> How can I solve/debug my problem ?
>
> Charles Moulliard
>
> -----
> Enterprise Architect
>
> Xpectis
> 12, route d'Esch
> L-1470 Luxembourg
>
> Phone +352 25 10 70 470
> Mobile +352 621 45 36 22
>
> e-mail : [EMAIL PROTECTED]
> web site :  www.xpectis.com www.xpectis.com
> My Blog :  http://cmoulliard.blogspot.com/
> http://cmoulliard.blogspot.com/



-- 
J. Daniel Kulp
[EMAIL PROTECTED]
http://www.dankulp.com/blog

Reply via email to