[ 
https://issues.apache.org/jira/browse/CXF-3346?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12997288#comment-12997288
 ] 

Freeman Fang commented on CXF-3346:
-----------------------------------

Hi,

Cxf use thirdparty lib wsdl4j to parse the wsdl files.
In your case, you use
<include schemaLocation=""/>
then wsdl4j will try to read a file from the wsdl base url + relative 
schemaLoction here.
For example if I run wsdl2java from /Users/ffang/apache-cxf-2.3.2-SNAPSHOT/bin/ 
where the wsdl have a include like
<include schemaLocation=""/>
then the wsdl base url + relative schemaLoction is
/Users/ffang/apache-cxf-2.3.2-SNAPSHOT/bin/
You can see this is a valid filepath(a folder), so wsdl4j can open it, but of 
course the content is not a expected valid xsd, so you see 
[Fatal Error] :1:1: Content is not allowed in prolog.
it complain that the content is invalid, but the path here is correct.
It's totally from wsdl4j and cxf can't control over it.
Besides the 
[Fatal Error] :1:1: Content is not allowed in prolog.
You also should see 
WSDLToJava Error: org.apache.cxf.wsdl11.WSDLRuntimeException: Fail to create 
wsdl definition from : 
file:/Users/ffang/apache-cxf-2.3.2-SNAPSHOT/bin/hello_world.wsdl
Caused by : WSDLException (at /wsdl:definitions/wsdl:types/schema[1]): 
faultCode=PARSER_ERROR: Problem parsing 
'file:/Users/ffang/apache-cxf-2.3.2-SNAPSHOT/bin/'.: 
org.xml.sax.SAXParseException: Content is not allowed in prolog. 
which point out the issue is parsing 
file:/Users/ffang/apache-cxf-2.3.2-SNAPSHOT/bin/, which is a valid file path, 
but the content isn't expected xsd.


On the other hand, if your schemaLocation is invalid path, something like a 
non-exist a.xsd, you will get FileNotFoundException

Caused by : WSDLException (at /wsdl:definitions/wsdl:types/schema[1]): 
faultCode=PARSER_ERROR: Problem parsing 'a.xsd'.: 
java.io.FileNotFoundException: /Users/ffang/apache-cxf-2.3.2-SNAPSHOT/bin/a.xsd 
(No such file or directory) 

As a summary, those are expected behavior from wsdl4j, and cxf can't control 
over it.

Freeman




> Wrong Error Message 'Content is not allowed in prolog' On Empty Schema 
> Includes
> -------------------------------------------------------------------------------
>
>                 Key: CXF-3346
>                 URL: https://issues.apache.org/jira/browse/CXF-3346
>             Project: CXF
>          Issue Type: Bug
>          Components: Tooling
>    Affects Versions: 2.3.0
>         Environment: Linux Ubuntu 10.04, JDK 1.6.0_20
>            Reporter: Robert Lalyko
>            Assignee: Freeman Fang
>            Priority: Minor
>
> Using wsdl2java there is the irritating error message 'Content is not allowed 
> in prolog' depending on an empty schema include: <include schemaLocation=""/>
> It might be better to throw a file/url not found exception.
> Hint:
> There is no schema validation error in ecplise 3.6.
> Also soapUi has no problem to load the wsdl.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to