Announcement Announcement Module
No announcement yet.
java.lang.UnsupportedOperationException when retrieving WS response Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • java.lang.UnsupportedOperationException when retrieving WS response


    I am using class WS WebServiceTemplate to call a remote WS end point.
    On the way back of the SOAP call, I come up with an UnsupportedOperationException in AbstractList#add. Here is the end of my stack trace:

    Caused by: java.lang.UnsupportedOperationException
    at java.util.AbstractList.add(
    at java.util.AbstractList.add(
    at org.springframework.xml.namespace.SimpleNamespaceC ontext.bindNamespaceUri(SimpleNamespaceContext.jav a:108)
    at .startPrefixMapping(
    at .handleStartElement(
    at .parseInternal(
    at er.parse(
    at er.parse(
    at formerImpl.transformIdentity( 637)
    at formerImpl.transform(
    ... 80 more

    The cause is pretty clear: method SimpleNamespaceContext#bindNamespaceUri(String prefix, String namespaceUri) contains the following line:
    getPrefixesInternal(namespaceUri).add(prefix); // line 108

    Method getPrefixesInternal(String namespaceUri) in turn contains the following:
    if (defaultNamespaceUri.equals(namespaceUri)) {
    return Collections.singletonList(XMLConstants.DEFAULT_NS_ PREFIX); // line 128

    Method Collections#singletonList returns an *** immutable *** list. Invoking add (in line 108) can only yield an UnsupportedOperationException.

    So I am really stuck. Does someone has any hint? Thanks in advance,


    PS. I use Spring-WS version 1.5.7.
    PPS. I attached the SOAP result.

  • #2
    Someone already raised a Jira issue for the same problem.


    • #3
      Thanks very much Tareq. I reverted to version 1.5.6 and my trouble disappeared.