This article describes the debugging tool that is used to simulate how MNS pushes messages from a topic to HTTP or HTTPS endpoints. The tool helps you develop and test clients.

Release notes

Python 2.5 to 3.0 (excluding 3.0) is supported by the debugging tool. This tool can run on both Windows and Linux operating systems.

Release date Version New features
2017-05-02 Version 1.0.1
  • Messages can be pushed in the JSON format.
  • The following bug is fixed: The Content-MD5 parameter in the notifymsg_withauth command is invalid.
2016-04-20 Version 1.0.0
  • The notifymsg_withauth command can be used to test the authentication logic on clients.
  • The notifymsg_withoutauth command can be used to test the message processing logic on clients.

Usage notes

Download and decompress the package, and then go to the mns_topic_tool directory.

Test the authentication logic

Send an HTTP or HTTPS request to the endpoint that is specified by the host parameter. You cannot specify other parameters.

  • Command syntax:

    python mns_topic_tool.py notifymsg_withauth --host=http(s)://xxx

  • Sample code:HTTP authentication

Test the message processing logic

Send an HTTP or HTTPS request to the endpoint that is specified by the host parameter. You can specify multiple parameters, such as the body and format parameters.

However, the request does not contain a signature. Therefore, you must specify the authentication logic of the client. Otherwise, the message cannot be processed due to authentication failure.

  • Command syntax:

    python mns_topic_tool.py notifymsg_withoutauth --host=http(s)://xxx [--uri=xxx] [--body=xxx] [--base64=true/false] [--format=xml/simplfied] [--topicowner=xxx] [--topicname=xxx] [--subscriber=xxx] [--subname=xxx] [--pubtime=xxx]

    The following table describes the parameters in the command.

    Parameter Description Default value
    uri The requested URI. /notifications
    body The body of the message. TestMessage
    base64 Specifies whether to perform Base64 encoding on the message. false
    format The content format of the request body. Valid values: xml and simplified. xml
    topicowner The TopicOwner parameter that is specified in the request body of the XML format. TestTopicOwner
    topicname The TopicName parameter that is specified in the request body of the XML format. TestTopicName
    subscriber The Subscriber parameter that is specified in the request body of the XML format. TestSubscriber
    subname The SubscriptionName parameter that is specified in the request body of the XML format. TestSubscriptionName
    pubtime The PublishTime parameter that is specified in the request body of the XML format. The current system time.
  • Sample code:Message processing logic