WSE 2.0 Attachments with SOAP Extension in Play  
Author Message

PostPosted: ASMX Web Services and XML Serialization, WSE 2.0 Attachments with SOAP Extension in Play Top

Attachments added via Microsoft.Web.Services2.SoapContext.Attachments.Add() will break the App if a SOAP Extension implemented using public override Stream ChainStream() technique is in play. Failure is:

“Calling http://localhost/AttachmentsService/Attachments.asmx

****** Exception Raised ******

Web Exception Occured: System.Net.WebException: The request failed with HTTP status 400: Bad Request.”

This failure can be fixed by changing the SOAP Extension implementation to use SoapMessage.message.Headers.Add() instead of the Services2.SoapContext.Attachments.Add() technique. The down side hear is that this breaks RCP encoded SOAP messages. Failure is:

“Conversion Failed System.InvalidOperationException: There was an error generating the XML document. ---> System.InvalidOperationException: The type ovta.MYSoapHeader was not expected. Use the XmlInclude or SoapInclude attribute…” However the use of these attributes do not fix the problem.

Is it valid for me to conclude that I (my SOAP Extension) should just not support WSE 2.0 Attachments and that support for WSE 3.0 MTOM is sufficient

Any comments or potential fixes are welcome.

.NET Development13