Home
Find the answer to your question
How do I test my notification listener ?
Summary
By opening up HttpsURLConnection to your Java servlet or jsp based Notification Listener, you can test your listener in your local machine without communicate to eBay Notification server.
To test whether the Java listener is able to respond with a standard URL status using the attached ListernerTestDriver program, you need to follow these steps:
1. Subscribe to the specific notifications by setting the ApplicationURL to a URL that starts with HTTPS in your SetNotificationPreferences request
2. Save the received email notification in your local file system.
3. Set listenerURL, notificationEvent and notificationXmlFileName properties in listener.properties file and execute the java standalone program ListenerTestDriver as below:
java -cp .;%CLASSPATH% ListenerTestDriver
Here is the sample output if your listener is running as expected.
http://localhost:8084/Notification/NotificationServlet
200 OK
Source Code
/*
public class ListenerTestDriver { public static void main(String[] args) throws Exception{ String listenerURL = config.getProperty("listenerURL"); ListenerTestDriver sc = new ListenerTestDriver(); //set-up the connection DataOutputStream out = new DataOutputStream( conn.getOutputStream() ); String fileContent = sc.readFileIntoString(notificationXmlFileName );
}catch (Exception e){ } private String readFileIntoString(String fileName) { |