2 // Microsoft.Web.Services.Messaging.SoapSender
4 // Author: Todd Berman <tberman@gentoo.org>
6 // (C) 2003 Todd Berman
10 using Microsoft.Web.Services;
11 using Microsoft.Web.Services.Addressing;
12 using Microsoft.Web.Services.Configuration;
14 namespace Microsoft.Web.Services.Messaging {
16 public class SoapSender : SoapPort
19 private EndpointReference _destination = null;
20 private ISoapTransport _transport = null;
22 public SoapSender () : base ()
26 public SoapSender (EndpointReference dest) : base ()
29 throw new ArgumentNullException ("destination");
34 public SoapSender (Uri destination) : this (new EndpointReference (destination))
38 protected override void FilterMessage (SoapEnvelope env)
41 throw new ArgumentNullException ("envelope");
43 Pipeline.ProcessOutputMessage (env);
46 public void Send (SoapEnvelope env)
49 throw new ArgumentNullException ("envelope");
51 if(env.Context.Action == null) {
52 throw new ArgumentException ("Action not set");
54 if(env.Processed == true || env.Context.Processed == true) {
55 throw new ArgumentException ("Attempting to re-process an envelope");
58 if(_destination == null) {
59 throw new ArgumentException ("Destination is not set, cant send");
61 if(_transport == null) {
62 throw new ArgumentException ("Transport is not set, cant send");
65 env.Context.SetTo(_destination.Address);
69 _transport.Send (env, _destination);
73 public IAsyncResult BeginSend (SoapEnvelope env, AsyncCallback callback, object state)
75 throw new NotImplementedException ();
79 public void EndSend (IAsyncResult result)
81 throw new NotImplementedException ();
84 public ISoapTransport Transport {
85 get { return _transport; }
88 public EndpointReference Destination {
89 get { return _destination; }
91 if(value == null || value.Address == null || value.Address.Value == null) {
92 throw new ArgumentNullException ("destination");
94 ISoapTransport trans = WebServicesConfiguration.MessagingConfiguration.GetTransport (value.Address.Value.Scheme);
96 throw new ArgumentException ("Transport " + value.Address.Value.Scheme + " is not supported");