You need to sign in to do that
Don't have an account?
Outbound message in workflow doesn't seem to be sending a response
I am trying to consume an Outbound Message from Saleforce by sending my workflow to an ashx handler page with the following code:
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/xml";
context.Response.ContentEncoding = System.Text.Encoding.UTF8;
HttpResponse response = null;
response = context.Response;
string sfXMLPayload = "";
Stream strm = response.OutputStream;
StreamReader sr = new StreamReader(strm);
string sfXML = sr.ReadToEnd();
sfXMLPayload = sfXML;
WriteTextFile( sfXMLPayload);
}
public void WriteTextFile(string inputStr)
{
string text = inputStr;
System.IO.File.WriteAllText(@"C:\temp\sfXML.xml", text);
}
I see this error in my Saleforce logs:
org.xml.sax.SAXParseException: Premature end of file.
And the sfXML that is written to the text file is:
System.ArgumentException: Stream was not readable.
at System.IO.StreamReader..ctor(Stream stream, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize)
at System.IO.StreamReader..ctor(Stream stream)
at salesForceReceive.ProcessRequest(HttpContext context)
Well, you're trying to read the response stream, when you should be reading the request stream (and writing to the response stream).
All Answers
Well, you're trying to read the response stream, when you should be reading the request stream (and writing to the response stream).
That must be the WCF equivalent of forgetting a semicolon! Thank you SOOOO much, this has been blocking us for way too long. I knew it was simple, but this is re-defining :)