How to Get a Reply from the Web

This sample demonstrates how to get a reply from the web.

File GetHTTPReply.exe used in this sample is located in the folder:

    C:\Program Files\CodeSegment\SMS Studio\Samples\InfoService

This application receives the parameters in the following format:

    PipeName | MsgID | URLPath | Param1_Name=Param1_Value | Param2_Name=Param2_Value | ... | ParamN_Name=ParamN_Value

The application will use the following URL to get a response from the web:

    URLPath ? Param1_Name=Param1_Value & Param2_Name=Param2_Value & ... & ParamN_Name=ParamN_Value

The response will be sent back through the named pipe as a reply to the incoming message.

How to run this sample

  1. Click the New button on the main toolbar and select the Info service option in the New Service dialog.
  2. Click the Setup button on the main toolbar to display the Info Setup dialog.
  3. In the General tab of the Info Setup dialog click the Add button to display the Add Rule dialog.
  4. In the General tab of the Add Rule dialog enter the following parameters:
    Name: Web Reply
    Pattern: *
    Action: Execute external application
  5. In the Execute tab of the Add Rule dialog enter the following parameters:
    External application: GetHTTPReply.exe - use the selection button ( ... ) to locate and select the external application.
    Application parameters:
        %PipeName%|%MsgID%|http://www.codesegment.com/samples/web_reply.php|from=%MsgFrom%
  6. Click the Add button to close the Add Rule dialog.
  7. In the Advanced tab of the Info Setup dialog enter the name of the pipe:
    Pipe name: WebReplyPipe
  8. In the External tab of the Info Setup dialog enter the following parameter:
    Remove invalid characters from parameters: |
  9. Click the OK button to close the Info Setup dialog.
  10. Click the Start button on the main toolbar to start the Info service.
  11. Use Tools / Receive Message option in the main menu to display the Receive Message dialog. Fill in the Phone and Text fields and click the Receive button. The Info service will receive this message and run the GetHTTPReply.exe application which will connect to the web and return back a reply.

Related topics

Info Rules

 

Copyright © 2002-2007 CodeSegment. All rights reserved.

   www.codesegment.com