Results 1 to 3 of 3

Thread: Spring Integration WS element <ws:inbound-gateway> available but <ws:header-enricher>

  1. #1
    Join Date
    Dec 2011
    Location
    Hyderabad, India
    Posts
    16

    Default Spring Integration WS element <ws:inbound-gateway> available but <ws:header-enricher>

    This is a continuation thread to the issue in jira quoted
    INT-2348.

    Hi Artem,

    The problem with<ws:header-enricher> is resolved as I replaced it with <header-enricher>. Going through with the example(ws-outboundgateway) the got another problem.

    While sending message to the URL I am getting a Null Pointer Exception.

    This is what my java class looks like:

    Code:
    public class SpringIntegrationDemo {
    
    	/**
    	 * @param args
    	 */
    	public static void main(String[] args) {
    		ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
    				"blog/temperatureConversion.xml");
    		ChannelResolver channelResolver = new BeanFactoryChannelResolver(
    				context);
    
    		// Compose the XML message according to the server's schema
    
    		String requestXml = "<faernheitToCelsius xmlns=\"http://examples.csc.com\">"
    				+ "	<farenheit>400</farenheit>" + "</faernheitToCelsius>";
    		
                    // Create the Message object
    		Message<String> message = MessageBuilder.withPayload(requestXml)
    				.build();
    
    		// Send the Message to the handler's input channel
    		MessageChannel channel = channelResolver
    				.resolveChannelName("fahrenheitChannel");
    		channel.send(message);
    
    	}
    }
    This is my COnfig file

    <?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/schem...ring-beans.xsd
    http://www.springframework.org/schema/integration
    http://www.springframework.org/schem...ntegration.xsd
    http://www.springframework.org/schem...gration/stream
    http://www.springframework.org/schem...ion-stream.xsd
    http://www.springframework.org/schema/integration/ws
    http://www.springframework.org/schema/integration/ws/spring-integration-ws.xsd">

    <chain input-channel="fahrenheitChannel" output-channel="celsiusChannel">
    <header-enricher>
    <header name="soapAction" value="http://examples.csc.com/FaernheitToCelsius/faernheitToCelsius"/>
    </header-enricher>
    <ws:outbound-gateway uri="http://20.198.88.97:9090/Webservice-example/services/Converter?wsdl" />
    </chain>

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

    preInstantiateSingletons
    INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultL istableBeanFactory@a1d1f4: defining beans [org.springframework.integration.internalDefaultCon figuringBeanFactoryPostProcessor,org.springframewo rk.integration.transformer.HeaderEnricher#0,org.sp ringframework.integration.transformer.MessageTrans formingHandler#198a455,org.springframework.integra tion.ws.SimpleWebServiceOutboundGateway#1989f84,or g.springframework.integration.handler.MessageHandl erChain#0,fahrenheitChannel,org.springframework.in tegration.config.ConsumerEndpointFactoryBean#0,cel siusChannel,org.springframework.integration.stream .CharacterStreamWritingMessageHandler#0,celsiusCha nnel.adapter,nullChannel,errorChannel,_org.springf ramework.integration.errorLogger,taskScheduler,org .springframework.integration.config.IdGeneratorCon figurer#0]; root of factory hierarchy
    Jan 6, 2012 3:05:08 PM org.springframework.ws.soap.saaj.SaajSoapMessageFa ctory afterPropertiesSet
    INFO: Creating SAAJ 1.3 MessageFactory with SOAP 1.1 Protocol
    Jan 6, 2012 3:05:08 PM org.springframework.scheduling.concurrent.Executor ConfigurationSupport initialize
    INFO: Initializing ExecutorService 'taskScheduler'
    Jan 6, 2012 3:05:08 PM org.springframework.context.support.DefaultLifecyc leProcessor$LifecycleGroup start
    INFO: Starting beans in phase -2147483648
    Jan 6, 2012 3:05:08 PM org.springframework.integration.endpoint.EventDriv enConsumer logComponentSubscriptionEvent
    INFO: Adding {chain} as a subscriber to the 'fahrenheitChannel' channel
    Jan 6, 2012 3:05:08 PM org.springframework.integration.channel.AbstractSu bscribableChannel subscribe
    INFO: Channel 'fahrenheitChannel' has 1 subscriber(s).
    Jan 6, 2012 3:05:08 PM org.springframework.integration.endpoint.AbstractE ndpoint start
    INFO: started org.springframework.integration.config.ConsumerEnd pointFactoryBean#0
    Jan 6, 2012 3:05:08 PM org.springframework.integration.endpoint.EventDriv enConsumer logComponentSubscriptionEvent
    INFO: Adding {message-handler:celsiusChannel.adapter} as a subscriber to the 'celsiusChannel' channel
    Jan 6, 2012 3:05:08 PM org.springframework.integration.channel.AbstractSu bscribableChannel subscribe
    INFO: Channel 'celsiusChannel' has 1 subscriber(s).
    Jan 6, 2012 3:05:08 PM org.springframework.integration.endpoint.AbstractE ndpoint start
    INFO: started celsiusChannel.adapter
    Jan 6, 2012 3:05:08 PM org.springframework.integration.endpoint.EventDriv enConsumer logComponentSubscriptionEvent
    INFO: Adding {logging-channel-adapter:_org.springframework.integration.errorLogg er} as a subscriber to the 'errorChannel' channel
    Jan 6, 2012 3:05:08 PM org.springframework.integration.channel.AbstractSu bscribableChannel subscribe
    INFO: Channel 'errorChannel' has 1 subscriber(s).
    Jan 6, 2012 3:05:08 PM org.springframework.integration.endpoint.AbstractE ndpoint start
    INFO: started _org.springframework.integration.errorLogger
    Exception in thread "main" org.springframework.integration.MessageHandlingExc eption: error occurred in message handler [org.springframework.integration.ws.SimpleWebServic eOutboundGateway#1989f84]
    at org.springframework.integration.handler.AbstractMe ssageHandler.handleMessage(AbstractMessageHandler. java:79)
    at org.springframework.integration.handler.MessageHan dlerChain$1.send(MessageHandlerChain.java:154)
    at org.springframework.integration.core.MessagingTemp late.doSend(MessagingTemplate.java:288)
    at org.springframework.integration.core.MessagingTemp late.send(MessagingTemplate.java:149)
    at org.springframework.integration.handler.AbstractRe plyProducingMessageHandler.sendMessage(AbstractRep lyProducingMessageHandler.java:175)
    at org.springframework.integration.handler.AbstractRe plyProducingMessageHandler.sendReplyMessage(Abstra ctReplyProducingMessageHandler.java:159)
    at org.springframework.integration.handler.AbstractRe plyProducingMessageHandler.produceReply(AbstractRe plyProducingMessageHandler.java:124)
    at org.springframework.integration.handler.AbstractRe plyProducingMessageHandler.handleResult(AbstractRe plyProducingMessageHandler.java:118)
    at org.springframework.integration.handler.AbstractRe plyProducingMessageHandler.handleMessageInternal(A bstractReplyProducingMessageHandler.java:100)
    at org.springframework.integration.handler.AbstractMe ssageHandler.handleMessage(AbstractMessageHandler. java:73)
    at org.springframework.integration.handler.MessageHan dlerChain.handleMessageInternal(MessageHandlerChai n.java:137)
    at org.springframework.integration.handler.AbstractMe ssageHandler.handleMessage(AbstractMessageHandler. java:73)
    at org.springframework.integration.dispatcher.Unicast ingDispatcher.doDispatch(UnicastingDispatcher.java :110)
    at org.springframework.integration.dispatcher.Unicast ingDispatcher.dispatch(UnicastingDispatcher.java:9 7)
    at org.springframework.integration.channel.AbstractSu bscribableChannel.doSend(AbstractSubscribableChann el.java:61)
    at org.springframework.integration.channel.AbstractMe ssageChannel.send(AbstractMessageChannel.java:157)
    at org.springframework.integration.channel.AbstractMe ssageChannel.send(AbstractMessageChannel.java:128)
    at blog.SpringIntegrationDemo.main(SpringIntegrationD emo.java:38)
    Caused by: java.lang.NullPointerException
    at org.springframework.integration.ws.DefaultSoapHead erMapper.extractUserDefinedHeaders(DefaultSoapHead erMapper.java:68)
    at org.springframework.integration.ws.DefaultSoapHead erMapper.extractUserDefinedHeaders(DefaultSoapHead erMapper.java:49)
    at org.springframework.integration.mapping.AbstractHe aderMapper.toHeaders(AbstractHeaderMapper.java:182 )
    at org.springframework.integration.mapping.AbstractHe aderMapper.toHeadersFromReply(AbstractHeaderMapper .java:136)
    at org.springframework.integration.ws.AbstractWebServ iceOutboundGateway$ResponseMessageExtractor.extrac tData(AbstractWebServiceOutboundGateway.java:235)
    at org.springframework.ws.client.core.WebServiceTempl ate.doSendAndReceive(WebServiceTemplate.java:555)
    at org.springframework.ws.client.core.WebServiceTempl ate.sendAndReceive(WebServiceTemplate.java:496)
    at org.springframework.integration.ws.SimpleWebServic eOutboundGateway.doHandle(SimpleWebServiceOutbound Gateway.java:88)
    at org.springframework.integration.ws.AbstractWebServ iceOutboundGateway.handleRequestMessage(AbstractWe bServiceOutboundGateway.java:176)
    at org.springframework.integration.handler.AbstractRe plyProducingMessageHandler.handleMessageInternal(A bstractReplyProducingMessageHandler.java:97)
    at org.springframework.integration.handler.AbstractMe ssageHandler.handleMessage(AbstractMessageHandler. java:73)
    ... 17 more
    I am unable to proceed as I can't find much of help on web also.

    Details of my webservice:

    Used AXIS2 to create the webservice. Built on Ant and running on Tomcat.

  2. #2
    Join Date
    Jan 2009
    Location
    Ukraine, Kharkov
    Posts
    740

    Default

    Hello
    So, the main problem is here:
    at org.springframework.integration.ws.DefaultSoapHead erMapper.extractUserDefinedHeaders(DefaultSoapHead erMapper.java:68)
    Please, look at: https://jira.springsource.org/browse/INT-2294
    The issue was fixed in the latest release - 2.1.0.RC2
    Can you switch to this version?

    Cheers,
    Artem Bilan

  3. #3
    Join Date
    Dec 2011
    Location
    Hyderabad, India
    Posts
    16

    Default

    Quote Originally Posted by Cleric View Post
    Hello
    So, the main problem is here:

    Please, look at: https://jira.springsource.org/browse/INT-2294
    The issue was fixed in the latest release - 2.1.0.RC2
    Can you switch to this version?

    Cheers,
    Artem Bilan
    Than 'Q'. It works and my problem is solved. Nice to have this kind of support from you people.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •