Event Notifications

Discussions related to SoftPro Select Server development.

Moderator: Phil Barton

roteague
Posts: 292
Joined: Thu Sep 25, 2008 4:49 pm
Location: Honolulu, Hawaii

Event Notifications

Post by roteague »

Can someone point me to where I can find a list of Event Notifications I can subscribe to?

Specifically, in the help file we have:

Code: Select all

<Subscriptions xmlns="http://schemas.softprocorp.com/select/integration/registration/2008/04">
  <Subscription eventid="C4EDBD4F-F11D-4C48-BE08-8C105181F5C9">
      <Filter>/OrderChangedEvent[OrderNumber="12345"]</Filter>
      <Transform />
      <DeliveryKind>soap11</DeliveryKind>
      <DeliveryAddress>http://localhost/serverTestAsmx/service1.asmx</DeliveryAddress>
  </Subscription>
</Subscriptions>
This particular event is for a specific order, which doesn't do me a lot of good. I need to subcribe to an "OrderChangedEvent" for ALL orders.

Thanks,
Robert
roteague
Posts: 292
Joined: Thu Sep 25, 2008 4:49 pm
Location: Honolulu, Hawaii

Re: Event Notifications

Post by roteague »

I think I may have found something in one of the sample projects (EventListener). It looks like if I omit the Filter I can get what I want.

Code: Select all

<Subscriptions xmlns="http://schemas.softprocorp.com/select/integration/registration/2008/04">
	<Subscription eventid="C4EDBD4F-F11D-4C48-BE08-8C105181F5C9">
	    <Filter />
	    <Transform />
	    <DeliveryKind>soap12</DeliveryKind>
	    <DeliveryAddress>http://localhost:8000/ListenerService.svc</DeliveryAddress>
	</Subscription>
</Subscriptions>
I can then load an XML document with the the args parameter, where the Order ID is available. The question is, if the event is set as above, under what cirumstances will it fire? When the order is saved, or when it is changed? Or??

Thanks,
Robert
Mark McKenna

Re: Event Notifications

Post by Mark McKenna »

The OrderChanged event fires whenever any ProForm order is changed and those changes are saved/committed. You are able to subscribe to that event and, at the same time, provide an optional XPath filter that targets event instances matching the criteria that you specify (as noted in your second post). Our notification system will use this subscription information to determine whether or not to deliver a particular notification to your web service or email address for the event that was fired. For example, in the subscription sample you provided in your original post, the web service notification would only be delivered if the Order number is exactly "12345". If no filter is provided, as in your second post, than a notification would be delivered for every Order that is changed and saved.

To view the events to which you may subscribe, enter the following SPS command:

Code: Select all

sps.exe services /s:http://yourserverlocation/SelectServer 
This will provide a listing of the services currently installed on your Select Server, as well as the events that are defined for each one. Note the OrderChanged event entry provided by the OrderTracking service - its ID is the "eventid" attribute of the Subscription element in your subscription sample. You can subscribe to any event by simply associating a new subscription with the ID of the appropriate event.
roteague
Posts: 292
Joined: Thu Sep 25, 2008 4:49 pm
Location: Honolulu, Hawaii

Re: Event Notifications

Post by roteague »

Thanks Mark, that helps a lot. Have a great weekend.
Robert
roteague
Posts: 292
Joined: Thu Sep 25, 2008 4:49 pm
Location: Honolulu, Hawaii

Re: Event Notifications

Post by roteague »

Well, I'm trying to get the functionality to work, but without success so far. My XML file is as follows:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<Subscriptions xmlns="http://schemas.softprocorp.com/select/integration/registration/2008/04">
  <Subscription eventid="CDD7DDDD-FA60-449e-882C-927E7FF1E8F1">
    <Filter />
    <Transform />
    <DeliveryKind>smtp</DeliveryKind>
    <DeliveryAddress>email@email.com</DeliveryAddress>
  </Subscription>
</Subscriptions>
I checked to see if there was an event listed with the GUID in the XML file, and there is.

Next, I modified an Order and waited for the notification to be delivered. Nothing so far.

Any ideas on what I am missing here?

Thanks,

Robert
Robert
Mark McKenna

Re: Event Notifications

Post by Mark McKenna »

Hi Robert,

The OrderChanged event has a known constant ID of C4EDBD4F-F11D-4C48-BE08-8C105181F5C9, as you provided in your prior posts. Your subscription to that event must be associated with this ID value. Also be sure that the DeliveryAddress element contains a valid email address and that the sender address is not being blocked by any Spam filters (on the receiving side or on the SMTP side). The sender email address is specified (and can be changed) in the web config for your IIS SelectServer installation.

Further, you can monitor the Event Viewer on the IIS machine for any notification problems encountered. By default, we (try to) log warnings and errors to the Windows Event Log under the source "Select Server". I say "try" because the Windows Event Log is limited in size and your particular settings will determine what to do if the size is about to be exceeded. As such, you may need to clear the log before attempting your tests. We do provide other logging destination options (disk file, database) but they are turned off by default. These logging mechanisms are also configured via the web config file.

Let me know if that helps. If you're still having problems, please execute the SPS commands "services" and "events" and provide the relevant output in your post. Note that "events" does not list the events to which you may subscribe, rather, it lists the registered subscriptions to the events currently available.
roteague
Posts: 292
Joined: Thu Sep 25, 2008 4:49 pm
Location: Honolulu, Hawaii

Re: Event Notifications

Post by roteague »

Mark,

That helped a lot. I'm not sure how or why the ID got changed, but I changed it back. I didn't get the email on my next attempt, but an event log entry told me why - I was missing the "From" address. I set the address, but failed due to the anti-virus program blocking it. As soon as I can figure out how to disable the anti-virus program I should get the message.

Thanks for all your help,

Robert
Robert
roteague
Posts: 292
Joined: Thu Sep 25, 2008 4:49 pm
Location: Honolulu, Hawaii

Re: Event Notifications

Post by roteague »

While I am waiting on the network guys to help me get the proper port unblocked, I am working on the next piece. Consuming an event using a Listener Service WCF. I created a ListenerService in C# similar to the one in your sample code (different namespace).

Whenver I make a change to an order, I get the following error in my event log:

Code: Select all

There was no endpoint listening at http://localhost/TGNotificationServiceListener/ListenerService.asmx that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
The remote server returned an error: (404) Not Found.
The XML is formatted as:

Code: Select all

<Subscriptions xmlns="http://schemas.softprocorp.com/select/integration/registration/2008/04">
  <Subscription eventid="C4EDBD4F-F11D-4C48-BE08-8C105181F5C9">
    <Filter />
    <Transform />
    <DeliveryKind>soap12</DeliveryKind>
    <DeliveryAddress>http://localhost/TGNotificationServiceListener/ListenerService.svc</DeliveryAddress>
  </Subscription>
</Subscriptions>
These are the events I have registered:

Code: Select all

C:\Program Files\SoftPro\Select 2.2>sps events /s:http://localhost/SelectServer
/user:admin,Passw0rd
ID                                   Event                                Filter
 Delivery Address
------------------------------------ ------------------------------------ ------
 -------- -------
15558e5a-f704-4063-9cb3-f4b00842b790 c4edbd4f-f11d-4c48-be08-8c105181f5c9
 Smtp     rteague
2e87d709-3c85-4abe-ad8c-e16bf05dac7d c4edbd4f-f11d-4c48-be08-8c105181f5c9
 Soap12   http://
It looks like it is looking for an asmx, not a svc.

Any help would be appreciated,

Robert
Robert
Mark McKenna

Re: Event Notifications

Post by Mark McKenna »

Robert, since the delivery address is being cut off in the SPS output, would you please verify the entry in your database. We record the subscriptions in a table called EventSubscription. In your case, you should have 2 records - only 1 of which is SOAP related. Let's make sure that address is what we think it ought to be.

Also, while you're at it, let's also be sure your WCF service is active by attempting to visit http://localhost/TGNotificationServiceL ... ervice.svc from a web browser that is on the same machine as your IIS installation.

There may be one other culprit. If that ASMX address was ever a registered subscriber to the OrderChanged event while you were developing/testing, and the event fired on our system, we would have queued up the notification in another table called EventNotification. Perhaps that failed entry is still sitting in there being retried every time the event fires, creating the Error Log entry each time. Look in that table, too - essentially we "copy over" the subscription information into the queuing table as a new record at the time the event fired (so there will be a DeliveryAddress value to look at).

Mark
roteague
Posts: 292
Joined: Thu Sep 25, 2008 4:49 pm
Location: Honolulu, Hawaii

Re: Event Notifications

Post by roteague »

Thanks Mark, I'll go back and look at that. I unregistered all the events and re-registered only the .asmx one (soap11) so I could continue working, which works just fine. Currently, my EventNotification table is empty, and I only have one entry in the EventSubscription table.

BTW, going to the .svc in the browser works fine.

We are still in initial phases of our work, so no decision has been made as to which version we will use - .asmx or .svc. That is why I'm trying to get both to work.
Robert
Post Reply