views:

278

answers:

1

I am using CXF(which autogenerates my webservices in my pom.xml from my wsdl) with JBoss(eclipse ide), and I am having some trouble accessing the webservice from my web application. I found this resource: http://blog.progs.be/?p=92 but I am having a really hard time using WSDL_LOCATION = cl.getResource( "my/progam/pack/wsdl/myService.wsdl" ); to work properly in my code.

I have my wsdls located in src/main/wsdl and have added the following line to the .classpath file: classpathentry kind="src" path="src/main/wsdl"

I also created the folders my,program,pack,wsdl and dropped my wsdls into that location, so it is accessible.

However, the classloader.getResource call always returns null no matter what.

When I specify getResource( "/wsdl/myService.wsdl" ) it does not return null, but I believe it looks at the full file path and not what I need (considering part of the URL contains the path to the wsdl file all the way through the jboss server directory and includes the WEB-INF dir.

Is my .classpath file set up incorrectly or am I missing something else?

if the WSDL Location is not correct it always throws a ClassCast Exception like so:

java.lang.ClassCastException: org.apache.cxf.jaxws.ServiceImpl at javax.xml.ws.Service.(Service.java:81)

A: 

I have my wsdls located in src/main/wsdl (...)

In order to get theses files on the class path, you need to declare the directory as resource in your POM:

<project>
  ...
  <build>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
      </resource>
      <resource>
        <directory>src/main/wsdl</directory>
      </resource>
    </resources>
    ...
  </build>
</project>

And now your WSDLs should end up under the classes directory.

Pascal Thivent
The webapp is the client. I am trying to use classpath instead of absolute paths, it just is not working.
JohnC
@JohnC See my update. If you don't have this in your pom.xml, please try again.
Pascal Thivent
this worked, thanks, now for my classloader problem.
JohnC