Hello,
I have a SpringWS which when invoked via Spring Integration will send response to a set of subscribed consumers.Currently the responses are logged in the console but now I want this response to be wrapped as an email message and send them to the subscribed consumers. How will the email configuration be?? and what would be the namespace support?? Is it just enough if I have the <mail-target> Please help with some example code snippet.
gid xml
GidWS.javaCode:<?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:tool="http://www.springframework.org/schema/tool" xmlns:integration="http://www.springframework.org/schema/integration" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/tool http://www.springframework.org/schema/tool/spring-tool-2.5.xsd http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-ws-1.0.xsd "> <message-bus/> <publish-subscribe-channel id="sendChannel"/> <!-- The service activator receives from the 'sendChannel', invokes the handler, and sends the reply Message to the 'replyChannel'. --> <service-activator input-channel="sendChannel" ref="msgConverter1" output-channel="replyChannel1"/> <service-activator input-channel="sendChannel" ref="msgConverter1" output-channel="replyChannel2"/> <!-- The handler invokes the WebService for the given URI and returns a reply Message. --> <ws-handler id="msgConverter1" uri="http://localhost:8080/Trial1/companyservice"/> <!-- The response from the service is logged to the console. --> <channel-adapter id="replyChannel1" target="console" /> <channel-adapter id="replyChannel2" target="console" /> <console-target id="console"/> </beans:beans>
Code:package org.springframework.integration.gidb.ws; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.integration.channel.MessageChannel; import org.springframework.integration.message.Message; import org.springframework.integration.message.MessageBuilder; import org.springframework.integration.ws.handler.AbstractWebServiceHandler; import java.util.Properties; public class GidWS { public static void main(String[] args) { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("gid.xml", GidWS.class); String requestXml = "<hr:CompanyRequest xmlns:hr=\"http://mycompany.com/hr/schemas\">" + "<hr:Company>"+ "<hr:CompanyName>GetAllCompanies</hr:CompanyName>"+ "</hr:Company>"+ "</hr:CompanyRequest>"; Message<String> message = MessageBuilder.fromPayload(requestXml) .setHeader(AbstractWebServiceHandler.SOAP_ACTION_PROPERTY_KEY, "http://mycompany.com/hr/schemas") .build(); ((MessageChannel)context.getBean("sendChannel")).send(message); } }


Reply With Quote