Invalid WSDL - and the answer is ...

I forgot to provide the answer on last quizz about invalid WSDL, and XML tips.

The WSDL in question: http://www.rajkovic.org/ws/wsdl/bads/annotatedBank2.wsdl

The issue: by mistake, I did reuse the same prefix for two namespace. The tns prefix is associated with 'http://ws.rajkovic.org/demo/annotatedBank'
at the global scope (wsdl:definitions) and reused with 'http://ws.rajkovic.org/demo/annotatedBank/types'
at the schema scope (xsd:schema element).

In the wsdl:part, element="tns:create-account" references an element named {http://ws.rajkovic.org/demo/annotatedBank}create-account, which is not found. Based on the schema's targetNamespace, the QName (qualified name) of the element is {http://ws.rajkovic.org/demo/annotatedBank/types}create-account.

There are two ways to fix this error:
  1. Uses the same targetNamespace URI (and tns prefix) for both WSDL and Schema elements. Keep It Simple as much as possible.
  2. Introduce a new prefixe in your wsdl:definition element (xmlns:types="http://ws.rajkovic.org/demo/annotatedBank/types") and uses the newly introduced prefixe to reference elements defined in your schema (element="types:create-account"). It's not a bad idea to avoid reusing the same prefix with different URI in a single document. That way, you will avoid this pitfall.
Remember: Keep It Simple, Stupid.

Here is today's WSDL: http://www.rajkovic.org/ws/wsdl/bads/kiss-20070104.wsdl. Can you spot the mistake?

I agree, it's getting a little more involved.

Have fun,

You can always get back to your favorite sudoku du jour.

Comments

Gerard Davison said…
Hi,

Although JDeveloper will happily generate me a webservice based on this document; but I think that the messgae part should reference a "element" rather than a "type" in the case of document/literal.

The WS-I analyzer would pick up this issue. Might be worth raising a bug so we can flag this in the code editor.

Gerard
Eric said…
Gerard,

You got this one right. I'll have to try using WS-I tool and see what error message we do get.

I'll have to see what we get on the server side with top-down assemble.

More next week...

Ecco

Popular posts from this blog

Changing the version of JDK used by JDeveloper

Connection reset from a WCF Web Service

unexpected null value for literal data