You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Christopher Cheng <ch...@gmail.com> on 2008/10/18 20:03:00 UTC

wsdl location during runtime

By default, wsdl2java hardcoded wsdl location based on the local location
(e.g. c:\java\myproject\wsdl\SessionCreate.wsdl)

This does't work during runtime, therefore I packaged all wsdl and xsd file
in the jar file and change the wsdl location of generated code to current
thread like this:
url =
((java.net.URLClassLoader)Thread.currentThread().getContextClassLoader()).findResource("com/sabre/webservices/wsdl/SessionCreateRQ.wsdl");

However, cxf complains that it cannot find the other files referenced by
wsdl file even though the file is in the jar
java.lang.RuntimeException: java.lang.RuntimeException:
org.apache.ws.commons.schema.XmlSchemaException: Unable to locate imported
document at 'http://schemas.xmlsoap.org/soap/envelope/', relative to
'jar:file:/c:/java/myproject/web/WEB-INF/lib/myjar.jar!/com/sabre/webservices/wsdl/envelope.xsd'.

The only solution is to put those xsd files in the classpath (e.g
c:/java/myproject/web/WEB-INF/classes/) instead of jar file in
'c:/java/myproject/web/WEB-INF/lib'.

Obviously this is inconvenience. How could I solve this problem?

Re: wsdl location during runtime

Posted by jim ma <ma...@gmail.com>.
Use -wsdlLocation flag to specify the wsdlLocation annotation value :
wsdl2java.java -wsdlLocation SessionCreate.wsdl
c:\java\myproject\wsdl\SessionCreate.wsdl
Does this help ?

Jim.

On Sun, Oct 19, 2008 at 2:03 AM, Christopher Cheng <
christopher.sw.cheng@gmail.com> wrote:

> By default, wsdl2java hardcoded wsdl location based on the local location
> (e.g. c:\java\myproject\wsdl\SessionCreate.wsdl)
>
> This does't work during runtime, therefore I packaged all wsdl and xsd file
> in the jar file and change the wsdl location of generated code to current
> thread like this:
> url =
>
> ((java.net.URLClassLoader)Thread.currentThread().getContextClassLoader()).findResource("com/sabre/webservices/wsdl/SessionCreateRQ.wsdl");
>
> However, cxf complains that it cannot find the other files referenced by
> wsdl file even though the file is in the jar
> java.lang.RuntimeException: java.lang.RuntimeException:
> org.apache.ws.commons.schema.XmlSchemaException: Unable to locate imported
> document at 'http://schemas.xmlsoap.org/soap/envelope/', relative to
>
> 'jar:file:/c:/java/myproject/web/WEB-INF/lib/myjar.jar!/com/sabre/webservices/wsdl/envelope.xsd'.
>
> The only solution is to put those xsd files in the classpath (e.g
> c:/java/myproject/web/WEB-INF/classes/) instead of jar file in
> 'c:/java/myproject/web/WEB-INF/lib'.
>
> Obviously this is inconvenience. How could I solve this problem?
>