You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Madesclair Vivian <vm...@sopragroup.com> on 2009/07/03 11:04:17 UTC

Servicemix adding and removing tags in messages

Hello,
 
I am working on a SA that receive HTTP post requests and send emails
with the content of the request. The content is HTML, and I have to
encode it in UTF-8 (otherwise special characters raise exception in
smx). The issue I got, is that the mail I receive are not decoded and
still in plain UTF-8.
 
It seems that smx is adding <META> tag to the message (I know that
because I looked at the debug output). So when I put myself a <META> in
my html stating that this is UTF-8, the message in smx contains 2 <META>
(stating the same thing). Finally, when the message is given to the mail
component, these two tags are removed and not send in the email.
 
I don't really get it. Why is servicemix modifying the initial message?
I thought it should only work on the JBI wrappers... Which by the way
seem absent here. See ressources provided at the end of the mail.
 
And also, if the message I send is not xml-like but plain text,
servicemix throw an exception (I don't remember what it says though).
 
Regards,
Vivian
 
 
My HTTP consumer bean :
<http:consumer  service="httpMailService"
     endpoint="httpMail"
     targetService="MailService"
     targetEndpoint="senderEndpoint"
     locationURI="http://0.0.0.0:8192/jbi/Mail/" />
 
Mail received :
<html>
 
<head>
 

</head> 
<body>Bonjour%2C+%0A%0AVoici+le+r%C3%A9capitulatif+de+votre+r%C3%A9serva
tion+%3A%0ANombre+de+voyageurs+%3A2%0AVol+Aller+%3A+Le+01%2F07%2F2009+de
+Toulouse+%C3%A0+Paris+%3A+%0A%09Air+France+-+No+%3A+25457+-+09%3A50%0A%
0AVol+Retour+%3A+Le+10%2F07%2F2009+de+Paris+%C3%A0+Toulouse+%3A+%0A%09+A
ir+France+-+No+%3A+7892+-+07%3A35%0A%0AA+bientot+sur+VoyageSopra.com+%21
</body>
 
</html>
 
Extract of the log :
10:37:49,252 | DEBUG | pool-flow.seda.servicemix-mail-thread-11 |
SedaQueue                | .jbi.nmr.flow.seda.SedaQueue$1  132 |
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1@a96eba dequeued
exchange: InOut[
  id: ID:172.31.196.135-1223f9b50e0-2:3
  status: Done
  role: provider
  service: MailService
  endpoint: senderEndpoint
  in: <html>
 
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<META content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head> 
<body>Bonjour%2C+%0A%0AVoici+le+r%C3%A9capitulatif+de+votre+r%C3%A9serva
tion+%3A%0ANombre+de+voyageurs+%3A2%0AVol+Aller+%3A+Le+01%2F07%2F2009+de
+Toulouse+%C3%A0+Paris+%3A+%0A%09Air+France+-+No+%3A+25457+-+09%3A50%0A%
0AVol+Retour+%3A+Le+10%2F07%2F2009+de+Paris+%C3%A0+Toulouse+%3A+%0A%09+A
ir+France+-+No+%3A+7892+-+07%3A35%0A%0AA+bientot+sur+VoyageSopra.com+%21
</body>
 
</html>
 
  out: <?xml version="1.0" encoding="UTF-8"?><ack/>
]
10:37:49,268 | DEBUG | pool-flow.seda.servicemix-mail-thread-11 |
MailComponent            | emix.common.AsyncBaseLifeCycle  561 |
Received exchange: status: Done, role: provider

RE: Servicemix adding and removing tags in messages

Posted by Madesclair Vivian <vm...@sopragroup.com>.
Anyone has any insights about this? The fact that it removes my tag is quite annoying a behavior.

Best regards,
Vivian


-----Message d'origine-----
De : Madesclair Vivian [mailto:vmadesclair@sopragroup.com] 
Envoyé : vendredi 3 juillet 2009 11:04
À : users@servicemix.apache.org
Objet : Servicemix adding and removing <META> tags in messages

Hello,
 
I am working on a SA that receive HTTP post requests and send emails with the content of the request. The content is HTML, and I have to encode it in UTF-8 (otherwise special characters raise exception in smx). The issue I got, is that the mail I receive are not decoded and still in plain UTF-8.
 
It seems that smx is adding <META> tag to the message (I know that because I looked at the debug output). So when I put myself a <META> in my html stating that this is UTF-8, the message in smx contains 2 <META> (stating the same thing). Finally, when the message is given to the mail component, these two tags are removed and not send in the email.
 
I don't really get it. Why is servicemix modifying the initial message?
I thought it should only work on the JBI wrappers... Which by the way seem absent here. See ressources provided at the end of the mail.
 
And also, if the message I send is not xml-like but plain text, servicemix throw an exception (I don't remember what it says though).
 
Regards,
Vivian
 
 
My HTTP consumer bean :
<http:consumer  service="httpMailService"
     endpoint="httpMail"
     targetService="MailService"
     targetEndpoint="senderEndpoint"
     locationURI="http://0.0.0.0:8192/jbi/Mail/" />
 
Mail received :
<html>
 
<head>
 

</head>
<body>Bonjour%2C+%0A%0AVoici+le+r%C3%A9capitulatif+de+votre+r%C3%A9serva
tion+%3A%0ANombre+de+voyageurs+%3A2%0AVol+Aller+%3A+Le+01%2F07%2F2009+de
+Toulouse+%C3%A0+Paris+%3A+%0A%09Air+France+-+No+%3A+25457+-+09%3A50%0A%
0AVol+Retour+%3A+Le+10%2F07%2F2009+de+Paris+%C3%A0+Toulouse+%3A+%0A%09+A
ir+France+-+No+%3A+7892+-+07%3A35%0A%0AA+bientot+sur+VoyageSopra.com+%21
</body>
 
</html>
 
Extract of the log :
10:37:49,252 | DEBUG | pool-flow.seda.servicemix-mail-thread-11 |
SedaQueue                | .jbi.nmr.flow.seda.SedaQueue$1  132 |
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1@a96eba dequeued
exchange: InOut[
  id: ID:172.31.196.135-1223f9b50e0-2:3
  status: Done
  role: provider
  service: MailService
  endpoint: senderEndpoint
  in: <html>
 
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> <META content="text/html; charset=UTF-8" http-equiv="Content-Type"> </head> <body>Bonjour%2C+%0A%0AVoici+le+r%C3%A9capitulatif+de+votre+r%C3%A9serva
tion+%3A%0ANombre+de+voyageurs+%3A2%0AVol+Aller+%3A+Le+01%2F07%2F2009+de
+Toulouse+%C3%A0+Paris+%3A+%0A%09Air+France+-+No+%3A+25457+-+09%3A50%0A%
0AVol+Retour+%3A+Le+10%2F07%2F2009+de+Paris+%C3%A0+Toulouse+%3A+%0A%09+A
ir+France+-+No+%3A+7892+-+07%3A35%0A%0AA+bientot+sur+VoyageSopra.com+%21
</body>
 
</html>
 
  out: <?xml version="1.0" encoding="UTF-8"?><ack/> ]
10:37:49,268 | DEBUG | pool-flow.seda.servicemix-mail-thread-11 |
MailComponent            | emix.common.AsyncBaseLifeCycle  561 |
Received exchange: status: Done, role: provider

Re: Servicemix adding and removing tags in messages

Posted by Guillaume Nodet <gn...@gmail.com>.
I don't think the META tag is added by ServiceMix.  ServiceMix does
not alter the content of the message usually.
The first thing would be to clearly identify who is adding this meta
tag.  In the debug log, you should see the content of the http request
received by servicemix-http.  Additionally, you could set up tcpmon
(http://ws.apache.org/commons/tcpmon/) to check the raw http request
and make sure the meta tag is not present.

For the encoding problem, the encoding should be set as an HTTP
header, not in the content of the html I think.

On Fri, Jul 3, 2009 at 11:04, Madesclair
Vivian<vm...@sopragroup.com> wrote:
> Hello,
>
> I am working on a SA that receive HTTP post requests and send emails
> with the content of the request. The content is HTML, and I have to
> encode it in UTF-8 (otherwise special characters raise exception in
> smx). The issue I got, is that the mail I receive are not decoded and
> still in plain UTF-8.
>
> It seems that smx is adding <META> tag to the message (I know that
> because I looked at the debug output). So when I put myself a <META> in
> my html stating that this is UTF-8, the message in smx contains 2 <META>
> (stating the same thing). Finally, when the message is given to the mail
> component, these two tags are removed and not send in the email.
>
> I don't really get it. Why is servicemix modifying the initial message?
> I thought it should only work on the JBI wrappers... Which by the way
> seem absent here. See ressources provided at the end of the mail.
>
> And also, if the message I send is not xml-like but plain text,
> servicemix throw an exception (I don't remember what it says though).
>
> Regards,
> Vivian
>
>
> My HTTP consumer bean :
> <http:consumer  service="httpMailService"
>     endpoint="httpMail"
>     targetService="MailService"
>     targetEndpoint="senderEndpoint"
>     locationURI="http://0.0.0.0:8192/jbi/Mail/" />
>
> Mail received :
> <html>
>
> <head>
>
>
> </head>
> <body>Bonjour%2C+%0A%0AVoici+le+r%C3%A9capitulatif+de+votre+r%C3%A9serva
> tion+%3A%0ANombre+de+voyageurs+%3A2%0AVol+Aller+%3A+Le+01%2F07%2F2009+de
> +Toulouse+%C3%A0+Paris+%3A+%0A%09Air+France+-+No+%3A+25457+-+09%3A50%0A%
> 0AVol+Retour+%3A+Le+10%2F07%2F2009+de+Paris+%C3%A0+Toulouse+%3A+%0A%09+A
> ir+France+-+No+%3A+7892+-+07%3A35%0A%0AA+bientot+sur+VoyageSopra.com+%21
> </body>
>
> </html>
>
> Extract of the log :
> 10:37:49,252 | DEBUG | pool-flow.seda.servicemix-mail-thread-11 |
> SedaQueue                | .jbi.nmr.flow.seda.SedaQueue$1  132 |
> org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1@a96eba dequeued
> exchange: InOut[
>  id: ID:172.31.196.135-1223f9b50e0-2:3
>  status: Done
>  role: provider
>  service: MailService
>  endpoint: senderEndpoint
>  in: <html>
>
> <head>
> <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
> <META content="text/html; charset=UTF-8" http-equiv="Content-Type">
> </head>
> <body>Bonjour%2C+%0A%0AVoici+le+r%C3%A9capitulatif+de+votre+r%C3%A9serva
> tion+%3A%0ANombre+de+voyageurs+%3A2%0AVol+Aller+%3A+Le+01%2F07%2F2009+de
> +Toulouse+%C3%A0+Paris+%3A+%0A%09Air+France+-+No+%3A+25457+-+09%3A50%0A%
> 0AVol+Retour+%3A+Le+10%2F07%2F2009+de+Paris+%C3%A0+Toulouse+%3A+%0A%09+A
> ir+France+-+No+%3A+7892+-+07%3A35%0A%0AA+bientot+sur+VoyageSopra.com+%21
> </body>
>
> </html>
>
>  out: <?xml version="1.0" encoding="UTF-8"?><ack/>
> ]
> 10:37:49,268 | DEBUG | pool-flow.seda.servicemix-mail-thread-11 |
> MailComponent            | emix.common.AsyncBaseLifeCycle  561 |
> Received exchange: status: Done, role: provider
>



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com