Correct me if I'm wrong, but I think somebody broke something on the
SoapEnvelope in SP1. The Addressing components no longer save their state
properly to the XmlDocument contained in the SoapEnvelope. It also shows
signs of not being reentrant on GetXml().
To reproduce, do this:
using Microsoft.Web.Services2;
using Microsoft.Web.Services2.Addressing;
using Microsoft.Web.Services2.Messaging;
using System.Diagnostics;
private void button2_Click(object sender, System.EventArgs e)
{
SoapEnvelope _env = new SoapEnvelope();
_env.Context.Addressing.To = new To( new System.Uri(
"http://www.somebody.com/xyz" ) );
_env.Context.Addressing.Action = new Action("urn:someAction");
_env.Context.Addressing.FaultTo = new FaultTo( new System.Uri(
"http://www.me.com/xyz" ));
_env.Context.Addressing.ReplyTo =new ReplyTo( new System.Uri(
"http://www.me.com/xyz" ) );
//_env.Context.Addressing.GetXml( _env );
_env.Save( "test.xml" );
Process.Start( "explorer.exe" , "test.xml" );
}
Run that, and you get this:
<?xml version="1.0" encoding="utf-8" ?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body />
</soap:Envelope>
Now, uncomment the line "_env.Context.Address.GetXml(_env);" , run it and
you get this:
<?xml version="1.0" encoding="utf-8" ?>
<soap:Envelope xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<wsa:Action>urn:someAction</wsa:Action>
<wsa:FaultTo>
<wsa:Address>http://www.me.com/xyz</wsa:Address>
</wsa:FaultTo>
<wsa:MessageID>uuid:3e558373-add2-48ee-9cf8-8a454eeb8079</wsa:MessageID>
<wsa:ReplyTo>
<wsa:Address>http://www.me.com/xyz</wsa:Address>
</wsa:ReplyTo>
</soap:Header>
<soap:Body />
</soap:Envelope>
So you say, "well great. You've found a workaround". Not so fast. With
the fix above, if I send the envelope to a SoapReceiver endpoint that
doesn't even exist, my SoapFault endpoint is never notified there has been a
problem.
How screwy is this, when the SoapEnvelope doesn't even serialize properly
untiil I apply a hack, and then it breaks something else? Can this be
trusted for production systems?
Hervey Wilson [MSFT] - 25 Sep 2004 18:17 GMT
This is by design. For outbound messages, the SoapContext attached to a
SoapEnvelope represents data that is to be used as instructions to the
Pipeline and SoapOutputFilters to amend the content of the envelope. For
example, adding security tokens and signatures to the SoapContext does not
directly amend the content of the SoapEnvelope; only when the envelope is
passed through the filter chain is it modified to reflect the instructions
in the SoapContext. To correctly process an SoapEnvelope and it's
SoapContext, you must therefore pass the envelope through the Pipeline using
Pipeline.ProcessOutputMessage.

Signature
This posting is provided "AS IS", with no warranties, and confers no rights.
> Correct me if I'm wrong, but I think somebody broke something on the
> SoapEnvelope in SP1. The Addressing components no longer save their state
[quoted text clipped - 59 lines]
> untiil I apply a hack, and then it breaks something else? Can this be
> trusted for production systems?