Priority
Normal
Type
Bug 
State
Won't fix 
Assignee
Maxim Mossienko 
Subsystem
XML editing 
Affected versions
Fixed in
Fixed in build
Next build 
Build
7757
Severity
0
  • Submitted by   Serge Baranov
    20 months ago (15 May 2008 21:38)
  • Updated by Serge Baranov
    20 months ago (28 May 2008 23:35)
  • Jira: IDEA-18099
    (history, comments)

IDEA-18099

XML validation failing for Mule 2.0 config files

1
Support feedback:

I recently started migrating from Mule 1.4.x to Mule 2.0.1, and I've
noticed that IntelliJ is having problems with the new-style config
files. Mule 1.4.x used DTD-based validation, whereas Mule 2.x uses XML
schema-based validation.

I'm specifically running into a problem with Mule configs that define
and use a CXF namespace. Consider the following example:

<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesource.org/schema/mule/core/2.0"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:spring="http://www.springframework.org/schema/beans"
       xmlns:soap="http://www.mulesource.org/schema/mule/soap/2.0"
       xmlns:cxf="http://www.mulesource.org/schema/mule/cxf/2.0"
    xsi:schemaLocation="
       http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
       http://www.mulesource.org/schema/mule/core/2.0
http://www.mulesource.org/schema/mule/core/2.0/mule.xsd
       http://www.mulesource.org/schema/mule/soap/2.0
http://www.mulesource.org/schema/mule/soap/2.0/mule-soap.xsd
       http://www.mulesource.org/schema/mule/cxf/2.0
http://www.mulesource.org/schema/mule/cxf/2.0/mule-cxf.xsd">

    <description>
        This config builds a JAX-WS service with CXF.
        
        We use a "serviceClass" which is a JAX-WS interface we've
defined. It allows us

        To invoke the EchoUMO hit the following URL -
 
http://localhost:65081/services/EchoUMO?method=echo&amp;param=Is there
an echo?
        (remember to replace the '&amp;' with an ampersand)

        To view the WSDL for the EchoUMO service go to -
            http://localhost:65081/services/EchoUMO?wsdl
    </description>

    <model name="echoSample">
        <service name="EchoUMO">
            <inbound>
                <cxf:inbound-endpoint
address="http://localhost:65082/services/EchoUMO"
 
serviceClass="org.mule.example.echo.Echo"/>
            </inbound>
            <echo-component/>
        </service>
    </model>
</mule>


If I ask IntelliJ to fetch external resources to resolve the XSD
references, this works fine for all of them except mule-cxf.xsd --
attempting to have IntelliJ fetch this resource results in the following
error:

Error while fetching
http://www.springframework.org/schema/beans/spring-beans.xsd

...followed by a FileNotFoundException

Surfing to http://www.springframework.org/schema/beans shows that there
is no "spring-beans.xsd", but there is a "spring-beans-2.0.xsd", just as
it is declared in the above XML example. I manually downloaded the
mule-cxf.xsd file and opened it in a text editor, and can see no
explicit reference to "spring-beans.xsd", so at first glance I am
confused as to how this resolution is happening.

If I then go into IntelliJ Settings -> Resources and manually add the
URI and point its location to the manually downloaded XSD, IntelliJ will
then complain that the tag <cxf:inbound-endpoint> is not allowed in that
position. This would seem to be an error, since this is one of the
examples that ships in the archive with the Mule 2.0.1 distribution, and
the above quoted XML config file is pulled directly from that example.

This is causing me no end of headaches, because I rely on IntelliJ to
let me know if my XML is well-formed or not before I go through the
trouble of deploying to a Mule instance and try running it.

Issue was resolved
Comments (7)
 
History (0)
 
Links
 
Andrew Perepelytsya
  Andrew Perepelytsya
15 May 2008 23:22
(20 months ago)
#permalink
Guys,

Here's some more info from Daniel Feist:

Here my attempt at trying to describe the issue more concisely, maybe this would be more useful to InteliJ guys..

The XML editor auto-complete functionality show elements from other namespace which are valid in the current context via the use of XML schema abstract elements and substitution groups.


HTH,
Andrew
Thibaut
  Thibaut
16 May 2008 01:18
(20 months ago)
#permalink
thing is http://www.mulesource.org/schema/mule/cxf/2.0/mule-cxf.xsd includes the following
<xsd:import namespace="http://www.springframework.org/schema/beans" schemaLocation="http://www.springframework.org/schema/beans"/>


which is probably the cause of your problem, guess this should be raised against the mule team
Andrew Perepelytsya
  Andrew Perepelytsya
16 May 2008 20:43
(20 months ago)
#permalink
I'm not sure if it's a new issue or related, but the real problem is as follows. Consider the following xml:

{code:xml}
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesource.org/schema/mule/core/2.0"
xmlns:management="http://www.mulesource.org/schema/mule/management/2.0"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://www.mulesource.org/schema/mule/core/2.0 http://www.mulesource.org/schema/mule/core/2.0/mule.xsd
http://www.mulesource.org/schema/mule/management/2.0 http://www.mulesource.org/schema/mule/management/2.0/mule-management.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

<--
However, auto-completion for element names doesn't work.
-->
<!<management:>

</mule>
{code}

Check the comments for 2 scenarios. This is a demo with substitution groups in XML schemas, which are valid schemas btw. E.g. other commercial xml-dedicated editors like Oxygen XML work perfectly with them and provide auto-completion.
Maxim Mossienko
  Maxim Mossienko
26 May 2008 23:13
(20 months ago)
#permalink
http://www.mulesource.org/schema/mule/cxf/2.0/mule-cxf.xsd has import that does not allow IDEA to fetch the resource

<xsd:import namespace="http://www.springframework.org/schema/beans" schemaLocation="http://www.springframework.org/schema/beans"/>
Taras Tielkes
  Taras Tielkes
27 May 2008 12:36
(20 months ago)
#permalink
Andrew, Spring requires the schemaLocation to point to an "_virtual schema location_" that can be resolved by Spring (using {{META-INF/spring.schemas}}).

IDEA simply has the same requirement.
Maxim Mossienko
  Maxim Mossienko
27 May 2008 14:27
(20 months ago)
#permalink
I have solved the problem with highlighting / completion with substitutes
Maxim Mossienko
  Maxim Mossienko
28 May 2008 23:35
(20 months ago)
#permalink