[
https://issues.apache.org/jira/browse/CXF-3095?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12966587#action_12966587
]
Jason Mihalick edited comment on CXF-3095 at 12/3/10 12:13 PM:
---------------------------------------------------------------
I am having a similar problem to this. I have the WSDL (pertinent portions
included below), which I initially generated using CXF tools, but have modified
to make it more modular. The WSDL has several imports to import schemas from
the root of my webapp. The WSDL validates fine using oXygen WSDL validation
tools. My service works just fine as well so long as I do not turn on
validation. Under CXF 2.2.6 I was unable to get validation to turn on using
the jaxws property {{schema-validation-enabled}}, so I upgraded to CXF 2.3.0 to
see if the {...@schemavalidation}} annotation would work. It did! However, I
immediately starting getting Xerces {{SaxParseExceptions}} (also included
below) which said it could not find the declaration of elements and that it
could not resolve some names. I then discovered the {{<jaxws:schemaLocation>}}
configuration and added my schemas. It made no difference. I set a breakpoint
on {{com.sun.org.apache.xerces.internal.jaxp.XMLSchemaFactory}} (line 210,
{{fXMLSchemaLoader.loadGrammar(xmlInputSources);}}) and noticed that the WSDL
is the only file resource being supplied to the SchemaLoader. What other
things can I try? Is this the same problem? I tried downgrading to CXF 2.2.9
and I'm back to my original problem under 2.2.6, which is that I am unable to
get validation to turn on using the {{schema-validation-enabled}}.
\\
\\
{code:xml|title=WSDL}
<wsdl:definitions
name="EvaluatorService"
targetNamespace="http://my.company.org/wsdl/jca/EvaluatorService"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://my.company.org/wsdl/jca/EvaluatorService"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:ereq="http://my.company.org/wsdl/jca/EvaluatorService"
xmlns:eresp="http://my.company.org/wsdl/jca/EvaluatorService"
>
<xs:import namespace="http://my.company.org/wsdl/jca/EvaluatorService"
schemaLocation="EvaluatorRequest.xsd"/>
<xs:import namespace="http://my.company.org/wsdl/jca/EvaluatorService"
schemaLocation="EvaluatorResponse.xsd"/>
<!--
**************************************************************************
WSDL Types
************************************************************************** -->
<wsdl:types>
<xs:schema elementFormDefault="qualified"
targetNamespace="http://my.company.org/wsdl/jca/EvaluatorService"
version="1.0">
<xs:element name="evaluate">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" ref="ereq:eval-request"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="eval-response" type="tns:eval-response"/>
<xs:complexType name="eval-response">
<xs:sequence>
<xs:element minOccurs="0" ref="eresp:document-eval-result"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
8<--------------- snip 8< -----------------------
{code}
{code:title=EvaluatorServiceImpl.java}
8<--------------- snip 8< -----------------------
@WebService(
endpointInterface = "org.my.company.jca.evaluator.service.EvaluatorService",
targetNamespace = "http://my.company.org/wsdl/jca/EvaluatorService",
wsdlLocation = "EvaluatorService.wsdl"
)
@SchemaValidation(enabled=true)
8<--------------- snip 8< -----------------------
{code}
{code:xml|title=Spring Configuration}
8<--------------- snip 8< -----------------------
<!--
**************************************************************************
JAX-WS web services, provided via Apache CXF
************************************************************************** -->
<bean id="evaluatorServiceImpl"
class="org.my.company.jca.evaluator.service.EvaluatorServiceImpl"/>
<!-- Webservice endpoint configuration -->
<jaxws:endpoint
id="evaluator"
implementor="#evaluatorServiceImpl"
address="/evaluatorService"
xmlns:s="http://my.company.org/wsdl/jca/EvaluatorService"
serviceName="s:EvaluatorService"
wsdlLocation="EvaluatorService.wsdl" >
<jaxws:schemaLocations>
<jaxws:schemaLocation>classpath:EvaluatorRequest.xsd</jaxws:schemaLocation>
<jaxws:schemaLocation>classpath:EvaluatorDocument.xsd</jaxws:schemaLocation>
<jaxws:schemaLocation>classpath:EvaluatorResponse.xsd</jaxws:schemaLocation>
<jaxws:schemaLocation>classpath:EvaluatorTypes.xsd</jaxws:schemaLocation>
</jaxws:schemaLocations>
<jaxws:features>
<bean class="org.apache.cxf.feature.LoggingFeature"/>
</jaxws:features>
<jaxws:properties>
<entry key="schema-validation-enabled" value="true" />
</jaxws:properties>
</jaxws:endpoint>
8<--------------- snip 8< -----------------------
{code}
{code:title=Exceptions}
WARNING: SAXException for newSchema()
org.xml.sax.SAXParseException: src-resolve: Cannot resolve the name
'ereq:eval-request' to a(n) 'element declaration' component.
WARNING: Interceptor for
{http://my.company.org/wsdl/jca/EvaluatorService}EvaluatorService#{http://my.company.org/wsdl/jca/EvaluatorService}evaluate
has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Marshalling Error: cvc-elt.1: Cannot find the
declaration of element 'ns2:eval-response'.
{code}
was (Author: jrmihalick):
I am having a similar problem to this. I have the WSDL (pertinent portions
included below), which I initially generated using CXF tools, but have modified
to make it more modular. The WSDL has several imports to import schemas from
the root of my webapp. The WSDL validates fine using oXygen WSDL validation
tools. My service works just fine as well so long as I do not turn on
validation. Under CXF 2.2.6 I was unable to get validation to turn on using
the jaxws property {{schema-validation-enabled}}, so I upgraded to CXF 2.3.0 to
see if the {...@schemavalidation}} annotation would work. It did! However, I
immediately starting getting Xerces {{SaxParseExceptions}} (also included
below) which said it could not find the declaration of elements and that it
could not resolve some names. I then discovered the {{<jaxws:schemaLocation>}}
configuration and added my schemas. It made no difference. I set a breakpoint
on {{com.sun.org.apache.xerces.internal.jaxp.XMLSchemaFactory}} (line 210,
{{fXMLSchemaLoader.loadGrammar(xmlInputSources);}}) and noticed that the WSDL
is the only file resource being supplied to the SchemaLoader. What other
things can I try? Is this the same problem? I tried downgrading to CXF 2.2.9
and I'm back to my original problem under 2.2.6, which is that I am unable to
get validation to turn on using the {{schema-validation-enabled}}.
\\
\\
{code:xml|title=WSDL}
<wsdl:definitions
name="EvaluatorService"
targetNamespace="http://my.company.org/wsdl/jca/EvaluatorService"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://my.company.org/wsdl/jca/EvaluatorService"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:ereq="http://my.company.org/wsdl/jca/EvaluatorService"
xmlns:eresp="http://my.company.org/wsdl/jca/EvaluatorService"
>
<xs:import namespace="http://my.company.org/wsdl/jca/EvaluatorService"
schemaLocation="EvaluatorRequest.xsd"/>
<xs:import namespace="http://my.company.org/wsdl/jca/EvaluatorService"
schemaLocation="EvaluatorResponse.xsd"/>
<!--
**************************************************************************
WSDL Types
************************************************************************** -->
<wsdl:types>
<xs:schema elementFormDefault="qualified"
targetNamespace="http://my.company.org/wsdl/jca/EvaluatorService"
version="1.0">
<xs:element name="evaluate">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" ref="ereq:eval-request"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="eval-response" type="tns:eval-response"/>
<xs:complexType name="eval-response">
<xs:sequence>
<xs:element minOccurs="0" ref="eresp:document-eval-result"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
8<--------------- snip 8< -----------------------
{code}
{code:title=MyServiceImpl.java}
@WebService(
endpointInterface = "org.my.company.jca.evaluator.service.EvaluatorService",
targetNamespace = "http://my.company.org/wsdl/jca/EvaluatorService",
wsdlLocation = "EvaluatorService.wsdl"
)
@SchemaValidation(enabled=true)
8<--------------- snip 8< -----------------------
{code}
{code:xml|title=Spring Configuration}
8<--------------- snip 8< -----------------------
<!--
**************************************************************************
JAX-WS web services, provided via Apache CXF
************************************************************************** -->
<bean id="evaluatorServiceImpl"
class="org.my.company.jca.evaluator.service.EvaluatorServiceImpl"/>
<!-- Webservice endpoint configuration -->
<jaxws:endpoint
id="evaluator"
implementor="#evaluatorServiceImpl"
address="/evaluatorService"
xmlns:s="http://my.company.org/wsdl/jca/EvaluatorService"
serviceName="s:EvaluatorService"
wsdlLocation="EvaluatorService.wsdl" >
<jaxws:schemaLocations>
<jaxws:schemaLocation>classpath:EvaluatorRequest.xsd</jaxws:schemaLocation>
<jaxws:schemaLocation>classpath:EvaluatorDocument.xsd</jaxws:schemaLocation>
<jaxws:schemaLocation>classpath:EvaluatorResponse.xsd</jaxws:schemaLocation>
<jaxws:schemaLocation>classpath:EvaluatorTypes.xsd</jaxws:schemaLocation>
</jaxws:schemaLocations>
<jaxws:features>
<bean class="org.apache.cxf.feature.LoggingFeature"/>
</jaxws:features>
<jaxws:properties>
<entry key="schema-validation-enabled" value="true" />
</jaxws:properties>
</jaxws:endpoint>
8<--------------- snip 8< -----------------------
{code}
{code:title=Exceptions}
WARNING: SAXException for newSchema()
org.xml.sax.SAXParseException: src-resolve: Cannot resolve the name
'ereq:eval-request' to a(n) 'element declaration' component.
WARNING: Interceptor for
{http://my.company.org/wsdl/jca/EvaluatorService}EvaluatorService#{http://my.company.org/wsdl/jca/EvaluatorService}evaluate
has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Marshalling Error: cvc-elt.1: Cannot find the
declaration of element 'ns2:eval-response'.
{code}
> Jax WS - Schema Locations are ignored since CXF-2851 was implemented
> --------------------------------------------------------------------
>
> Key: CXF-3095
> URL: https://issues.apache.org/jira/browse/CXF-3095
> Project: CXF
> Issue Type: Bug
> Affects Versions: 2.2.10, 2.2.11
> Environment: running in tomcat 6
> Reporter: Patrick Leamon
> Fix For: NeedMoreInfo
>
>
> I'm having very odd schema validation issues since moving from cxf 2.0.11 to
> cxf 2.2.10.
> The beans.xml I'm using to configure the web service looks something like:
> {code:xml}
> <jaxws:endpoint id="LocationServiceId"
> implementor="com.blah.LocationServiceImpl"
> address="/services/location">
> <jaxws:properties>
> <entry key="schema-validation-enabled" value="true" />
> </jaxws:properties>
> <jaxws:schemaLocations>
>
> <jaxws:schemaLocation>classpath:xsd/common-types.xsd</jaxws:schemaLocation>
>
> <jaxws:schemaLocation>classpath:xsd/location-types..xsd</jaxws:schemaLocation>
>
> <jaxws:schemaLocation>classpath:xsd/location-service.xsd</jaxws:schemaLocation>
> </jaxws:schemaLocations>
> </jaxws:endpoint>
> {code}
> The first five requests that I send to this web service function correctly.
> Any further requests result in:
> Unmarshalling Error: cvc-elt.1: Cannot find the declaration of element
> 'ns1:locationElement'
> Previously in 2.0.11 this was working fine, regardless of the number of
> requests being sent.
> *edit* Reverting to 2.2.9 works perfectly. It looks like the code path that
> reads in schemaLocations was disabled by the fix to CXF-2851.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.