Testing SOAP Outbound Messages without failures
As suggested by Salesforce documents, one can use services like requestb.in or inspectb.in to test outbound messages. But these services are pretty generic, so they just return a 200/OK response for any inbound request. For an outbound message to be considered delivered successfully by Salesforce, it needs an SOAP XML response with “Ack = true” in the following format:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<notificationsResponse xmlns="http://soap.sforce.com/2005/09/outbound">
<Ack>true</Ack>
</notificationsResponse>
</soapenv:Body>
</soapenv:Envelope>
Without the above XML response, outbound messages show the following error:
“org.xml.sax.SAXParseException: Content is not allowed in prolog.”
Such failed outbound messages are also marked for RETRY; each retry adds delay for each subsequent failure, which will always happen with requestb.in, as they will never give the expected response to Salesforce. You can watch the success/failure of outbound messages in the Salesforce setup area, as shown below:
Setup > Administration Setup > Monitoring > Outbound Messages
So, after a while of testing with request/inspect bin you will realize that you are getting too many repeated messages in requestbin. It will get very confusing for developers and testers to figure out which one really makes sense for the situation.
Live Demo
You can check this video for more details and a quick demo:
Solution?
Requestbin/Inspectbin are logging SOAP messages in a great way; we don’t need to change that. A wrapper service is needed here, which could sit between Salesforce and requestbin. This service will send the original request to requestbin, but return back the acknowledgment XML response Salesforce is expecting.
For example:
http://sfdcutils.appspot.com/ombin?endpoint=http://inspectb.in/2552ba0f
Here feed “endpoint” parameter with a URL from any of your favorite requestbin/inspectbin or similar services; the rest should be awesome!