You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by william he <wi...@gmail.com> on 2010/06/11 13:03:44 UTC

Unexpected wrapper element

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

Re: Unexpected wrapper element

Posted by william he <wi...@gmail.com>.
Henry,

Thanks a lot. Look forwarding to your good news.

On Fri, Jun 11, 2010 at 7:31 PM, Henry Lu <zh...@umich.edu> wrote:

> 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<http://ws2.dgs.alu.com/%7DCustomerService#%7Bhttp://ws2.dgs.alu.com/%7DgetCustomershas>
>> thrown exception, unwinding now
>> org.apache.cxf.interceptor.Fault: Unexpected wrapper element found.
>> Expected
>>
>>
>> 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
>>
>>
>>
>

Re: Unexpected wrapper element

Posted by Henry Lu <zh...@umich.edu>.
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
>
>