2
votes

I'm trying to use the Spring Integration http outbound gateway, but I seem to be getting schema-related errors. The errors are:

cvc-complex-type.3.2.2: Attribute 'expected-response-type' is not allowed to appear in element 'int-http:outbound-gateway'. sprint-servlet.xml  /sprint/src/main/webapp/WEB-INF line 28
cvc-complex-type.3.2.2: Attribute 'url' is not allowed to appear in element 'int-http:outbound-gateway'.    sprint-servlet.xml  /sprint/src/main/webapp/WEB-INF line 28
cvc-complex-type.3.2.2: Attribute 'http-method' is not allowed to appear in element 'int-http:outbound-gateway'.    sprint-servlet.xml  /sprint/src/main/webapp/WEB-INF line 28
cvc-complex-type.3.2.2: Attribute 'reply-timeout' is not allowed to appear in element 'int-http:outbound-gateway'.  sprint-servlet.xml  /sprint/src/main/webapp/WEB-INF line 28

It appears that the XSD does not accept these attributes. However, I've simply copy / pasted this from the Spring Integration docs. Here's the relevant part of my XML config file:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:int-http="http://www.springframework.org/schema/integration/http"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
                    http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
                    http://www.springframework.org/schema/integration/http http://www.springframework.org/schema/integration/http/spring-integration-http.xsd
                    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
                    http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd">



<!-- Spring Integration stuff -->
<int:channel id="requests">
</int:channel>
<int:channel id="replies"/>

<int-http:outbound-gateway id="example"
  request-channel="requests"
  url="http://localhost/test"
  http-method="POST"
  expected-response-type="java.lang.String"
  charset="UTF-8"
  reply-timeout="1234"
  reply-channel="replies"/>

Is there something obvious that I'm doing wrong?

Thanks, Tim

3
Is it an issue from STS or after the running of application ? And be sure to use correct Spring Integration version: projects.spring.io/spring-integrationArtem Bilan
You need to put the Spring Integration jars on your classpath (http and core).Gary Russell
i have tried producing the same issue and found error againt 'reply-timeout' attribute only.Ahsan Shah
by the way, which version of spring integration you are using?Ahsan Shah
Hello All, I'm using the following version of Spring - 3.0.2.RELEASE. When I try and create a Java-based application (aka with a "main"), I get an XSD error, so I've had to turn validation off.Tim Crowley

3 Answers

3
votes

Add spring-integration-http and spring-integration-core to your dependencies.

Should work

3
votes

I had the same problem and found the answer here Why does Spring Integration have several XML schemas, and which one should I use?

Basically, the schema without a version is the version 1.0 schema. Point your schema to your version of spring integration like so

 http://www.springframework.org/schema/integration
 http://www.springframework.org/schema/integration/spring-integration-4.1.xsd
 http://www.springframework.org/schema/integration/http
 http://www.springframework.org/schema/integration/http/spring-integration-http-4.1.xsd
0
votes

I'm not using STS - I'm using the standard Eclipse IDE. I'm not sure if STS helps with the classpath, but I simply can't get that to work for me. I ended up having to extract the XSDs from the .jar files and hosting them myself. Hopefully, the good folks at Spring Integration will post the most recent XSDs on the Spring site sometime soon. Until that time, however, I've got a workaround in place.