+ Start a Discussion
Jeff C.ax327Jeff C.ax327 

Building a Listener in C# and configuring Outbound Messaging

I have tried using the simple example of building a listener in the Outbound Messaging section of the API developer doc.  But I must be truly missing something.  Is there a more thorough example somewhere?
 
I have successfully downloaded and used the Enterprise and Partner WSDL interfaces to update SalesForce objects from my web app, but when I try to include a listener to accept SalesForce Outbound Messaging calls, things don't seem to jive.
 
There seem to be some typos in the Building a Listener section, because my code doesn't find an INotificationBinding object to implement, and other file and class names earlier in the text are inconsistent.
 
Also, I don't see how this listener accepts and processes my particular outbound message.  Where and how do I access the information in the message? (parameter values, etc.)
 
Also, when I specify the endpoint in SalesForce, do I just point to my server and the virtual directory of my application, or do I include the name of the web service too?
 
Obviously I am quite new at this and could really use more detailed info.  Any help is greatly appreciated.
 
(Using ASP.net 2.0 and C# and SalesForce Unlimited)
 
Jeff C.ax327Jeff C.ax327

Okay, I've managed to address one of my problems...

The online documentation states that we should issue the following command and the .net command prompt:  wsdl.exe /serverInterfaceleads.wsdl

There is a space missing between serverInterface and leads.wsdl   It should read: wsdl.exe /serverInterface leads.wsdl

I noticed that this typo does not exist in the PDF version of the APEX documentation.  With the command line switch properly included, the  INotificationBinding  interface type does in fact show up.

I'm still struggling with the remaining items in my post, though...

 

Jeff C.ax327Jeff C.ax327

When I add a reference to the compiled listener dll (nsi.dll)  my Enterprise and Partner web services throw compile errors like:

   Error 'sObject' does not contain a definition for 'Any'

...and when I remove the reference, everything compiles fine.  I take it that a Listener web service cannot live in the same project as the Partner and Enterprise web services???  anyone?

Benjamin_PirihBenjamin_Pirih
This sounds like a namespace confilct between your new dll.. which contains an object called sObject and the enterprise partner webserice which also contains this object.  Try playing with the namespace on the outbound messaging service created and see if you can get this to resolve..  I have a feeling everything is falling under the default namespace which would cause you this problem.. Just my two cents.. Good Luck..
Benjamin_PirihBenjamin_Pirih

add a namespace to the created interface class before you create the dll..

here it is the sobject redeclare in your interface class..  You will want to add a namespace to this..

[System.SerializableAttribute()]

[System.Diagnostics.DebuggerStepThroughAttribute()]

[System.ComponentModel.DesignerCategoryAttribute("code")]

[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://soap.sforce.com/2005/09/outbound")]

public partial class TaskNotification {

private string idField;

private Task sObjectField;

/// <remarks/>

public string Id {

get {

return this.idField;

}

set {

this.idField = value;

}

}

/// <remarks/>

public Task sObject {

get {

return this.sObjectField;

}

set {

this.sObjectField = value;

}

}

}