We are needing to test client functionality and performance against several web services. We have the XML soap requests and corresponding responses in several XML files. I am writing a mock service provider that will simply look at the request object, and then load the appropriate XML file and send it back, as the actual SOAP response. I tried something like this:
public Message GetCelebrityDetailsTest(GetCelebrityDetails rq)
{
var doc = new XmlDocument();
doc.Load(@"F:\Websites\WSP\XML\GetCelebrityDetailsRS.xml");
Message message = Message.CreateMessage(MessageVersion.Soap11, "urn:GetCelebrityDetails", new XmlNodeReader(doc));
var factory = new ChannelFactory<IRequestChannel>("serviceHttpSoap11Endpoint");
var channel = factory.CreateChannel();
Message response = channel.Request(message);
channel.Close();
return response;
}
I added the following to the web.config file
<client>
<endpoint address="http://tul1cstfsw3:8001/ListingsService.svc"
binding="basicHttpBinding" bindingConfiguration="" contract="System.ServiceModel.Channels.IRequestChannel"
name="serviceHttpSoap11Endpoint" />
</client>
When I try to hit this service, I get this response:
<Message>The remote server returned an error: (400) Bad Request.</Message>
<StackTrace>at System.Net.HttpWebRequest.GetResponse()
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)</StackTrace>
Note that the XML file being loaded is a complete, valid SOAP response. Any ideas?