Common JAXRPC error - unexpected element name

If you are using JAXRPC, there is an error message that may be hard to connect back to the root cause of the problem. The error message reads something like:
unexpected element name: expected=FileMetadata, actual={urn:FileUpload}FileMetadata.

There may be multiple causes for this error message. The first you want to look at is the flavor of XML schema advertized in the WSDL.

The default value for the elementFormDefault attribute is unqualified (see the w3c spec), which is what the error message above is trying to convey. In the schema section of your WSDL, make sure you can find the declaration: elementFormDefault="qualified"

Sometime, this get lost in the edits of the WSDL file, and many Web Services toolkits wont validate on the consumer side (Axis and .NET are among those). If you cannot alter the original WSDL, make a local copy that you can use to generate your artifacts, then contact the service provider so that they can make the change. The WS-I tools should be able to help you detect this kind of issues with minimal efforts.


Aashish Dalmia said…
Awesome suggestion. It worked. I just modified my schemas by adding "elementFormDefault="qualified" in tag and it worked.

You were right, the error was hard to relate with the solution of the problem especially with the error log that it gave. Anyways...

Thank you so much.

Popular posts from this blog

Changing the version of JDK used by JDeveloper

Connection reset from a WCF Web Service

Test locally first, then deploy to the cloud.