[INT-2348] Spring Integration WS element <ws:inbound-gateway> available but <ws:header-enricher> not available for use in Spring Created: 02/Jan/12  Updated: 06/Jan/12  Resolved: 06/Jan/12

Status: Resolved
Project: Spring Integration
Component/s: Web Services
Affects Version/s: 1.0.1, 2.1 RC1
Fix Version/s: None

Type: Bug Priority: Major
Reporter: AvinashMunaga Assignee: Artem Bilan
Resolution: Won't Fix Votes: 0
Labels: performance, spring-integration, webservices
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows XP, STS 2.8.1, Apache Tomcat 6.0.29,


Reference URL: http://forum.springsource.org/showthread.php?120878

 Description   

I am building a new web application and using Spring Integration for integrating this with my legacy application for fetching data into my web application through a web service call. I have gone through Spring forum and saw the example of ws-outbound gateway. I tried implementing the example in STS IDE using ANT build. The problem is that when I am trying to run the example it showing the error - "cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'ws:header-enricher'". But, <ws:outbound-gateway> & <ws:inbound-gateway> elements are available for use. I have gone through various forums and posts to gain help from them. But, I found the things are not working for me as I have included all the jar's in Buildpath of my Application.



 Comments   
Comment by Artem Bilan [ 02/Jan/12 ]

Let me guess: your xmlns in the config like this:

<beans:beans xmlns:beans="http://www.springframework.org/schema/beans"
        xmlns:ws="http://www.springframework.org/schema/integration/ws"
...	
xsi:schemaLocation="http://www.springframework.org/schema/integration/ws
			http://www.springframework.org/schema/integration/ws/spring-integration-ws-1.0.xsd"
...	

Try to use XSD location without version number.
Also, make sure that you have in the CLASSPATH jars from only last Srping Integration version.
In 1.0 version there is no any ws:header-enricher XML-element declaration.

Comment by AvinashMunaga [ 02/Jan/12 ]

when I use the XSD without version number I am getting an error message which is cleared after I include the version number.

Also, the example which I am trying to implement doesn't support Spring Integration 2.1 API as the implementation class in the example has imported the classes from 1.0.

Comment by AvinashMunaga [ 02/Jan/12 ]

This is what the XML looks like

<?xml version="1.0" encoding="UTF-8"?>

<beans:beans xmlns="http://www.springframework.org/schema/integration"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:stream="http://www.springframework.org/schema/integration/stream"
xmlns:ws="http://www.springframework.org/schema/integration/ws"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-1.0.xsd
http://www.springframework.org/schema/integration/stream
http://www.springframework.org/schema/integration/stream/spring-integration-stream-1.0.xsd
http://www.springframework.org/schema/integration/ws
http://www.springframework.org/schema/integration/ws/spring-integration-ws.xsd">

<!-- This chain receives from the 'fahrenheitChannel' and enriches the request
Message by adding the "soap-action" header value. Then, the Web Service outbound
Messaging Gateway invokes the Web Service for the given URI, and the reply
Message is sent to the 'celsiusChannel'. -->
<chain input-channel="fahrenheitChannel" output-channel="celsiusChannel">
<transformer ref="" />
<ws:header-enricher>
<ws:soap-action value="http://tempuri.org/FahrenheitToCelsius" />
</ws:header-enricher>
<ws:outbound-gateway uri="http://www.w3schools.com/webservices/tempconvert.asmx" />
</chain>

<!-- The response from the service is logged to the console. -->
<stream:stdout-channel-adapter id="celsiusChannel" />

</beans:beans>

and this is the implementation class

