You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "Bc. Jiří Mikulášek" <ji...@aura.cz> on 2007/10/19 09:56:44 UTC

JAXB Bindings problem in runtime

Hi all,
I have used wsdl2java with external binding file specified through -b. My 
stubs for client have been generated correctly, but I got in trouble during 
runtime.

The point is, that have renamed response properties names. But it seems that 
cxf ignores jaxb annotations when handling the response wrapper.

More concretly

thanks to this part of external binding file:
 <jaxws:bindings 
node="wsdl:definitions/wsdl:types/xsd:schema[@targetNamespace='urn:sap-com:document:sap:soap:functions:mc-style']">
            
            <jaxb:bindings 
node="xsd:element[@name='ZBapiMaterialExistsMatnrResponse']/xsd:complexType/xsd:sequence/xsd:element[@name='MaterialFinnes']">
                <jaxb:property name="existMark" />
            </jaxb:bindings>
    
    </jaxws:bindings>

this code is generated:

 @XmlElement(name = "MaterialFinnes", required = true)
    protected String existMark;

public String getExistMark() {
        return existMark;
    }
   
    public void setExistMark(String value) {
        this.existMark = value;
    }

but when trying to use this client against some mockservice generated from the 
same wsdl I got:

Caused by: java.lang.NoSuchMethodException:
cz.aura.isl.katalog.davky.control.sapnorway.sapnumberlookup.SapNumberLookupResponse.getMaterialFinnes()
        at 
org.apache.cxf.jaxb.WrapperHelper.getWrappedPart(WrapperHelper.java:194)
        at
org.apache.cxf.jaxws.interceptors.WrapperClassInInterceptor.handleMessage(WrapperClassInInterceptor.java:136)
        ... 70 more

-- 
Jiri Mikulasek
---------------------------------
Developer

AURA, s.r.o.
Uvoz 499/56; 602 00 Brno
ISO 9001 certified company
AQAP 2110 (ČOS 051622)
tel./fax: +420 544 508 115
e-mail:  mikulasek@aura.cz
http://www.aura.cz
---------------------------------

Re: JAXB Bindings problem in runtime

Posted by "Bc. Jiří Mikulášek" <ji...@aura.cz>.
Hi, we have migrated to 2.0.2 version and problem seems to be solved. Thanks 
for help

On Friday 19 of October 2007 11:20:19 Jim Ma wrote:
> This issue is fixed in cxf 2.0.2 . You need to update cxf to 2.0.2 .
>
> Cheers
>
> Jim
>
> Bc. Jiří Mikulášek wrote:
> > Hi,
> > we are using cxf 2.0, we are using wsdl provided by SAP in Norway (and
> > because we don't speak Norwegian and whole application is developed in
> > english we have done this jaxws and jaxb binding customization).
> >
> > So, we are developing client side using cxf, soap binding is
> > document/literal wrapped. We are using soapui to mock the service side
> > (it is a tool which can import wsdl and simply mock the service). We are
> > logging from cxf both requests and response.
> >
> > Jaxb binding is customized both for request and response wrapper. While
> > generating request, everything is OK and problem is while handling
> > response.
> >
> > Our client is started by this code:
> > NoMilSapNumberLookupService service = new
> > NoMilSapNumberLookupService(wsdlUrl, serviceName);
> >         service.getZMMMATEXISTMATNRSoapBinding().existSapNumber(
> >                 ASKING_SYSTEM,
> >                 sapNumber,
> >                 status,
> >                 nsn,
> >                 description);
> >
> > shortened client stub:
> >
> > @WebServiceClient(name = "ZMM_MAT_EXIST_MATNRService", targetNamespace
> > = "urn:sap-com:document:sap:soap:functions:mc-style")
> > public class NoMilSapNumberLookupService extends Service {
> >
> > public NoMilSapNumberLookupService(URL wsdlLocation, QName serviceName) {
> >         super(wsdlLocation, serviceName);
> >     }
> > }
> >
> > see wsdl and binding customization in attachment.
> >
> > On Friday 19 of October 2007 09:58:20 Jim Ma wrote:
> >> Hi ,
> >> Could you tell me more information about this issue ?
> >> Which version CXF did you  use ?
> >> How did you start  and call this service ?
> >>
> >> Cheers
> >>
> >> Jim
> >>
> >> Bc. Jiří Mikulášek wrote:
> >>> Hi all,
> >>> I have used wsdl2java with external binding file specified through -b.
> >>> My stubs for client have been generated correctly, but I got in trouble
> >>> during runtime.
> >>>
> >>> The point is, that have renamed response properties names. But it seems
> >>> that cxf ignores jaxb annotations when handling the response wrapper.
> >>>
> >>> More concretly
> >>>
> >>> thanks to this part of external binding file:
> >>>  <jaxws:bindings
> >>> node="wsdl:definitions/wsdl:types/xsd:schema[@targetNamespace='urn:sap-
> >>>co m:document:sap:soap:functions:mc-style']">
> >>>
> >>>             <jaxb:bindings
> >>> node="xsd:element[@name='ZBapiMaterialExistsMatnrResponse']/xsd:complex
> >>>Ty pe/xsd:sequence/xsd:element[@name='MaterialFinnes']"> <jaxb:property
> >>> name="existMark" />
> >>>             </jaxb:bindings>
> >>>
> >>>     </jaxws:bindings>
> >>>
> >>> this code is generated:
> >>>
> >>>  @XmlElement(name = "MaterialFinnes", required = true)
> >>>     protected String existMark;
> >>>
> >>> public String getExistMark() {
> >>>         return existMark;
> >>>     }
> >>>
> >>>     public void setExistMark(String value) {
> >>>         this.existMark = value;
> >>>     }
> >>>
> >>> but when trying to use this client against some mockservice generated
> >>> from the same wsdl I got:
> >>>
> >>> Caused by: java.lang.NoSuchMethodException:
> >>> cz.aura.isl.katalog.davky.control.sapnorway.sapnumberlookup.SapNumberLo
> >>>ok upResponse.getMaterialFinnes() at
> >>> org.apache.cxf.jaxb.WrapperHelper.getWrappedPart(WrapperHelper.java:194
> >>>) at
> >>> org.apache.cxf.jaxws.interceptors.WrapperClassInInterceptor.handleMessa
> >>>ge (WrapperClassInInterceptor.java:136) ... 70 more



