DEV Community

Rachel Soderberg
Rachel Soderberg

Posted on • Updated on

Testing a C# Web Service Connection to a Salesforce Outbound Message

Welcome to Part 2 of my Salesforce Outbound Messages series! At this point, I am going to assume you have an Outbound Message in Salesforce that fails when you create a new Quote and a Web Service that compiles successfully. If you don't have both of those ready, go back to Part 1 so you can get up to speed (don't worry, we'll wait!): Salesforce Outbound Messages Part 1


The first thing you'll need to connect your Web Service and Outbound Message is an endpoint - since our service isn't processing actual data yet we'll technically need two "endpoints." If that sounds confusing, don't worry, it's more simple than you think.

First load your web service project and run your service; in my case this is called QuoteService.svc. If you've done everything correctly, the WCF Test Client should launch. Copy the localhost address that looks something like http://localhost:63881/QuoteService.svc. Note: Keep the WCF Test Client running.

WCF Test Client

Launch SoapUI and create a New SOAP Project, pasting the web service address you just copied into the Initial WSDL field with ?wsdl at the end like so: http://localhost:63881/QuoteService.svc?wsdl
Check Create Requests and click OK. You'll find your new Soap Envelope a few levels down in the navigation bar, called Request 1.

SoapRequest

Leave the Soap Envelope as-is for now and navigate to PutsReq.com. If you aren't familiar with PutsReq, it is a website that lets you record HTTP requests and fake responses, and forward requests. This allows us to see the data that would have been passed from our Salesforce Outbound Message to our Web Service if it were completely set up. Create a PutsReq and copy the provided PutsReq URL at the top. Paste this URL into your Salesforce Outbound Message Endpoint URL in place of the dummy URL you provided in Part 1. Note: If you click the PutsReq URL, it should take you to an otherwise empty page that says "Hello World" in the top left corner.

PutsReq URL

Create a new Quote in Salesforce. If you used the NOT( ISBLANK( Order_XML__c ) ) Rule Criteria for your Workflow Rule, be sure to set the Order XML field on the new Quote to something (I set mine to "NOT BLANKVALUE"). This Quote will still show up as failed in the Outbound Messaging Delivery Status, but you should see a new Request on PutsReq.

Along with this new Request, there should be a POST section at the bottom of PutsReq with a Soap Envelope:

PutsReq Post

You may have noticed this Soap Envelope looks much like the one that was generated in SoapUI a few steps ago. You are correct! Copy this and paste it into SoapUI, replacing their boilerplate code.

Hopefully your WCF Test Client is still running in the background - if it's not you'll get errors with the Soap Request, so go run your Web Service again. Click submit (the little Play button) on your Soap Request and wait a few moments. If everything is set up correctly, you will be notified in the right panel with a True Ack.

Final Soap Request


The next step, which I'll take you through in Part 3 of this series, is adding more fields so your Outbound Message can be more useful.

Top comments (1)

Collapse
 
free9ja profile image
free9ja

I get the 404 Error. Is there something I am missing?