Discussion:
cxf-codegen-plugin/wsdl2java: relative paths in WSDL/XSD not resolved relative to the WSDL/XSD in which they are referenced
Driesen Gert
2012-08-18 10:39:39 UTC
Permalink
Hello,

I'm having the issue with the cxf-codegen-plugin and wsdl2java:

I'm attempting use CXF to generate the java (client) sources for a given WSDL (specified with absolute path).
In that WSDL I import another WSDL with a relative path (../SomeWSDL.wsdl).
I would expect CXF to resolve that imported WSDL relative to the importing WSDL, but apparently it is resolved relative to the current directory.
Hence the following error:

WSDLToJava Error: org.apache.cxf.wsdl11.WSDLRuntimeException: Fail to create wsdl definition from : file:/D:/RSVZ/GWYSecurity/Gateway/Implementation/GWYSecurity_Gateway_Services/target/generated-resources/GWYSecurity/GWYSecurity_V1.wsdl
Caused by : WSDLException (at /wsdl:definitions/wsdl:import): faultCode=PARSER_ERROR: Problem parsing '../Helper_V1.wsdl'.: java.io.FileNotFoundException: D:\RSVZ\GWYSecurity\Gateway\Implementation\Helper_V1.wsdl (The system cannot find the file specified)

where the current directory is "D:\RSVZ\GWYSecurity\Gateway\Implementation\GWYSecurity_Gateway_Services".

I need CXF to always resolve ANY imported WSDL or XSD to the importing WSDL/XSD.
Can I somehow configure the cxf-codegen-plugin for this to work ?
I'm not sure if this can be considered a bug in CXF.

Thanks!
Gert


This e-mail and all files transmitted as attachment(s) thereto are confidential and solely intended for the individual to whom or the organization to which they are addressed. If you received this e-mail by mistake, please notify Cegeka's Service Desk at cegeka.support-jh3bWXr3KnKzQB+***@public.gmane.org or call +32 (0)11 240 363. We thank you in advance. Cegeka hereby confirms that this message has been swept by Sophos for the presence of viruses.
Glen Mazza
2012-08-18 16:46:36 UTC
Permalink
Your request seems unusual--file-referencing in Java is usually done
from the current directory or the classpath root, not inherited from the
physical location of the file making that reference. Are you aware of
any other place in Java-ville that would reference files in the manner
you're requesting?

Glen
Post by Driesen Gert
Hello,
I'm attempting use CXF to generate the java (client) sources for a given WSDL (specified with absolute path).
In that WSDL I import another WSDL with a relative path (../SomeWSDL.wsdl).
I would expect CXF to resolve that imported WSDL relative to the importing WSDL, but apparently it is resolved relative to the current directory.
WSDLToJava Error: org.apache.cxf.wsdl11.WSDLRuntimeException: Fail to create wsdl definition from : file:/D:/RSVZ/GWYSecurity/Gateway/Implementation/GWYSecurity_Gateway_Services/target/generated-resources/GWYSecurity/GWYSecurity_V1.wsdl
Caused by : WSDLException (at /wsdl:definitions/wsdl:import): faultCode=PARSER_ERROR: Problem parsing '../Helper_V1.wsdl'.: java.io.FileNotFoundException: D:\RSVZ\GWYSecurity\Gateway\Implementation\Helper_V1.wsdl (The system cannot find the file specified)
where the current directory is "D:\RSVZ\GWYSecurity\Gateway\Implementation\GWYSecurity_Gateway_Services".
I need CXF to always resolve ANY imported WSDL or XSD to the importing WSDL/XSD.
Can I somehow configure the cxf-codegen-plugin for this to work ?
I'm not sure if this can be considered a bug in CXF.
Thanks!
Gert
Mark Streit
2012-08-18 19:34:50 UTC
Permalink
Did the WSDL/XSDs get generated with some IDE tool (wizard) before and then
you are using this Maven plugin to generate the proxy artifacts from them?
Just curious why there would be "hardened" physical paths like that.

As Glen indicates, one would normally never see absolute paths to a file
system in WSDL and XSDs - (unless someone purposely wrote the WSDL/XSD by
hand and that way could never really work).

As stated, these are usually RELATIVE on a classpath for packaged artifacts
like /META-INF/wsdl or /WEB-INF/wsdl --- this is a common pattern when
"localizing" the WSDL/XSDs with the generated artifacts.

Take a look at these threads:

http://cxf.547215.n5.nabble.com/WSDLException-faultCode-PARSER-ERROR-Connection-reset-td5711085.html#a5711241

http://cxf.547215.n5.nabble.com/WSDL-Service-Creation-Exception-td5711590.html

