Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Cannot load WDSL?  RSS feed

 
Mike London
Ranch Hand
Posts: 1441
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This should be a simple problem to fix, but I can't seem to figure it out.

I have a JAX-WS web service defined like this:

@WebService(serviceName = "ImageWebService",
wsdlLocation="net/mycompany/imagewebservice/ImageWebService.wsdl")

However, regardless of the path I "try" for the wsdlLocation (I've tried a full path, just the wsdl file name, and other variations), I get the error below.

Exception in thread "main" com.sun.xml.ws.server.ServerRtException: [failed to localize] cannot.load.wsdl(net/mycompany/imagewebservice/ImageWebService.wsdl)

Here's the way I'm publishing the service:



Why can't the program load the referenced wsdl?

Thanks.

-- Mike
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
When I have developed JAX-WS web services with an existing WSDL, I have put it in the WEB-INF/wsdl director in the project, which then has been deployed as a WAR to the container.
In the @WebService annotation I just supply the name of the WSDL and no path information.
Hope this helps & best wishes!
 
Mike London
Ranch Hand
Posts: 1441
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmm, interesting.

In this case, the project isn't really "deployed" to Tomcat (yet). It's being published to http://localhost:9876.

You may be on to something though since no matter what path I use, it can't seem to find it.

However, there's no "server" path as of yet so I'm still confused by this...

Any additional thoughts?

Thanks.

Mike
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
Check the API documentation for the @WebService annotation, it says:
The wsdlLocation is a URL (relative or absolute) that refers to a pre-existing WSDL file.

Thus, try rewriting the value of the wsdlLocation attribute in the @WebService annotation as a URL and you should be good to go!
Note that there are URLs (well, perhaps it is only a URI) starting with file:// - I haven't used those under circumstances like these, but you can try.
Best wishes!
 
Mike London
Ranch Hand
Posts: 1441
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ivan,

The reason I want to use a project-relative wsd (that is, a relative path), and not a URI , is that I want to use a modified project-based wsdl.

This is the approach taken in the new O' Reiley book: "Java Web Services, Up and Running".

Perhaps I didn't understand what you were getting at?

Please clarify.

Thanks.

-- Mike

 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
Well, then you just do what I recommended in an earlier post, with the WSDL in the WEB-INF/wsdl directory and the wsdlLocation in the @WebService annotation.
I guess you have to deploy the web service into a real container, that is you cannot use the Endpoint class. At least I haven't tried doing things like this with the Endpoint class - there may be some way that I do not know about.
Please note that the API says that the URL in the wsdlLocation can be relative. Again, I suspect a real container would make things easier.

I would personally recommend GlassFish for web service deployment - easy to work with and has a built-in web service test tool.
Best wishes!
 
Mike London
Ranch Hand
Posts: 1441
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I understand what you're saying except that the book Java Web Services, Up And Running uses a relative project path like I'm trying to do. The book isn't using a real container either. I'll keep investigating...

Say, how do you actually debug a web service (set breakpoints and such)?

Thanks again.

Mike
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi again!
You are fast!

Sorry, I haven't read the Java Web Service Up and Running except for a few glances.
Please do share any findings you make regarding this subject!

Concerning debugging of webservices:
There is usually integration between containers and IDEs - for instance, Eclipse and Tomcat, that will set breakpoints in the code executing in the container and, when a breakpoint is hit, transfer control to the IDE. You may need to install some plugin to get this kind of integration, depending on which IDE you use.
Best wishes!
 
Mike London
Ranch Hand
Posts: 1441
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks!

I'll update this thread (if I can still find it <g>) once I resolve the wsdl issue.

I'm debating between MyEclipse and Intellij IDEA, but the MyEclipse web services explorer is really nice and it seems to have better thought out tools. Just my two cents.

MyEclipse has some problems on the Mac side with Snow Leopard (specifically with the JVM 1.6), so I'm using Intellij on the Mac side.

Thanks again.

Mike
 
Nisheeth Goyal
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mike,

I am facing a similar problem as yours. Did you get over it?Let me know the solution.
 
Prashant Bisht
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Me too facing the same problem, if somebody has the solution please update.
 
Mike London
Ranch Hand
Posts: 1441
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I resolved getting to the properties file by putting the properties file in the same directory as my source files (that is, in the actual package).

Then, use the getResourceAsStream to load it, like this:

private transient final ClassLoader loader =
Thread.currentThread().getContextClassLoader();
.
.
.
final InputStream inputStream = loader
.getResourceAsStream("com/somedomain/filename.properties");

Hope this helps!

-- Mike
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!