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:
- username and password will be included only if the Use HTTP authorization option is checked.
- port will be included only if the port number has a value different than the default (80).
- query will be parsed and parameters replaced with actual values prior to forming the URL.
Available parameters for query portion take values from the actual message that is being sent:
- %User% - user name
- %Password% - password
- %From% - the phone number of the sender
- %To% - the phone number of the recipient
- %Text% - the text of the message
- %Binary% - the complete binary message represented as an array of hexadecimal digits
- %BinaryHeader% - the header part of the binary message
- %BinaryData% - the data part of the binary message
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
- Host lets you specify the host name or the IP address of the HTTP server computer.
- Port lets you specify the port number used for accepting HTTP connections on the server computer.
- Path lets you specify the path portion of the URL request.
- Method lets you specify the HTTP method used for sending the requests.
- Timeout lets you specify the timeout period for the requests. The requests is considered failed if no response is received after the timeout period.
- Text query lets you specify the query portion of the URL request for sending messages of the Text and Flash Text types.
- Binary query lets you specify the query portion of the URL request for sending messages of the Binary type.
- Remove plus sign from phone number specifies whether the plus sign preceding international phone numbers should be removed prior to forming URL request.
- User name lets you enter your user name.
- Password lets you enter your password.
- Remember password allows you to specify if the application should remember your user name and password. If this option is not checked, the application will ask you for the user name and password each time you initiate the connection.
- Use HTTP authorization lets you specify if the HTTP authorization should be used for sending the requests.
- Maximum sending rate specifies the maximum rate (in messages per second) at which the application will send messages. The application will never send messages faster than this rate. Note that you may enter a decimal value in this field.
- Successfully sent lets you specify the wildcard pattern that responses should match in order to indicate a successful operation. See Wildcard Patterns.
Client tab
- Listen port specifies the port number on which the connection will listen for incoming HTTP requests.
- Local IP address lets you specify the local IP address SMS
Studio will use when creating the connection. This setting is useful if you
need to select the network adapter to be used by this connection, or if your
network adapter is using several IP addresses. In most cases, there is no need
to change this setting (i.e. it should be set to 0.0.0.0).
- Client IP address lets you specify the IP address of the client computer.
- Client IP address mask lets you specify the mask used to check if the client IP address is allowed.
For example: if the client IP address is set to 192.168.0.0 and the mask is set to 255.255.255.0, then this connection will accept an incoming connection from a client only if its actual IP address is in the range from 192.168.0.0 through
192.168.0.255.
- Client user name lets you specify the user name of the client.
- Client password lets you specify the password of the client.
Parsing tab
- Use HTTP authorization lets you specify if the HTTP authorization is required when receiving HTTP requests.
- Client user name format lets you enter the format used to extract the client user name from the incoming request parameters.
- Client password format lets you enter the format used to extract the client password from the incoming request parameters.
- Sender format lets you specify the format used to extract the sender information.
- Recipient format lets you specify the format used to extract the recipient information.
- Text format lets you specify the format used to extract the message text.
- Binary format lets you specify the format used to extract the message binary content.
- Binary flag format lets you specify the format used to extract the flag that indicates whether the incoming message is binary.
- Binary flag pattern lets you specify the wildcard pattern used to check if the incoming message is binary. The incoming message is considered binary if the extracted binary flag matches this pattern. See
Wildcard Patterns.
- Success content lets you specify the response that should be sent back on successful reception of the incoming request.