L.S.,
Can you retry after setting the container's logging level to DEBUG
(http://servicemix.apache.org/how-do-i-change-the-logging.html) to check
if this gives us any additional information about what has gone wrong?
Also, could you check the exchange's properties after the call to
sendSync? You might have a Fault message in there or the status can be
ERROR instead of DONE.
Gert
aha001 wrote:
I would like to use the lwcontainer to send email.
I configured the servicemix.xml file for the su as below:
The code was running without error but I don’t see the email. Does it
actually send?
Help will be much appreciates.
<beans xmlns:sm="http://servicemix.apache.org/config/1.0"
xmlns:no="http://telecom.co.nz/eai/af/notify">
<sm:serviceunit id="jbi">
<sm:activationSpecs>
<sm:activationSpec componentName="mimeSender"
service="no:SendNotification" endpoint="endpoint">
<sm:component>
<bean class="org.apache.servicemix.components.email.MimeMailSender">
<property name="sender">
<bean
class="org.springframework.mail.javamail.JavaMailSenderImpl">
<property name="host"
value="146.171.1.1"/>
<property name="port"
value="25"/>
</bean>
</property>
</bean>
</sm:component>
</sm:activationSpec>
</sm:activationSpecs>
</sm:serviceunit>
</beans>
and the code:
public void sendEmail(ComponentContext context) throws NamingException,
JBIException{
ServiceMixClient client = new ServiceMixClientFacade(context);
QName service = new QName("http://telecom.co.nz/eai/af/notify",
"SendNotification");
EndpointResolver resolver = client.createResolverForService(service);
ServiceEndpoint se = client.getContext().getEndpoint(service, "endpoint");
InOnly exchange;
exchange = client.createInOnlyExchange(resolver);
exchange.setOperation(service);
NormalizedMessage message = exchange.createMessage();
message.setProperty("org.apache.servicemix.email.to",
"[EMAIL PROTECTED]");
message.setProperty("org.apache.servicemix.email.from",
"[EMAIL PROTECTED]");
message.setProperty("org.apache.servicemix.email.subject", "Hello from
sendEmail");
message.setProperty("org.apache.servicemix.email.text", "Hi from test
sendEmail");
message.setContent(new
StringSource("<setContext><ComponentContext>Testing</ComponentContext></setContext>"));
client.sendSync(exchange)
}