You need to use the property mediator and set the property named
"messageType" with value "text/plain" which will trigger the TextFormatter
and the message will be in the email body. The configuration that you are
having tried to write the message as a SOAP message and SOAP is always
treated as an attachment.

Also, you may do a transformation to send a text message instead of XML if
you want to.

How ever the exception stack looks a bit odd to me. How do you receive
messages to this proxy and in which format?

Ruwan

On Mon, Aug 1, 2011 at 3:24 PM, De Vleeschauwer Nele <
[email protected]> wrote:

> Hi,
>
> With Apache Synapse, I've configured a proxy service which receives an
> xml message and sends it out via SMTP:
> <?xml version="1.0" encoding="UTF-8"?>
> <proxy xmlns="http://ws.apache.org/ns/synapse"; name="emailOut"
> transports="http" startOnLoad="true" trace="disable">
>    <target endpoint="myMailbox" faultSequence="fault">
>        <inSequence>
>            <log level="custom">
>                <property name="MESSAGE" value="*** message received
> ***"/>
>            </log>
>            <property name="FORCE_SC_ACCEPTED" value="true"
> scope="axis2"/>
>            <property name="OUT_ONLY" value="true" scope="default"/>
>        </inSequence>
>    </target>
> </proxy>
>
> and my endpoint:
> <?xml version="1.0" encoding="UTF-8"?>
> <endpoint xmlns="http://ws.apache.org/ns/synapse"; name="myMailbox">
>    <address uri="mailto:[email protected]"/>
>    <property name="Subject" value="Message from Apache Synapse"
> scope="transport"/>
> </endpoint>
>
> Although the SMTP works fine (client receives the mail message), I
> always see the following exception in my log:
> [2011-08-01 11:49:01,545] DEBUG - ProxyServiceMessageReceiver Proxy
> Service emailOut received a new message from : 10.49.1.19
> [2011-08-01 11:49:01,545] DEBUG - ProxyServiceMessageReceiver Message
> To: /services/emailOut
> [2011-08-01 11:49:01,545] DEBUG - ProxyServiceMessageReceiver
> SOAPAction: null
> [2011-08-01 11:49:01,545] DEBUG - ProxyServiceMessageReceiver
> WSA-Action: null
> [2011-08-01 11:49:01,545] DEBUG - ProxyServiceMessageReceiver Setting
> the fault-sequence to :
> org.apache.synapse.mediators.base.SequenceMediator@2ee6ea
> [2011-08-01 11:49:01,545] DEBUG - ProxyServiceMessageReceiver Using the
> anonymous in-sequence of the proxy service for mediation
> [2011-08-01 11:49:01,545] DEBUG - SequenceMediator Start : Sequence
> <anonymous>
> [2011-08-01 11:49:01,545] DEBUG - SequenceMediator Sequence
> <SequenceMediator> :: mediate()
> [2011-08-01 11:49:01,545] DEBUG - LogMediator Start : Log mediator
> [2011-08-01 11:49:01,545]  INFO - LogMediator MESSAGE = *** message
> received ***
> [2011-08-01 11:49:01,545] DEBUG - LogMediator End : Log mediator
> [2011-08-01 11:49:01,545] DEBUG - PropertyMediator Start : Property
> mediator
> [2011-08-01 11:49:01,545] DEBUG - PropertyMediator Setting property :
> FORCE_SC_ACCEPTED at scope : axis2 to : true (i.e. constant : true)
> [2011-08-01 11:49:01,561] DEBUG - PropertyMediator End : Property
> mediator
> [2011-08-01 11:49:01,561] DEBUG - PropertyMediator Start : Property
> mediator
> [2011-08-01 11:49:01,561] DEBUG - PropertyMediator Setting property :
> OUT_ONLY at scope : default to : true (i.e. constant : true)
> [2011-08-01 11:49:01,561] DEBUG - PropertyMediator End : Property
> mediator
> [2011-08-01 11:49:01,561] DEBUG - SequenceMediator End : Sequence
> <anonymous>
> [2011-08-01 11:49:01,576] DEBUG - ProxyServiceMessageReceiver Forwarding
> message to the endpoint : myMailbox
> [2011-08-01 11:49:01,576] DEBUG - EndpointContext Checking if endpoint :
> myMailbox currently at state ACTIVE can be used now?
> [2011-08-01 11:49:01,576] DEBUG - AddressEndpoint Sending message
> through endpoint : myMailbox resolving to address =
> mailto:[email protected]
> [2011-08-01 11:49:01,576] DEBUG - AddressEndpoint SOAPAction: null
> [2011-08-01 11:49:01,576] DEBUG - AddressEndpoint WSA-Action: null
> [2011-08-01 11:49:01,576] DEBUG - Axis2FlexibleMEPClient Sending [add =
> false] [sec = false] [rm = false] [mtom = false] [swa = false] [format =
> null] [force soap11=false] [force soap12=false] [pox=false] [get=false]
> [encoding=null] [to=mailto:[email protected]]
> [2011-08-01 11:49:01,576] DEBUG - Axis2FlexibleMEPClient Message
> [Original Request Message ID :
> urn:uuid:ac6b00a4-012f-4cf0-a36b-bfd5d21302e3] [New Cloned Request
> Message ID : urn:uuid:2837cfd4-19f2-4785-a73a-da92c2afb61e]
> [2011-08-01 11:49:01,576]  INFO - BuilderUtil OMException in
> getSOAPBuilder
> org.apache.axiom.soap.SOAPProcessingException: First Element must
> contain the local name, Envelope , but found huisdier
>        at
> org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.constructNode(St
> AXSOAPModelBuilder.java:305)
>        at
> org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createOMElement(
> StAXSOAPModelBuilder.java:252)
>        at
> org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createNextOMElem
> ent(StAXSOAPModelBuilder.java:234)
>        at
> org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:2
> 49)
>        at
> org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.getSOAPEnvelope(
> StAXSOAPModelBuilder.java:204)
>        at
> org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.<init>(StAXSOAPM
> odelBuilder.java:154)
>        at
> org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.<init>(StAXSOAPM
> odelBuilder.java:140)
>        at
> org.apache.axis2.builder.BuilderUtil.getSOAPBuilder(BuilderUtil.java:691
> )
>        at
> org.apache.axis2.transport.TransportUtils.createDocumentElement(Transpor
> tUtils.java:197)
>        at
> org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUti
> ls.java:145)
>        at
> org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostReques
> t(HTTPTransportUtils.java:167)
>        at
> org.apache.synapse.transport.nhttp.ServerWorker.processEntityEnclosingMe
> thod(ServerWorker.java:408)
>        at
> org.apache.synapse.transport.nhttp.ServerWorker.run(ServerWorker.java:25
> 9)
>        at
> org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWor
> kerPool.java:173)
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecuto
> r.java:886)
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.ja
> va:908)
>        at java.lang.Thread.run(Thread.java:662)
>
> How can I avoid this ?
>
> And another question:
> The message is always passed as attachment of the mail message ? Is it
> also possible to manipulate the body of the mail message ?
>
> Thanks for your response...
>
>
>
>
>
> -----------------------------------------
> Visit our website! http://www.nbb.be
>
> "DISCLAIMER: The content of this e-mail message should not be
> construed as binding on the part of the National Bank of Belgium
> (NBB) unless otherwise and previously stated. The opinions
> expressed in this message are solely those of the author and do not
> necessarily reflect NBB viewpoints, particularly when the content
> of this message, or part thereof, is private by nature or does not
> fall within the professional scope of its author."




-- 
Ruwan Linton
Member, Apache Software Foundation; http://www.apache.org
<http://wso2.org>

phone: +94 11 282 7532
email: [email protected]; cell: +94 77 341 3097
blog: http://blog.ruwan.org
linkedin: http://www.linkedin.com/in/ruwanlinton
google: http://www.google.com/profiles/ruwan.linton
tweet: http://twitter.com/ruwanlinton

Reply via email to