I have a soap client call that invokes a remote service. Unfortunately the service provider is updating the service definition frequently and introduces new properties or changes the property order. Therefore I can no longer call it, the mapping of the response fails with:

ADBException: Unexpected subelement theID
Exception: org.apache.axis2.databinding.ADBException: Unexpected subelement theID
AxisFault: org.apache.axis2.databinding.ADBException: Unexpected subelement theID
BpmError: ivy:error:webservice:exception
RequestException: ivy:error:webservice:exception
Problem while processing request 'http://127.0.0.1:8081/ivy/pro/designer/finElcaUser/163B11CD193F9801/start.ivp'

I've also tried the new Webservice stack of Axon.ivy 7.1 based on CXF. But it fails with a similar issue:

UnmarshalException: unexpected element (uri:"", local:"theID"). Expected elements are <{}firstname>,<{}lastname>
    SAXParseException2: unexpected element (uri:"", local:"theID"). Expected elements are <{}firstname>,<{}lastname>
    javax.xml.bind.UnmarshalException
 - with linked exception:
[com.sun.istack.internal.SAXParseException2; lineNumber: 1; columnNumber: 218; unexpected element (uri:"", local:"theID"). Expected elements are <{}firstname>,<{}lastname>]
    Fault: Unmarshalling Error: unexpected element (uri:"", local:"theID"). Expected elements are <{}firstname>,<{}lastname> 
    Web Service Element: Call to http://localhost:8082/ivy/ws/designer/elcaMock/163B11ABE3388EE4 (Operation[name=getPersons,port=DocServicePort,parameters=[]]) failed!

Is there any way to read the response in a compliant way and ignore new properties introduced by the provider? the roundtrip is huge if I have to re-generate the client stack every-time when the provider makes changes.

asked 30.05 at 09:37

SupportIvyTeam's gravatar image

SupportIvyTeam ♦♦
1.1k6379101
accept rate: 76%

edited 30.05 at 10:02


CXF can easily ignore that exception

You can disable the schema validation as described here: http://mail-archives.apache.org/mod_mbox/cxf-users/201001.mbox/%3C201001291547.56047.dkulp@apache.org%3E

Within Axon.ivy 7.1 you just have to pack this property into a custom feature:

package com.axonivy;

import ch.ivyteam.ivy.webservice.exec.feature.WebServiceClientFeature;
import ch.ivyteam.ivy.webservice.exec.feature.WebServiceClientFeatureContext;

public class CompliantSchemaValidation implements WebServiceClientFeature {

    @Override
    public void initialize(WebServiceClientFeatureContext context) {
        context.getBindingProvider().getRequestContext()
            .put("set-jaxb-validation-event-handler",  "false");
    }

}

And then use in in your client configuration.... Then these unexpected subElement exceptions are gone. alt text

Another solution could be to set a specific event handler and only ignore these unexepted SubElement exceptions. But I didn't test it: http://whileonefork.blogspot.com/2010/11/cxf-backwards-compatibility-adding.html


AXIS2 needs dirty handwork

If you can not migrate to Axon.ivy 7.1 or newer you can also patch Axis2 client to ignore new properties.

  1. add AXiS2 dependencies to your project classpath
  2. introduce a new source folder (e.g. src_axis)
  3. add the contents of your webservice client jar (lib_ws/client/xyz.JAR) to your new source folder
  4. remove the original client jar from the classpath
  5. patch the factory classes of your beans. E.g. uncomment all occurences of AdbException with Unexpected subelement as message.

alt text

link

answered 30.05 at 09:38

Reguel%20Wermelinger's gravatar image

Reguel Werme... ♦♦
7.1k11344
accept rate: 70%

edited 30.05 at 10:03

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×7

Asked: 30.05 at 09:37

Seen: 145 times

Last updated: 30.05 at 10:03