[TestMethod]
public void When_I_have_Nothing()
{
// Create factory.
ChannelFactory<IRequestChannel> factory = new ChannelFactory<IRequestChannel>(new BasicHttpBinding(),
"http://localhost:8080/BusService");
// Creates the native channel.
IRequestChannel requestChannel = factory.CreateChannel();
//
// Creates the body writer, which will build the message for you.
// This is what ServiceModel does.
DynamicBodyWriter bodyWriter = new DynamicBodyWriter("Send",
new string[] {"requestMessage", "idmessageId", "version", "action", "topic"},
new object[] { "first parameter as string", "second param as string",
"third param as string", "fourth param", "last param" },
"http://daenet.eu/servicebus");
//
// Creeates the message.
// More about message creation: http://developers.de/blogs/damir_dobric/archive/2006/07/16/746.aspx
Message msg = Message.CreateMessage(MessageVersion.Soap11,
"http://daenet.eu/servicebus/Send",
bodyWriter);
// Invokes the operation.
Message response = requestChannel.Request(msg);
//
// Shows how to parse the result contained in the response message.
using (XmlDictionaryReader reader = response.GetReaderAtBodyContents())
{
string a = (string)reader.ReadContentAs(typeof(string), null);
}
}