开发者

Decouple WSDL from client's app

I have a java web service client consuming web services. The client is generated using WSDL2Java tool. All works fine until开发者_运维问答 the web service provider changes one of the schema objects by adding a non-required field. When the web service is called, the response is supposed to return an array of these schema objects and since the returned objects have an extra field - everything breaks. From what I understand there is a way to allow for such changes without breaking the client application.

Could you point me in the right direction on how to solve this? Any suggestion is appreciated. Thank you, Nadia


Try try using different binding options for your client. If I am not wrong using JAXBRI (od JiBX) should solve the issue. try WSDL2Java -d jaxbri The default is adb more info is in here


The web service is not conforming to the WSDL? Maybe you can edirt the WSDL and add the non-required field

Or is the WSDL changed? If the WSDL was changed you need to re-generate your code by WSDL2Java tool.


This problem is generally hard to solve, which is why client-facing XML schemas shouldn't change very often. You can try disabling schema validation, but if the schema changes too much, your client aplication will still blow up.

The recommended enterprisey way to do this (in the jargon: 'loose coupling') is to have a separate layer of domain objects and map between the generated Java classes and your domain objects. You just update the mappings when the schema changes, which shouldn't penetrate too far into the layers of your application. But you still need to recompile the application every time the schema changes.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