function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
NigilNigil 

A detail example of building a Listener in asp.net C#..

Hi Guys,
 
I am having issues with the listener that I am building rite now..
 
I have follow the AppExchange Developer Network Help File on building the Listener as follow...
but when come to INotificationBinding.. I am lost..
 
Can anyone show me a detail example.
 
Best Regards,
Nigil Chua
 
Once you have defined an outbound message and configured an outbound messaging endpoint, download the WSDL and create a listener:
  1. Right-click Click for WSDL and select Save As to save the WSDL to a local directory with an appropriate filename. For example, for an outbound message that deals with leads, you could name the WSDL file leads.wsdl.
  2. Unlike the enterprise or partner WSDLs, which describe the messages the client sends to Salesforce, this WSDL defines the messages that Salesforce will send to your client application.
  3. Most web services tools will generate stub listeners for you, in much the same way as they generate a client stub for the enterprise or partner WSDL. Look for a server side stub option.
    For example, for .Net 2.0:
    1. Run wsdl.exe /serverInterfaceleads.wsdl with .Net 2.0. This generates NotificationServiceInterfaces.cs, which defines the notification interface.
    2. Create a class that implements NotificationServiceInterfaces.cs.
    3. You implement your listener by writing a class that implements this interface. There are a number of ways to do this. One simple way is to compile the interface to a DLL first (DLLs need to be in the bin directory in ASP.NET:
      mkdir bin
      csc /t:library /out:bin\nsi.dll NotificationServiceInterfaces.cs      
      Now write an ASMX based web service that implements this interface. For example, in MyNotificationListener.asmx:
              <%@WebService class="MyNotificationListener" language="C#"%>
               class MyNotificationListener : INotificationBinding
               {            public notificationsResponse notifications(notifications n)
                            {
                                   notificationsResponse r = new notificationsResponse();
                                   r.Ack = true;
                                   return r;
                             }
               }
      This example is a simple implementation, actual implementations will be more complex.
    4. Deploy the service by creating a new virtual directory in IIS for the directory that contains the MyNotificationListener.asmx.
    5. You can now test that the service is deployed by viewing the service page with a browser. For example, if you create a virtual directory salesforce, you'd go to http://localhost/salesforce/MyNotificationListener.asmx.

    The process for other web service tools is similar, please consult the documentation for your web service tool. For Axis, we recommend version 1.1 or later.

Your listener must meet these requirements:
  • Must be reachable from the public Internet.
  • If you use SSL, you must use port 443, and you must have a real certificate. If you certificate expires, message delivery will fail.
SuperfellSuperfell
What are you having issues with?
NigilNigil

Hi there.. thanks for your reply

Is the Listener only meant for .net 2.0? can it work with .net 1.1?
When I following the help file example.. I got the following message

Error 1 The type or namespace name 'INotificationBinding' could not be found (are you missing a using directive or an assembly reference?) c:\inetpub\wwwroot\SalesForce\WebService.asmx 2 41 http://localhost/SalesForce/

Please advise..

Best Regards,
Nigil Chua

NigilNigil

Hi there..

I have managed to get it worked on .net 2.0. just wondering if .net 1.1 is able to do so.. cos I having issue with the
implementing the binding to receive the notifications on .net 1.1

Please advise,
Nigil Chua
 

SuperfellSuperfell
The example in the docs, as it notes is for .NET 2.0, you need to do something different for .NET 1.1 see http://www.pocketsoap.com/weblog/2007/02/1740.html for the details.
NigilNigil
Hi Simon..
 
thanks.. just got it working on .net 1.1 on the same url u gave me... btw
I am having issues wif documentation at salesforce.com... is there any centralise site where I can find my answers etc.... cos I have to dig into the discussion board,blog getting started etc just to search for help.
 
Best Regards,
Nigil Chua
SuperfellSuperfell
documentation for what? The API docs covers all the API and include a large number of samples, the samples are for .NET 2.0, which at this point is over 2 years old, so not entirely unreasonable to assume most people have moved to it.
TraceyTracey

Hi Simon

I have trouble using this command Run wsdl.exe /serverInterfaceleads.wsdl.

Can't I just add it was a web service within my project.

Thanks

Stephen

SuperfellSuperfell
wsdl.exe /serverInterface file.wsdl


No, you can't just add web service in your project, because that creates a web service client, not a server.

Message Edited by SimonF on 04-23-2008 07:25 AM
Steven2005ASteven2005A

Hi Simon

I have a related question, I have everything setup right and webservice runs

but what should I do next to get a result, a response from salesforce?

amit@promactinfo.comamit@promactinfo.com

Hi All,

 

We have configured all that is described in http://wiki.developerforce.com/index.php/Creating_ an_Outbound_Messaging_Notification_Service_with_C...  (ref. http://www.salesforce.com/us/developer/docs/api/in dex.htm). The salesforce configuration for outbound messages works well in my test login because when a related field is updated it does not show any pending list of messages and sends the response to endpoint url without error. But, nothing is available to the web service listener.

Does the method notificationsResponse INotificationBinding.notifications(notifications notifications1) called implicitly by salesforce whenever a messge gets generated or we have to write another code for that? Why the web service is not able to get any response?

 

So, basically from the test scenario:

If we specify a wrong endpoint url and then modify the account details, the outboud messsages get generated with status as delivery failure.

Now, if we correct/rectify the endpoint url and then click on retry for sending outboud messages, the messages get sent immediately.

Now, if we see the log of our IIS to confirm the web service call it gives below status (ok).

#Software: Microsoft Internet Information Services 6.0
#Version: 1.0
#Date: 2010-05-03 03:46:57
#Fields: date time s-sitename s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) sc-status sc-substatus sc-win32-status
2010-05-03 03:46:57 W3SVC1 10.1.81.30 POST /AccountNotificationTest.asmx - 80 - 202.129.242.8 Jakarta+Commons-HttpClient/3.0.1 200 0 0
2010-05-03 03:46:57 W3SVC1 10.1.81.30 POST /AccountNotificationTest.asmx - 80 - 202.129.242.8 Jakarta+Commons-HttpClient/3.0.1 200 0 0

But unfortunately, there is no function call to our web service, and that is confirmed by just writing a test code that just writes a log file in notifications() function when notifications() function has been called.

 

Reference post:

http://community.salesforce.com/t5/NET-Development /Problem-occurs-with-Outbound-Messaging-Notificati ...

 

Hoping for a quick reply, please help.

 

Thanks and Regards,