[prev in list] [next in list] [prev in thread] [next in thread] 

List:       axis-dev
Subject:    [jira] [Comment Edited] (AXIS2-5899) wsdl2java/xmlbeans issue on *nix
From:       "Mickael Pouliquen (JIRA)" <jira () apache ! org>
Date:       2017-11-16 15:42:00
Message-ID: JIRA.13118867.1510828665000.256993.1510846920138 () Atlassian ! JIRA
[Download RAW message or body]


    [ https://issues.apache.org/jira/browse/AXIS2-5899?page=com.atlassian.jira.plugin. \
system.issuetabpanels:comment-tabpanel&focusedCommentId=16255493#comment-16255493 ] 

Mickael Pouliquen edited comment on AXIS2-5899 at 11/16/17 3:41 PM:
--------------------------------------------------------------------

Hello Robert,
The issue happens only with complex wsdl files (with reference to schemas containing \
"redefine" elements). I have not yet isolated a simple test case wsdl that I could \
attach to the issue.

When the external xmlbeans jar lookup for a schema using the axis2-xmlbeans \
CodeGenerationUtility, axis2-xmlbeans first try to load the schema from disk using \
the getFileFromURI method. if the file can not be load from disk, axis2-xmlbeans \
re-serialize the schema from an in-memory tree that was previously loaded by \
axis2-codegen.

If this schema deserialization -> re-serialisation works well, the getFileFromURI \
issue is not visible to the user. But in my case (on *nix platforms) it seems that \
                some information is changed:
- axis2-1.4.1 : xmlbeans complains some definitions are missing;
- axis2-1.7.6 : xmlbeans complains about multiple-definitions.

With a getFileFromURI fix, Windows and *nix execution path would be consistent.
And my problem solved :-).




was (Author: mpo22):
Hello Robert,
The issue happens only with complex wsdl files (with reference to schemas containing \
"redefine" elements). I have not yet isolated a simple test case wsdl that I could \
attach to the issue.

When the external xmlbeans jar lookup for a schema using the axis2-xmlbeans \
CodeGenerationUtility, axis2-xmlbeans first try to load the schema from disk using \
the getFileFromURI method. if the file can not be load from disk, axis2-xmlbeans \
re-serialize the schema from an in-memory tree that was previously loaded by \
axis2-codegen.

If this schema deserialization -> re-serialisation work's well, the getFileFromURI \
issue is not visible to the user. But in my case (on *nix platforms) it seems that \
                some information is changed:
- axis2-1.4.1 : xmlbeans complains some definitions are missing;
- axis2-1.7.6 : xmlbeans complains about multiple-definitions.

With a getFileFromURI fix, Windows and *nix execution path would be consistent.
And my problem solved :-).



> wsdl2java/xmlbeans issue on *nix
> --------------------------------
> 
> Key: AXIS2-5899
> URL: https://issues.apache.org/jira/browse/AXIS2-5899
> Project: Axis2
> Issue Type: Bug
> Components: codegen
> Affects Versions: 1.4.1, 1.7.6
> Environment: linux (debian/redhat)
> all axis2 versions impacted
> Reporter: Mickael Pouliquen
> 
> The wsdl2java command with xmlbeans code generation applied to a complex wsdl with \
> schemas redefinitions FAILS on LINUX os but NOT on WINDOWS os: wsdl2java.sh -o out \
>                 -d xmlbeans -or -noBuildXML -uri sample.wsdl
> ... error on *nix platforms only
> The issue was initially produced on axis2-1.4.1, reproduced on latest version \
> axis2-1.7.6 This platform specific issue comes from the method 'getFileFromURI' in \
> "./modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java": the \
> method remove the prefix of the url/uri-like path param. It works on windows, but \
> on unix it removes the root slash. private File getFileFromURI(String path) {
> if(path.startsWith("file:///")){
> path = path.substring(8);
> } else if(path.startsWith("file://")){
> path = path.substring(7);
> } else if(path.startsWith("file:/")){
> path = path.substring(6);
> }
> return new File(path);
> }
> Exemple,
> 'file:/drive:/dir1/dir2/file1' becomes 'drive:/dir1/dir2/file1' => OK
> 'file:/dir1/dir2/file1' becomes 'dir1/dir2/file1' => KO
> A fix could be:
> private File getFileFromURI(String path) {
> //on windows, will remove the 'file:' prefix and ALL slashes
> //on unix, will remove the 'file:' prefix and keep the ROOT slash
> int offset = "/".equals(File.separator) ? 1 : 0; 
> if(path.startsWith("file:///")){
> path = path.substring(8-offset);
> } else if(path.startsWith("file://")){
> path = path.substring(7-offset);
> } else if(path.startsWith("file:/")){
> path = path.substring(6-offset);
> }
> return new File(path);
> }



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic