Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 5 of 5

Thread: WSI Events: Sample Client Web and Windows Application

  1. #1
    Rob is offline Senior Member
    Join Date
    Aug 2004
    Posts
    3,037

    Default WSI Events: Sample Client Web and Windows Application

    WSI Events Notification Callbacks

    Beginning in version 7.0.2.0 ML, the AspDotNetStorefront software contains an Event Handler system which will post information to an endpoint URL when certain events occur on the site. This feature is accessed through the admin site at Misc -> EventHandler Parameters.

    This allows you to add WSI automation based on real-time events that occur inside your AspDotNetStorefront storefront site (e.g. new order created).

    The default events supported are:

    ViewProductPage
    ViewEntityPage
    AddToCart
    BeginCheckout
    RemoveFromCart
    CreateCustomer
    UpdateCustomer
    DeleteCustomer
    NukeCustomer
    CreateAccount
    CheckoutShipping
    CheckoutPayment
    CheckoutReview
    NewOrder
    OrderDeleted
    OrderVoided
    OrderShipped
    OrderRefunded

    To enable one or more of these event handlers, go to Misc->Eventhandler Parameters in the admin site, set the Active field to "true" and specify a callout URL.

    NOTE: The callout uses the html POST method

    Users can also create their own event handlers, or modify the existing ones in the default package (event.default.xml.config in the XmlPackages folder). This requires modifying the source code. You will need to first create the event in the admin site, then add the following call to the page or event you want to activate:

    AppLogic.eventHandler("CustomEventName").CallEvent ("SomeRuntimeParams");

    The "CustomEventName" is the exact EventName specified in the admin site when the event was created

    The "RunTimeParams" is an ampersand-delimited string (e.g. "someparam1=sometext&someparam2=othertext"). They are put in the "Runtime" section of the package data document.

    Sample Listener Code

    All callbacks require a listener page on the receiving end to accept the message. Below is a basic sample of a .NET listerner application.

    protected void Page_Load(object sender, System.EventArgs e)

    StringBuilder sb = new StringBuilder();

    int streamLength;

    int streamRead;

    Stream s = Request.InputStream;

    streamLength = Convert.ToInt32(s.Length);

    Byte[] streamArray = new Byte[streamLength];

    streamRead = s.Read(streamArray, 0, streamLength);

    for (int i = 0; i < streamLength; i++)

    {

    sb.Append(Convert.ToChar(streamArray[i]));

    }

    // This assumes that the data is XML however the site admin could have designed

    the output xmlpackage to send delimited text or some other format

    XmlDocument x = new XmlDocument();

    x.LoadXml(sb.ToString());

    // do something with the incoming data


    Sample Client Downloads

    For a sample web and windows client WSI Event listener application, see the WSI documentation at:

    http://manual.aspdotnetstorefront.com/wsi/

    This sample client shows:

    1) Database to store WSI events
    2) Web client to receive events from your storefront
    3) Windows client to process events (usually calling WSI on your storefront for full event data), either polled or async.
    Last edited by AspDotNetStorefront Staff - Scott; 04-15-2010 at 11:46 AM. Reason: corrected old URL
    AspDotNetStorefront
    Shopping Cart

  2. #2
    Attman is offline Junior Member
    Join Date
    Jun 2007
    Posts
    12

    Default Link doesnt work

    Do you have an alt download link - as i cant seem to get this to work i.e. "i get You are not authorized to view this page"

    Is this something i'm doing wrong?
    Last edited by Attman; 02-19-2008 at 03:39 AM.

  3. #3
    pizzle1983 is offline Junior Member
    Join Date
    Mar 2010
    Posts
    2

    Default sample WSI code link

    Is there an alternative url for the sample code somewhere?

    The link (http://www.aspdotnetstorefront.com/d...estProgram.zip) within the WSI manual gives me a 404.

  4. #4
    AspDotNetStorefront Staff - Scott's Avatar
    AspDotNetStorefront Staff - Scott is offline Administrator
    Join Date
    Mar 2007
    Location
    Ashland, OR
    Posts
    2,390

    Default

    Sorry about that, looks like that file was missed when we did the server move yesterday. It's up there now, try again when you get a chance please.

  5. #5
    factorite is offline Junior Member
    Join Date
    Oct 2009
    Posts
    22

    Default Misc -> EventHandler ?

    Note:

    In ML9.0 ( and 8.x ? ) "Misc -> EventHandler " is located in:

    Code:
    Configuration -> Advanced -> Event Handler Configuration
    Last edited by factorite; 05-27-2010 at 11:27 AM.