Perhaps they can help.
Your request seems unusual--file-referencing in Java is usually done from
the current directory or the classpath root, not inherited from the
physical location of the file making that reference. Are you aware of any
other place in Java-ville that would reference files in the manner you're
requesting?
Glen
Post by Driesen Gert
Hello,
I'm attempting use CXF to generate the java (client) sources for a given
WSDL (specified with absolute path).
In that WSDL I import another WSDL with a relative path
(../SomeWSDL.wsdl).
I would expect CXF to resolve that imported WSDL relative to the
importing WSDL, but apparently it is resolved relative to the current
directory.
WSDLToJava Error: org.apache.cxf.wsdl11.**WSDLRuntimeException: Fail to
create wsdl definition from : file:/D:/RSVZ/GWYSecurity/**
Gateway/Implementation/**GWYSecurity_Gateway_Services/**
target/generated-resources/**GWYSecurity/GWYSecurity_V1.**wsdl
java.io.FileNotFoundException: D:\RSVZ\GWYSecurity\Gateway\**Implementation\Helper_V1.wsdl
(The system cannot find the file specified)
where the current directory is "D:\RSVZ\GWYSecurity\Gateway\**
Implementation\GWYSecurity_**Gateway_Services".
I need CXF to always resolve ANY imported WSDL or XSD to the importing WSDL/XSD.
Can I somehow configure the cxf-codegen-plugin for this to work ?
I'm not sure if this can be considered a bug in CXF.
Thanks!
Gert
This e-mail and all files transmitted as attachment(s) thereto are
confidential and solely intended for the individual to whom or the
organization to which they are addressed. If you received this e-mail by
(0)11 240 363. We thank you in advance. Cegeka hereby confirms that this
message has been swept by Sophos for the presence of viruses.
--
Mark
***
*
Daniel Kulp
2012-08-21 17:18:37 UTC
Permalink
In theory, this should be working fine providing the URL's passed into wsdl2java are proper. If it's not working, please log a bug with a test case.

That said, also make sure you are using the latest CXF. Could be a bug that's already been fixed.

Dan
Post by Driesen Gert
Hello,
I'm attempting use CXF to generate the java (client) sources for a given WSDL (specified with absolute path).
In that WSDL I import another WSDL with a relative path (../SomeWSDL.wsdl).
I would expect CXF to resolve that imported WSDL relative to the importing WSDL, but apparently it is resolved relative to the current directory.
WSDLToJava Error: org.apache.cxf.wsdl11.WSDLRuntimeException: Fail to create wsdl definition from : file:/D:/RSVZ/GWYSecurity/Gateway/Implementation/GWYSecurity_Gateway_Services/target/generated-resources/GWYSecurity/GWYSecurity_V1.wsdl
Caused by : WSDLException (at /wsdl:definitions/wsdl:import): faultCode=PARSER_ERROR: Problem parsing '../Helper_V1.wsdl'.: java.io.FileNotFoundException: D:\RSVZ\GWYSecurity\Gateway\Implementation\Helper_V1.wsdl (The system cannot find the file specified)
where the current directory is "D:\RSVZ\GWYSecurity\Gateway\Implementation\GWYSecurity_Gateway_Services".
I need CXF to always resolve ANY imported WSDL or XSD to the importing WSDL/XSD.
Can I somehow configure the cxf-codegen-plugin for this to work ?
I'm not sure if this can be considered a bug in CXF.
Thanks!
Gert
--
Daniel Kulp
dkulp-1oDqGaOF3Lkdnm+***@public.gmane.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com
Driesen Gert
2012-08-21 17:34:53 UTC
Permalink
Hello Dan (and everyone else that responsed),

After performing a clean, I can no longer reproduce the issue.
Sorry for the false alert :p

I'm still using 2.5.4 because of a blocking issue in 2.6.1where the TrustManagers - that I set using TLSClientParameters on the HTTPConduit - are ignored.
Let me dig a little deeper -and try 2.6.2 - before I report this issue.

Thanks,
Gert
________________________________________
From: Daniel Kulp [dkulp-1oDqGaOF3Lkdnm+***@public.gmane.org]
Sent: Tuesday, August 21, 2012 7:18 PM
To: users-qJ/***@public.gmane.org
Subject: Re: cxf-codegen-plugin/wsdl2java: relative paths in WSDL/XSD not resolved relative to the WSDL/XSD in which they are referenced

In theory, this should be working fine providing the URL's passed into wsdl2java are proper. If it's not working, please log a bug with a test case.

That said, also make sure you are using the latest CXF. Could be a bug that's already been fixed.

Dan
Post by Driesen Gert
Hello,
I'm attempting use CXF to generate the java (client) sources for a given WSDL (specified with absolute path).
In that WSDL I import another WSDL with a relative path (../SomeWSDL.wsdl).
I would expect CXF to resolve that imported WSDL relative to the importing WSDL, but apparently it is resolved relative to the current directory.
WSDLToJava Error: org.apache.cxf.wsdl11.WSDLRuntimeException: Fail to create wsdl definition from : file:/D:/RSVZ/GWYSecurity/Gateway/Implementation/GWYSecurity_Gateway_Services/target/generated-resources/GWYSecurity/GWYSecurity_V1.wsdl
Caused by : WSDLException (at /wsdl:definitions/wsdl:import): faultCode=PARSER_ERROR: Problem parsing '../Helper_V1.wsdl'.: java.io.FileNotFoundException: D:\RSVZ\GWYSecurity\Gateway\Implementation\Helper_V1.wsdl (The system cannot find the file specified)
where the current directory is "D:\RSVZ\GWYSecurity\Gateway\Implementation\GWYSecurity_Gateway_Services".
I need CXF to always resolve ANY imported WSDL or XSD to the importing WSDL/XSD.
Can I somehow configure the cxf-codegen-plugin for this to work ?
I'm not sure if this can be considered a bug in CXF.
Thanks!
Gert
--
Daniel Kulp
dkulp-1oDqGaOF3Lkdnm+***@public.gmane.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com

Loading...