Invalid content type for AS2 messages
Recently I ran into an issue with the Http ContentType used when sending messages using the As2EdiSend pipeline.
Using the standard out-of-the-box pipeline, the web content type will be set to “application/EDI-EDIFACT“, regardless of the value supplied in the Party as AS2 Receiver configuration. If your trading partner is using BizTalk as well, this is not an issue, as BizTalk, and probably some other AS2 servers, do not consider the content type before routing the AS2 payload for further parsing by an EDI interpreter.
However, our trading partner uses a specific AS2 server, Axway, that will only route to the EDI sub-system if the content type is, quite correctly, “application/EDIFACT” (note the small difference). This is the correct value, according to the RFC (link – see Section 4.2).
Our workaround was to add a custom pipeline component in between the EDI Assembler stage and the AS2 Encoder stage in a custom Pipeline. This custom component only does one thing, clears the IBaseMessage.BodyPart.ContentType property of the current message stream:
IBaseMessagePart bodyPart = pInMsg.BodyPart;
if ((bodyPart != null))
{
// Override the default content type with the one we want to use
pInMsg.BodyPart.ContentType = "";
}
return pInMsg;
By default, the EDI Assemble stage allocates a default value of “application/EDI-EDIFACT”. The AS2 Encoder will lookup the appropriate content type to use from the Party configuration, but only if the content type has not been supplied. As the EDI stage has already allocated a value, this “optional” value is rendered useless. By “clearing” the default value, we allow the AS2 stage to use the appropriate value
-
Archives
- November 2009 (1)
- September 2009 (1)
- August 2009 (2)
- July 2009 (2)
- June 2009 (1)
- April 2009 (2)
- March 2009 (2)
- February 2009 (1)
- January 2009 (1)
- September 2008 (3)
- August 2008 (4)
-
Categories
-
RSS
Entries RSS
Comments RSS


