Hi,
I am trying to call my webservices using a ws:outboundgateway.
But the gateway is not getting called.
I am using a header-value-router to route to a proper channel.
It works fine.
I am using a message template to send the messages to the outbound-gateway.
This is my code..
This is my Gateway class:Code:<int:header-value-router input-channel="headerChannel" header-name="testHeader"> <int:mapping value="bill" channel="getChannel" /> <int:mapping value="post" channel="postChannel" /> </int:header-value-router>
and this is my configuration class:Code:public class MessageGateway { private ObjectMapper objectMapper = new ObjectMapper(); private MessageChannel messageChannel; public MessageChannel getMessageChannel() { return messageChannel; } public void setMessageChannel(MessageChannel messageChannel) { this.messageChannel = messageChannel; } @Autowired private MessagingTemplate messagingTemplate; public Message<?> convertMessage(Message<String> message) { try { System.out.println("in MessageGateway " + message.getPayload()); System.out.println("in MessageGateway " + message.getHeaders().get("testHeader")); SOAPReq sOAPReq = new SOAPReq(); HashMap reqMap = objectMapper.readValue(message.getPayload(), HashMap.class); System.out.println("reqMap is " + reqMap); sOAPReq.setDealer((String)reqMap.get("dealer")); sOAPReq.setDivision((String)reqMap.get("Division")); System.out.println("SOAPReq is " + sOAPReq); Message<RecPROXY> output = (Message<RecPROXY>) messagingTemplate.sendAndReceive(messageChannel, MessageBuilder.withPayload(sOAPReq).build()); RecPROXY recPROXY = output.getPayload(); System.out.println("OUTPUT IS " + output); return null; } catch (Exception e) { // TODO: handle exception } return message; } }
It prints this line :System.out.println("SOAPReq is " + sOAPReq);Code:<int:channel id="getChannel" /> <int:service-activator ref="messageGateway" input-channel="getChannel" /> <bean id="messageGateway" class="com.sales.messaging.MessageGateway"> <property name="messageChannel" ref="postDataChannel"/> </bean> <int:channel id="postDataChannel"/> <bean name="httpMessageSender" class="org.springframework.ws.transport.http.CommonsHttpMessageSender"> <property name="credentials" ref="credentials" /> </bean> <bean id="credentials" class="org.apache.commons.httpclient.UsernamePasswordCredentials"> <constructor-arg value="shane" /> <constructor-arg value="shane" /> </bean> <ws:outbound-gateway id="jaypeeGateway" request-channel="postDataChannel" marshaller="jaxb2Marshaller" unmarshaller="jaxb2Marshaller" uri="http://localhost/myserver" message-sender="httpMessageSender" /> <bean id="jaxb2Marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller"> <property name="classesToBeBound"> <list> <value>com.sales.integration.webservice.billreceivable.SOAPReq</value> <value>com.sales.integration.webservice.billreceivable.RecPROXY</value> </list> </property> </bean> <bean id="messagingTemplate" class="org.springframework.integration.core.MessagingTemplate"/> </beans>
But does not call the ws:otbound-gateway,
What am i doing wrong.Please help.
Thanks in Advance.
Regards,
Annuk


Reply With Quote