-- 
Jiri Mikulasek
---------------------------------
Developer

AURA, s.r.o.
Uvoz 499/56; 602 00 Brno
ISO 9001 certified company
AQAP 2110 (ČOS 051622)
tel./fax: +420 544 508 115
e-mail:  mikulasek@aura.cz
http://www.aura.cz
---------------------------------

Re: JAXB Bindings problem in runtime

Posted by Jim Ma <em...@iona.com>.
This issue is fixed in cxf 2.0.2 . You need to update cxf to 2.0.2 .

Cheers

Jim




Bc. Jiří Mikulášek wrote:
> Hi,
> we are using cxf 2.0, we are using wsdl provided by SAP in Norway (and because 
> we don't speak Norwegian and whole application is developed in english we 
> have done this jaxws and jaxb binding customization).
>
> So, we are developing client side using cxf, soap binding is document/literal 
> wrapped. We are using soapui to mock the service side (it is a tool which can 
> import wsdl and simply mock the service). We are logging from cxf both 
> requests and response.
>
> Jaxb binding is customized both for request and response wrapper. While 
> generating request, everything is OK and problem is while handling response.
>
> Our client is started by this code:
> NoMilSapNumberLookupService service = new NoMilSapNumberLookupService(wsdlUrl, 
> serviceName);
>         service.getZMMMATEXISTMATNRSoapBinding().existSapNumber(
>                 ASKING_SYSTEM, 
>                 sapNumber,
>                 status, 
>                 nsn, 
>                 description);
>
> shortened client stub:
>
> @WebServiceClient(name = "ZMM_MAT_EXIST_MATNRService", targetNamespace 
> = "urn:sap-com:document:sap:soap:functions:mc-style")
> public class NoMilSapNumberLookupService extends Service {
>
> public NoMilSapNumberLookupService(URL wsdlLocation, QName serviceName) {
>         super(wsdlLocation, serviceName);
>     }
> }
>
> see wsdl and binding customization in attachment.
>
> On Friday 19 of October 2007 09:58:20 Jim Ma wrote:
>   
>> Hi ,
>> Could you tell me more information about this issue ?
>> Which version CXF did you  use ?
>> How did you start  and call this service ?
>>
>> Cheers
>>
>> Jim
>>
>> Bc. Jiří Mikulášek wrote:
>>     
>>> Hi all,
>>> I have used wsdl2java with external binding file specified through -b. My
>>> stubs for client have been generated correctly, but I got in trouble
>>> during runtime.
>>>
>>> The point is, that have renamed response properties names. But it seems
>>> that cxf ignores jaxb annotations when handling the response wrapper.
>>>
>>> More concretly
>>>
>>> thanks to this part of external binding file:
>>>  <jaxws:bindings
>>> node="wsdl:definitions/wsdl:types/xsd:schema[@targetNamespace='urn:sap-co
>>> m:document:sap:soap:functions:mc-style']">
>>>
>>>             <jaxb:bindings
>>> node="xsd:element[@name='ZBapiMaterialExistsMatnrResponse']/xsd:complexTy
>>> pe/xsd:sequence/xsd:element[@name='MaterialFinnes']"> <jaxb:property
>>> name="existMark" />
>>>             </jaxb:bindings>
>>>
>>>     </jaxws:bindings>
>>>
>>> this code is generated:
>>>
>>>  @XmlElement(name = "MaterialFinnes", required = true)
>>>     protected String existMark;
>>>
>>> public String getExistMark() {
>>>         return existMark;
>>>     }
>>>
>>>     public void setExistMark(String value) {
>>>         this.existMark = value;
>>>     }
>>>
>>> but when trying to use this client against some mockservice generated
>>> from the same wsdl I got:
>>>
>>> Caused by: java.lang.NoSuchMethodException:
>>> cz.aura.isl.katalog.davky.control.sapnorway.sapnumberlookup.SapNumberLook
>>> upResponse.getMaterialFinnes() at
>>> org.apache.cxf.jaxb.WrapperHelper.getWrappedPart(WrapperHelper.java:194)
>>>         at
>>> org.apache.cxf.jaxws.interceptors.WrapperClassInInterceptor.handleMessage
>>> (WrapperClassInInterceptor.java:136) ... 70 more
>>>       
>
>
>
>   

Re: JAXB Bindings problem in runtime

Posted by "Bc. Jiří Mikulášek" <ji...@aura.cz>.
Hi,
we are using cxf 2.0, we are using wsdl provided by SAP in Norway (and because 
we don't speak Norwegian and whole application is developed in english we 
have done this jaxws and jaxb binding customization).

So, we are developing client side using cxf, soap binding is document/literal 
wrapped. We are using soapui to mock the service side (it is a tool which can 
import wsdl and simply mock the service). We are logging from cxf both 
requests and response.

Jaxb binding is customized both for request and response wrapper. While 
generating request, everything is OK and problem is while handling response.

Our client is started by this code:
NoMilSapNumberLookupService service = new NoMilSapNumberLookupService(wsdlUrl, 
serviceName);
        service.getZMMMATEXISTMATNRSoapBinding().existSapNumber(
                ASKING_SYSTEM, 
                sapNumber,
                status, 
                nsn, 
                description);

shortened client stub:

@WebServiceClient(name = "ZMM_MAT_EXIST_MATNRService", targetNamespace 
= "urn:sap-com:document:sap:soap:functions:mc-style")
public class NoMilSapNumberLookupService extends Service {

public NoMilSapNumberLookupService(URL wsdlLocation, QName serviceName) {
        super(wsdlLocation, serviceName);
    }
}

see wsdl and binding customization in attachment.

On Friday 19 of October 2007 09:58:20 Jim Ma wrote:
> Hi ,
> Could you tell me more information about this issue ?
> Which version CXF did you  use ?
> How did you start  and call this service ?
>
> Cheers
>
> Jim
>
> Bc. Jiří Mikulášek wrote:
> > Hi all,
> > I have used wsdl2java with external binding file specified through -b. My
> > stubs for client have been generated correctly, but I got in trouble
> > during runtime.
> >
> > The point is, that have renamed response properties names. But it seems
> > that cxf ignores jaxb annotations when handling the response wrapper.
> >
> > More concretly
> >
> > thanks to this part of external binding file:
> >  <jaxws:bindings
> > node="wsdl:definitions/wsdl:types/xsd:schema[@targetNamespace='urn:sap-co
> >m:document:sap:soap:functions:mc-style']">
> >
> >             <jaxb:bindings
> > node="xsd:element[@name='ZBapiMaterialExistsMatnrResponse']/xsd:complexTy
> >pe/xsd:sequence/xsd:element[@name='MaterialFinnes']"> <jaxb:property
> > name="existMark" />
> >             </jaxb:bindings>
> >
> >     </jaxws:bindings>
> >
> > this code is generated:
> >
> >  @XmlElement(name = "MaterialFinnes", required = true)
> >     protected String existMark;
> >
> > public String getExistMark() {
> >         return existMark;
> >     }
> >
> >     public void setExistMark(String value) {
> >         this.existMark = value;
> >     }
> >
> > but when trying to use this client against some mockservice generated
> > from the same wsdl I got:
> >
> > Caused by: java.lang.NoSuchMethodException:
> > cz.aura.isl.katalog.davky.control.sapnorway.sapnumberlookup.SapNumberLook
> >upResponse.getMaterialFinnes() at
> > org.apache.cxf.jaxb.WrapperHelper.getWrappedPart(WrapperHelper.java:194)
> >         at
> > org.apache.cxf.jaxws.interceptors.WrapperClassInInterceptor.handleMessage
> >(WrapperClassInInterceptor.java:136) ... 70 more



