jBoss 7 – Web service client – popular exception “definitions”

In the process of migrating some J2EE Applications from Weblogic to jBoss 7 I’ve been found several issues that puts the popular java statement “Write once run everywhere” in cause. I will not start here any discussion about this, if the cause its j2ee, jboss, weblogic, axis, although you are free to do it so, and I will have arguments pro and con, but it was not so smooth as I was expecting it to be.

One of the last errors that toke me some time to figure it out, and I found the solution by intuition trial and error was when I had to generate a web service client for a jBoss j2ee appilcation that works great in weblogic but in jboss throws the following error when calling a web service:

… several stack trace lines but the main one:

… at some point in the stack trace

Caused by: javax.wsdl.WSDLException: WSDLException (at /html): faultCode=INVALID_WSDL: Expected element ‘{http://schemas.xmlsoap.org/wsdl/}definitions’.

So, I’ve tried every possible solution, from generating different kinds of web service clients, using Axis, jboss, CFX, to changing Jaxb versions on eclipse facets to 2.0, 2.1, 2.2.

About the solution:

In the construction of the web service call

MyWebService_Service service1 = MyWebService_Service(new URL(wsdl));
MyWebService port1 = service1.getMyWebServicePort();


In Weblogic a possible URL could be passed on the web service class constructor as :

– “

But In jBoss, the URL must use the “?wsdl” at the end of the url! like this:

– “


I dont know why, maybe when I have time I can discover the reason, but for know it was the solution I’ve found for this kind of exception that apparently its a popular problem around forums.

Hope my solution can help you anyway, or if you find another reason for this exception, be my guest to put it on the comments area!