public class SpringIntegrationDemo {

/**

  • @param args
    */
    public static void main(String[] args) { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( "blog/temperatureConversion.xml"); ChannelResolver resolver = new BeanFactoryChannelResolver(context); // Compose the XML message according to server's schema String requestXML = "<FahrenheitToCelsius xmlns=\"http://tempuri.org/\">" + "<Fahrenheit>90.0<Fahrenheit/>" + "<FahrenheitToCelsius/>"; // Create the message object Message<String> message = MessageBuilder.withPayload(requestXML) .build(); // Send the message to handler's input channel MessageChannel channel = resolver .resolveChannelName("fahrenheitChannel"); channel.send(message); }

}

Comment by AvinashMunaga [ 02/Jan/12 ]

In the previous comment, I stated something wrong.

— "Also, the example which I am trying to implement doesn't support Spring Integration 2.1 API as the implementation class in the example has imported the classes from 1.0."

Even after changing the API from 1.0 to 2.1. I still have the same error. Also, I have used XSD location without the version number.

Comment by Artem Bilan [ 02/Jan/12 ]

Try to switch to the latest Spring Integration version 2.1.0.RC1 and remove version number from all XSD locations. Not only ws.

Comment by AvinashMunaga [ 03/Jan/12 ]

I have stated the same thing in my earlier. You may have missed my lines in the previous comment. I switched the version from 1.0 to 2.1.0.RC1 and also removed version numbers from all XSD locations my Spring configuration xml.

Also, one more thing to remember is that <ws:outbound-gateway> element is available for use in my XML but not <ws:header-enricher>.

Comment by Artem Bilan [ 03/Jan/12 ]

Also, one more thing to remember is that <ws:outbound-gateway> element is available for use in my XML but not <ws:header-enricher>.

I can make only one conclusion: in your CLASSPATH is Spring Integration 1.0.

Is there any reason to use this version?
Nevertheless try to change declaration of ws:header-enricher to regular header-enricher:

<header-enricher>
  <header name="ws_soapAction" value="http://tempuri.org/FahrenheitToCelsius" />
</header-enricher>
Comment by AvinashMunaga [ 03/Jan/12 ]

I removed spring integration 1.0 jar totally from my Application and included 2.1.0.RC1.

If I have to use <header-enricher> in place of <ws:header-enricher>, is there any reason why the distribution from Spring have <ws:header-enricher>.

Comment by Artem Bilan [ 03/Jan/12 ]

is there any reason why the distribution from Spring have <ws:header-enricher>

It is some protocol specific adapter from SI to SOAP. Look at it as on 'black box'.
There are other similar adapters: mail:header-enricher, xmpp:header-enricher, jms:header-enricher, xpath-header-enricher etc.
So, have you tried to use <ws:header-enricher> after you removed Spring Integration 1.0 ?

Comment by Oleg Zhurakousky [ 03/Jan/12 ]

Guys
Let's continue this discussion on the Forums - http://forum.springsource.org/forumdisplay.php?42-Integration until we realize that there is a real issue which it doesn't seem to be.

Comment by AvinashMunaga [ 03/Jan/12 ]

@Artem Bilan

I already specified the same in my previous comment that I have replaced all the jar's of 1.0 with 2.1.0.RC1 and using same XML and Class Files.

I have stated the same thing in my earlier. You may have missed my lines in the previous comment. I switched the version from 1.0 to 2.1.0.RC1 and also removed version numbers from all XSD locations my Spring configuration xml.

Also, one more thing to remember is that <ws:outbound-gateway> element is available for use in my XML but not <ws:header-enricher>.

Comment by Artem Bilan [ 03/Jan/12 ]

@AvinashMunaga
Can you open a topic in the Spring Integration Forum?
And we will continue.

Comment by Gary Russell [ 04/Jan/12 ]

In lieu of forum post, a couple of things to try...

1. Clear the cache - Window | Preferences | General | Network Connections | Cache | Remove all
2. Enable Spring Nature on the project (Right click Project | Spring Tools | Enable Spring Project Nature)
3. Ensure "Load NamespaceHandlers and XSDs from project's classpath" is set (Project | Prooperties | Spring | Beans Support | Namespaces

Comment by AvinashMunaga [ 06/Jan/12 ]

Hi,

I created a new thread in Spring Integration forum... Can you please respond to it asap. I am really in need of support.

Thanks,
Avinash Munaga.

Comment by AvinashMunaga [ 06/Jan/12 ]

The problem is moved to

http://forum.springsource.org/showthread.php?120878-Spring-Integration-WS-element-lt-ws-inbound-gateway-gt-available-but-lt-ws-header-enricher-gt and is fixed. You can close this issue now. Thanks for the support .

Comment by Artem Bilan [ 06/Jan/12 ]

The problem is fixed via switching to the latest Spring Integration version.

Generated at Sun Jul 05 23:45:56 UTC 2020 using Jira 8.5.4#805004-sha1:0444eab799707f9ad7b248d69f858774aadfd250.