-- 
Jiri Mikulasek
---------------------------------
Developer

AURA, s.r.o.
Uvoz 499/56; 602 00 Brno
ISO 9001 certified company
AQAP 2110 (ČOS 051622)
tel./fax: +420 544 508 115
e-mail:  mikulasek@aura.cz
http://www.aura.cz
---------------------------------

Re: JAXB Bindings problem in runtime

Posted by Jim Ma <em...@iona.com>.
Hi ,
Could you tell me more information about this issue ?
Which version CXF did you  use ?
How did you start  and call this service ?

Cheers

Jim

Bc. Jiří Mikulášek wrote:
> Hi all,
> I have used wsdl2java with external binding file specified through -b. My 
> stubs for client have been generated correctly, but I got in trouble during 
> runtime.
>
> The point is, that have renamed response properties names. But it seems that 
> cxf ignores jaxb annotations when handling the response wrapper.
>
> More concretly
>
> thanks to this part of external binding file:
>  <jaxws:bindings 
> node="wsdl:definitions/wsdl:types/xsd:schema[@targetNamespace='urn:sap-com:document:sap:soap:functions:mc-style']">
>             
>             <jaxb:bindings 
> node="xsd:element[@name='ZBapiMaterialExistsMatnrResponse']/xsd:complexType/xsd:sequence/xsd:element[@name='MaterialFinnes']">
>                 <jaxb:property name="existMark" />
>             </jaxb:bindings>
>     
>     </jaxws:bindings>
>
> this code is generated:
>
>  @XmlElement(name = "MaterialFinnes", required = true)
>     protected String existMark;
>
> public String getExistMark() {
>         return existMark;
>     }
>    
>     public void setExistMark(String value) {
>         this.existMark = value;
>     }
>
> but when trying to use this client against some mockservice generated from the 
> same wsdl I got:
>
> Caused by: java.lang.NoSuchMethodException:
> cz.aura.isl.katalog.davky.control.sapnorway.sapnumberlookup.SapNumberLookupResponse.getMaterialFinnes()
>         at 
> org.apache.cxf.jaxb.WrapperHelper.getWrappedPart(WrapperHelper.java:194)
>         at
> org.apache.cxf.jaxws.interceptors.WrapperClassInInterceptor.handleMessage(WrapperClassInInterceptor.java:136)
>         ... 70 more
>
>   

Re: JAXB Bindings problem in runtime

Posted by James Mao <ja...@iona.com>.
Hi,

You have to make sure that the client side and server side is using the 
same SEI,
I'm not sure where's the stacetrace come from, client or server? 
probably the client
 From the stacktrace you gave looks like it still looking for the 
original method which you renamed in the jaxws binding at the wsdl2java 
phase?

I guess your client using wsdl first approach? at the runtime, it'll not 
load the binding file, that's why it's failed.

Like Jim said in another mail, you should try the latest stable version 
of cxf, And I also remember that it's been fixed.

Regards,
James

> Hi all,
> I have used wsdl2java with external binding file specified through -b. My 
> stubs for client have been generated correctly, but I got in trouble during 
> runtime.
>
> The point is, that have renamed response properties names. But it seems that 
> cxf ignores jaxb annotations when handling the response wrapper.
>
> More concretly
>
> thanks to this part of external binding file:
>  <jaxws:bindings 
> node="wsdl:definitions/wsdl:types/xsd:schema[@targetNamespace='urn:sap-com:document:sap:soap:functions:mc-style']">
>             
>             <jaxb:bindings 
> node="xsd:element[@name='ZBapiMaterialExistsMatnrResponse']/xsd:complexType/xsd:sequence/xsd:element[@name='MaterialFinnes']">
>                 <jaxb:property name="existMark" />
>             </jaxb:bindings>
>     
>     </jaxws:bindings>
>
> this code is generated:
>
>  @XmlElement(name = "MaterialFinnes", required = true)
>     protected String existMark;
>
> public String getExistMark() {
>         return existMark;
>     }
>    
>     public void setExistMark(String value) {
>         this.existMark = value;
>     }
>
> but when trying to use this client against some mockservice generated from the 
> same wsdl I got:
>
> Caused by: java.lang.NoSuchMethodException:
> cz.aura.isl.katalog.davky.control.sapnorway.sapnumberlookup.SapNumberLookupResponse.getMaterialFinnes()
>         at 
> org.apache.cxf.jaxb.WrapperHelper.getWrappedPart(WrapperHelper.java:194)
>         at
> org.apache.cxf.jaxws.interceptors.WrapperClassInInterceptor.handleMessage(WrapperClassInInterceptor.java:136)
>         ... 70 more
>
>