HTTP Account

HTTP account allows you to connect to an SME through HTTP protocol.

This type of account is bidirectional and uses HTTP requests for both sending and receiving SMS messages.

The contents of this topic:

 

Sending

Messages are sent in the form of an HTTP request. The URL for the request is generated in the following way:

http:// username : password @ host : port / path ? query

While forming the URL:

Available parameters for query portion take values from the actual message that is being sent:

Upon receiving the request, the SME returns its response. The response text is then compared with the Successfully sent wildcard pattern. If the response text matches the pattern the sending is considered as successful.

Example 1

Use the following parameters to setup an HTTP connection to the emulated SMS gateway located at the CodeSegment web server. Note that this is only an emulation and that the messages will not actually be sent to the recipients.

Server tab:
  Host: www.codesegment.com
  Path: send_sms.asp
  Text query: user=%User%&pass=%Password%&from=%From%&to=%To%&text=%Text%
 
User name: smsstudio
  Password: codesegment
 
Remember password: Checked
  Successfully sent: *Status*OK*

Use the Send Message dialog to send messages using this HTTP connection.

Use the following link to see the response received from the CodeSegment web server:
http://www.codesegment.com/samples/send_sms.asp?user=smsstudio&pass=codesegment&from=5555&to=+123456789&text=Hello

Example 2

If an SME returns the following response for successfully sent messages:

...
<id> 12345 </id>
<status> OK </status>
<error> None </error>
...

Then you can use the following pattern:

Successfully sent:  *status*OK*/status*

 

Receiving

An HTTP connection listens for and accepts incoming HTTP requests. Request are then parsed to extract the received HTTP parameters which are contained in the incoming URL. To create the incoming message that will be stored in Inbox, SMS Studio uses formats which contain the names of received parameters.

Example 3

If you use the default settings of the HTTP connection:

Parsing tab:
  Sender format: %From%
  Recipient format: %To%
  Text format: %Text%
  Binary format: %Binary%
  Binary flag format: %Binary%
  Binary flag pattern: ?*

Then, incoming HTTP request should conform to the following syntax for text messages:

    http://www.your-server.com/receive?From=%2b123456789&To=5555&Text=Hello

Or, the following syntax for binary messages:

    http://www.your-server.com/receive?From=%2b123456789&To=5555&Binary=060503012A3B

In this example, the existence of the Binary parameter indicates a binary message.

Example 4

If you receive HTTP requests that uses the syntax similar to this:

    http://www.your-server.com/receive?from=123456789&to=5555&msg=Hello&type=TXT

Then, the following parameters will be extracted:

  %from% containing the value 123456789
  %to% containing the value 5555
  %msg% containing the value Hello
  %type% containing the value TXT

To convert this to the incoming SMS message, you should use the following settings:

Parsing tab:
  Sender format: +%from%
  Recipient format: %to%
  Text format: %msg%
  Binary format: %msg%
  Binary flag format: %type%
  Binary flag pattern: BIN

Note that the above settings will also accept binary messages similar to this:

    http://www.your-server.com/receive?from=123456789&to=5555&msg=060503012A3B&type=BIN

Because in this case the extracted binary flag matches the binary flag pattern, SMS Studio will use Binary format (instead of Text format) to make the body of the SMS.

 

HTTP Connection Dialog

See Connection Dialog for description of the Connection, Account and Statistics tabs.

Server tab

Client tab

Parsing tab

 

Copyright © 2002-2007 CodeSegment. All rights reserved.

   www.codesegment.com