[Logo]
Forums Register Login
Cannot load WDSL?
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
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!
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
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!
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

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!
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
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!
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
Hi Mike,

I am facing a similar problem as yours. Did you get over it?Let me know the solution.
Me too facing the same problem, if somebody has the solution please update.
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
My first post since I found this friendly place around 2008

To load the WSDL, internally it uses the method getResource(string path) of the ClassLoader class (see http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/com/sun/xml/internal/ws/transport/http/server/EndpointImpl.java, method  getPrimaryWsdl, lines 265-278). So, an option is to include the WSDL file (let's say its name is ImageWebService.wsdl) inside the package, for example inside the package com.mycompany.imagewebservice. Then, on the annotation, write:

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

You can find more info about how ClassLoader works here: http://www.thinkplexx.com/learn/howto/java/system/java-resource-loading-explained-absolute-and-relative-names-difference-between-classloader-and-class-resource-loading
 

Guillermo Gutierrez wrote:My first post since I found this friendly place around 2008

To load the WSDL, internally it uses the method getResource(string path) of the ClassLoader class (see http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/com/sun/xml/internal/ws/transport/http/server/EndpointImpl.java, method  getPrimaryWsdl, lines 265-278). So, an option is to include the WSDL file (let's say its name is ImageWebService.wsdl) inside the package, for example inside the package com.mycompany.imagewebservice. Then, on the annotation, write:

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

You can find more info about how ClassLoader works here: http://www.thinkplexx.com/learn/howto/java/system/java-resource-loading-explained-absolute-and-relative-names-difference-between-classloader-and-class-resource-loading



As I mentioned, I solved the issue, but thanks for your reply.

-- mike
I've never won anything before. Not even a tiny ad:
ScroogeXHTML 7.1 - RTF to HTML5 / XHTML converter
https://coderanch.com/t/690611/ScroogeXHTML-RTF-HTML-XHTML-converter


This thread has been viewed 11410 times.

All times above are in ranch (not your local) time.
The current ranch time is
Feb 22, 2018 04:10:44.