tags:

views:

15

answers:

0

So I'm using a WCF service using basicHttpBinding with TransportWithMessageCredential. I can authenticate just fine with it from .net to .net. Problem is I want to provide some samples to this third party but everything is encrypted. So I can't just wireshark it and go about my day.

var request = (System.Net.HttpWebRequest)System.Net.WebRequest.Create("https://localhost/service.svc"); string strNewValue;

  request.Headers.Add("SOAPAction","\"http://tempuri.org/Service/GetOrderDetails\"");
  request.ContentType = "text/xml; charset=\"utf-8\"";
  request.Accept = "text/xml";
  request.Method = "POST";

  strNewValue = [really long soap envelope]

  ASCIIEncoding encoding = new ASCIIEncoding();

  byte[] bytesToWrite = encoding.GetBytes(strNewValue);
  //request.ContentLength = bytesToWrite.Length;

  Stream newStream = request.GetRequestStream();
  newStream.Write(bytesToWrite, 0, bytesToWrite.Length);
  newStream.Close();

  HttpWebResponse response = (HttpWebResponse)request.GetResponse();

But i get a "The security protocol cannot verify the incoming message." from the WCF service trace log viewer. A 500 message gets sent back to the client. I've got my security header in there, I have a create timestamp and removed the expires (another site said WCF didn't seem to care it wasn't there). I pulled most of the message out of the trace viewer. So does anyone have any clue what this could be?