I don't have experience of using

JaxWsServerFactoryBean

BUt I can take a look this weekend.

-Henry


On 6/11/2010 7:03 AM, william he wrote:
Hello there,

I am confused on some

@WebService
public interface CustomerService  {
     @WebResult(name="customers")
     public Customers getCustomers();
}

Customers is the wrapper class for Customer. (ignore the implement class)

This is my server:

         JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
         sf.setServiceClass(CustomerService.class);
         sf.setAddress("http://localhost:8080/soap";);
         sf.getServiceFactory().setWrapped(false);
         sf.setServiceClass(CustomerServiceImpl.class);
         sf.create();

This is my client:

         JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
         factory.setAddress("http://localhost:8080/soap";);
         factory.setServiceClass(CustomerService.class);
         CustomerService service = (CustomerService) factory.create();
         service.getCustomers();

When I run the client, I got the following error:

WARNING: Interceptor for {
http://ws2.dgs.alu.com/}CustomerService#{http://ws2.dgs.alu.com/}getCustomershas
thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Unexpected wrapper element {
http://ws2.dgs.alu.com/}customers found.   Expected {
http://ws2.dgs.alu.com/}getCustomersResponse.

I noticed my server sent the following message back:

<soap:Envelope 
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";><soap:Body><ns2:customers
xmlns:ns2="http://ws2.dgs.alu.com/
"><customer><id>1</id><name>John</name></customer><customer><id>2</id><name>William</name></customer></ns2:customers></soap:Body></soap:Envelope>

It looks like everything is OK. When I
sf.getServiceFactory().setWrapped(true), this problem was solved, but I want
to custom the wrapper element with<customers>  not<getCustomersResponse>

Can anybody tell me how to handle this? I am really appreciated.

Thanks,
William

Reply via email to