• mcclurec
  • NEWBIE
  • 25 Points
  • Member since 2011

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 7
    Replies

In my Salesforce workflow I have created an outbound message that sends an xml payload to an ASP.Net 4.0 ashx handler page. I can get the payload and parse it the old fashioned way, but with .Net 4.0 using WCF I think there should be an easier way. I have been able to add the WSDL as a web reference and I can access it like a class. So how do I marry the xml to the wsdl so I could presumably do something like:

 

customerHairColor = sfObject.hairColor;

 

Is this possible? I'm just missing the connection between the WSDL and the XML payload. I understand that the WSDL defines the XML, but how do I exploit this and make my code easier.

 

Thanks!!

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)

I think I am close, but I would like to consume the Salesforce Outbound Message from my workflow with .Net 4.0. Can someone share some code that will get me past this speedbump? The only code samples I see are with asmx pages and .Net 2.0! Argh! I'm still wrapping my head around the whole thing, so please respond accordingly. Thank you.

I feel like maybe I'm asking an obvious question, but I'm just stuck. I've been trying to follow along with the Salesforce example of how to build a .Net SOAP listener, but I've hit the wall.  Also, all of the code samples seem outdated and old. Is anyone using .Net 4 to consume a Salesforce SOAP payload? Could you point me to a good example? Thanks in advance.

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)

I feel like maybe I'm asking an obvious question, but I'm just stuck. I've been trying to follow along with the Salesforce example of how to build a .Net SOAP listener, but I've hit the wall.  Also, all of the code samples seem outdated and old. Is anyone using .Net 4 to consume a Salesforce SOAP payload? Could you point me to a good example? Thanks in advance.

Hi, I have created workflow rule & outbound message using metadata api & .Net code and it works fine. when oubound message trigger my webservice I dont get all the fields which I setup in outbound message. which WSDL I should use? either partner or metadata wsdl? Can you please send me sample code for both wsdl. Thanks Mangesh