Hi all,
We are using an email poller for retrieving mails. Every time service with input “contentStream” (object type) is invoked and it works perfect until we got email with Content-Type = text/plain. For this content type service input is null (input variable contentStream is null). We tried to save pipeline and we discovered that on pipeline appeared variable, which name was email body:
<?xml version="1.0" encoding="UTF-8"?>
<IDataXMLCoder version="1.0">
<record javaclass="com.wm.util.Values">
<value name="fileName">emailPoller1x</value>
<null name="This is message body"/>
</record>
</IDataXMLCoder>
When we tried to resotre pipeline, we saw variable “This is message body” with null value.
Service getTransportInfo does not provide body content of email, but others informations are available (like “to”, “from”, dates, “subject” etc).
Does anyone know how to handle this? Is this a bug?
How to process Email is defined in method “wm.server.net.EmailTransaction.processMessage()”.
public void processMessage()
throws Exception
{
String mainType = this.msg.getContentType().toLowerCase();
String subject = this.msg.getSubject();
JournalLogger.logDebugPlus(2, 26, 68, mainType, this.finalService);
if (this.test) {
System.out.println("Content type: " + mainType + "\n" + "Subject: " + subject);
}
if ((this.processMultipartMsgs) && (mainType.startsWith("multipart"))) {
processMultiPart();
} else if ((!this.urlEncodedBody) || (!mainType.startsWith("text/plain")) || (this.msg.getFileName() != null)) {
processSingleMsg();
} else {
processNoFileMsg();
}
}
When the content-type is “text/plain”, method “processNoFileMsg()” might be triggered, and a method “com.wm.app.b2b.server.CGIBinCoder.decode()” would be invoked to decode the message body.
This decode method will tokenize the message body with separator “&” and “=” to parse the inputs. For example the message body “¶m1=value1¶m2=value2” would be parsed to two parameters and pass to the service.
So I guess this decoder must retrieve all your message body as the key name, since you don’t have “=” in your message.
1 Like
Hi Xiaowei Wang,
Thank you very much for quick response. It gave us clue what did we make wrong. It appeared that flag indicating variable “urlEncodedBody” was set to true, which made this strange behaviour (strange to this point).
In attachment is included configuration which shows appropiate flag, which change to false make everything works like charm.
Cheers! Glad you made it.