Send and receive messages using the HTTP protocol.
It is possible to send and receive messages using the HTTP protocol.
Sending messages is done by sending the required parameters to the relevant script on Vianett's server as HTTP GET or HTTP POST requests. The scripts will then attempt to send the messages, and return an XML response to the requests in order to give feedback as to whether operations have been successfully completed.
Receiving messages is done by writing scripts receiving the required parameters as HTTP GET or HTTP POST requests. The scripts can then process these values according to the customer's wishes. The scripts have to be implemented so that they return a response in XML format.
The following paragraphs contain examples of how the scripts are used with HTTP GET requests when sending and receiving messages, with examples of how their XML responses look like. In addition, there are descriptions of the fields which make up the various parameters to the scripts.
Incoming messages (MO)
Example:
http://yourserver.com/yourscript.asp?sourceaddr=4748044407&destinationaddr=1963&prefix=demo&message=Hello%20world&refno=1234&retrycount=1&operator=1&requesttype=mo&username=&password=
Response:
<?xml version="1.0"?>
<ack refno="1234" errorcode="0" />
Response with message to the user:
<?xml version="1.0" encoding="iso-8859-1"?>
<ack refno="1234" errorcode="0" response_msg="Hello world" response_pricegroup="100" response_fromalpha="vianett" />
Response with MMS message to the user:
<?xml version="1.0" encoding="iso-8859-1"?>
<ack refno="1234" errorcode="0">
<response_mmsdata>Base64-encoded MMS ZIP file</response_mmsdata>
</ack>
Outgoing messages (MT)
Test page: http://smsnew.vianett.com/kat/000036.asp
Example:
http://smsc.vianett.no/ActiveServer/MT/?username=demo&password=demo&refno=1234&sourceaddr=1963&destinationaddr=4748044407&message=Hello%20world&fromalpha=vianett&operator=0&nrq=1
Positive response:
<?xml version="1.0"?>
<ack refno="1234" errorcode="0" />
Negative response:
<?xml version="1.0"?>
<ack refno="1234" errorcode="2">Wrong username and/or password</ack>
Delivery messages (MT)
Example:
http://yourserver.com/yourscript.asp?requesttype=mtstatus&refno=1234&errorcode=0
Response:
<?xml version="1.0"?>
<ack refno="1234" errorcode="0" />
Field definitions - incoming messages (MO)
sourceaddr
The originator number.
destinationaddr
The destination number.
prefix
The first word in the message (keyword).
message
The last part of the message.
refno
ViaNett's message ID. Reference number.
retrycount
How many times the message has tried to be delivered.
operator
The operator ID. 1 is Telenor Mobile (Norway), 2 is NetCom (Norway), etc.
requesttype
This field will have the value "mo" on incoming messages.
username
Optional username.
password
Optional password.
Field definitions - outgoing messages (MT)
username
The username that is given by Vianett.
password
The password that is given by Vianett.
refno
Message reference number. This number must be a unique ID.
sourceaddr
Originator number.
destinationaddr
Destination number.
message
The message you want to send.
messageheader
Optional message header.
fromalpha
Alpha numeric originator number. Can only be used with messages with pricegroup=0.
operator
The operator ID. Use 0 if this number is unknown.
pricegroup
The pricegroup. Example: 100 is NOK 1,- and 1500 is NOK 15,-.
Acklowledgement codes - outgoing messages (MT)
0 - OK
1 - Internal unknown DB error. Please try again later!
2 - Wrong username and/or password
6 - Please use a refNo between 1 and 16777216
7 - Please fill in your username. Max 255 characters
8 - Please fill in your password. Max 255 characters
9 - You must enter a valid destinationAddr: [destinationAddr] not valid!
10 - You must enter a valid sourceAddr: [sourceAddr] not valid!
11 - FromAlpha is too long. Max 11 characters. [fromAlpha] not valid!
12 - Message cannot be empty!
13 - Operator must be a number >= 0
14 - Pricegroup must be a number >= 0
15 - ReplyPath must be a number >= 0
Field definitions - delivery messages (MTSTATUS)
refno
Message reference number. This will be the same as refno on your MT message.
requesttype
This field will have the value "mtstatus".
errorcode
This field will be 0 if the message was delivered to the user.
Print the article