SOAP Manual - Resalty.Net

therapistarmyΛογισμικό & κατασκευή λογ/κού

14 Δεκ 2013 (πριν από 3 χρόνια και 5 μήνες)

116 εμφανίσεις


























SOAP
API GUIDE

V
1
.
5
.0







Co
pyright ©

2012 Resalty.net. All rights reserved.


Contents

Overview

................................
................................
................................
................................
................................
...........

3

Introduction

................................
................................
................................
................................
................................
......

3

Getting Started

................................
................................
................................
................................
................................
.

3

How to implement?

................................
................................
................................
................................
..........................

4

Send SMS

................................
................................
................................
................................
................................
......

4

Input p
arameters

................................
................................
................................
................................
.....................

4

Send SMS
-

Sample Codes

................................
................................
................................
................................
........

5

Return Value

................................
................................
................................
................................
............................

6

Query Message

................................
................................
................................
................................
.............................

7

Input parameters

................................
................................
................................
................................
.....................

7

Query M
essage


Sample Codes

................................
................................
................................
..............................

7

Return Value

................................
................................
................................
................................
............................

8

Get User Balance

................................
................................
................................
................................
..........................

9

Input parameters

................................
................................
................................
................................
.....................

9

Get U
ser Balance


Sample Code

................................
................................
................................
.............................

9

Return Value

................................
................................
................................
................................
..........................

10

Get Current Server Time

................................
................................
................................
................................
............

11

Input parameters

................................
................................
................................
................................
...................

11

Get Current Server Time


Sample Code

................................
................................
................................
...............

11

Return Value

................................
................................
................................
................................
..........................

12

Return Value Type: Resalty_Dto_SmsMessage

................................
................................
................................
..........

12

Get in touch..

................................
................................
................................
................................
................................
..

12





Co
pyright ©

2012 Resalty.net. All rights reserved.


Overview

This technical document is intended for developers who wish to use the Resalty.net
SOAP

API for sending mess
ag
es,
and describes
the various programming methods and commands used by developers when using this API.

Considering the growing need of our customers to have more secur
ed and advanced form of API,
Resalty.Net

has
developed the API as Web Service that can be consumed by any programming technologies such as PHP and .NET.

These web services are based on industry standard, light weight but secure SOAP protocol for exchanging
informa
tion with applications.

SOAP is a protocol for exchanging XML
-
based messages using HTTP/HTTPS. SOAP forms the foundation layer of the
web services protocol stack providing a basic messaging framework upon which abstract layers can be built

Introduction

The API offers the following functionalities to our customers that are to be used in connection with our Gateway.



Send multilingual SMS.



Query about the status of a sent SMS message.



Get current user balance in points.



Get current server time.

Note: It is important that the ENTIRE document is read before contacting support. Parameters are case
-
sensitive.

Getting Started

In order to use the Resalty.net
gateway you need a Resalty.net account. Here’s how:

1.

Register for a Resalty.net Account

If you
do not already have a Resalty.net
account, you need to register for one as per below. I
f you have a
Resalty.net
account, proceed to
Basic Command Section
.

-

Go to
http://www.resalty.net/r
.

-

Enter your personal information to complete the registration form

-

Click
Register
-

an email containing an activation link will be sent to the email address you have provided
and SMS w
ith activation code will be sent to your handset.

-

Login to your account,
Enter the activation code into activation page and click "activate".

-

When your mobile number is verified, you will be able to purchase credits and send messages.





Co
pyright ©

2012 Resalty.net. All rights reserved.


How to implement?

SMS Service API can be easily consumed by any programming languages or applications that accept web service
s
integration. In this section, examples are shown for the following technologies.



PHP



.NET


The following sections will describe implementation details of our SMS Service API features in PHP and .net
technologies with sample codes.

All the methods

described below must use the following:

Web Service

ResaltyWebService

WSDL

http://www.resalty.net/api/soap

Send SMS

This section
describes

how to send sms message to many mobile numbers

Method

public

Resalty_Dto_SmsMessage

sendSms(
String
username
, String
password
, String
to
, String
message
, String
sender
, String
sendTime
, String
validityTime)

Input parameters


Parameter

Description

username

Your username

password

Your password

to

Space separated list of mobile numbers in international format without leading
zeros or + . (i.e. 20121234567 966551234567)

message

message content (UTF8 encoded)

sender

Sender name to be displayed to receiver of the message

sendTime

[
Optional
] send time formatted like YYYYMMDDHHmmss, use it if you want to
schedule the message to be sent at a specific time. If not set, message will be sent
now.

validityTim
e

[
Optional
] time to auto stop the message if it was waiting in our server’s queue for
汯l来爠瑨慮⁴h慴⁳ 琠瑩浥⸠䙯Fm慴瑥t楫e⁙YYY䵍䑄MHmmss.



Co
pyright ©

2012 Resalty.net. All rights reserved.


Send SMS
-

Sample Codes


Using
PHP

$username = '';
// your resalty.net username

$password = '';
// your password


$client =
new

SoapClient
(
'http://www.resalty.net/api/soap'
);


$numbers =
'
966551234567

9715
0
222118

20111234567

20125441819
'
;

$message =

'hi this is a test


لاها
,
رابتخا

ةغللاب

ةيبرعلا


!@#$%^&*

'
;

$senderName =
'lolcatz'
;


try {



$response = $client
-
>sendSMS($username, $password, $numbers, $message, $senderName);


var_dump($response);

} catch(
SoapFault

$exception ) {


echo $exception
-
>faultcode .
' : '

.$exception
-
>faultstring . PHP_EOL;

}





Co
pyright ©

2012 Resalty.net. All rights reserved.


Using

.NET



Add web reference to the
given web service URL.



Rebuild the project.



Write this code
.

Resalty.
Resalty_WebService_SoapPortClient

c

=

new

Resalty_WebService_SoapPortClient
();

string


username = “”;
// your resalty.net username

string


password = “”;
// your password

string


numbe
rs =
“20111234567 512345467 20125441819 966551234567”
;

string


message = “
hi this is a test
لاها
,
رابتخا

ةغللاب

ةيبرعلا

!@#$%^&*”;

string


senderName =
“lolcatz”
;


string

messageid

=

c.sendSms(
username, password, numbers, message, senderName,
null
,

null
).Id;

Console
.WriteLine(messageid

+

"

has

been

sent..."
);



Return Value

Resalty_Dto_SmsMessage


Exceptions


Code

Description

missingParams

At least one mandatory parameter is missing

accessDenied

Invalid username/password

noValidNumbers

no valid phone numbers found, or you have a + there

invalidSender

You sent invalid sender

senderTooLong

Sender name longer than 16 numbers or 11 chars

senderContainInvali
dChars

Your
sender name contains special or non
-
English chars. Only dash (
-
), space and
dot are allowed

contentBlocked

Your message contains some blocked word

noEnoughBalance

You don’t have enough points to send this message

messageRejected

Message
rejected for some reason, you can contact support to see why

invalidSendTime

If sendTime is set, you have to provide valid send time newer than the current
time, and formatted like expected.

invalidValidityTime

If
validityTime is set, you have to provide validity time newer than send time and
formatted like expected.


Co
pyright ©

2012 Resalty.net. All rights reserved.


Query Message

This section describes how to query about the status of a SMS message

Method

public

Resalty_Dto_SmsMessage

queryMessage
(String
username
, String
password
, String
messageId
)


Input parameters


Parameter

Description

username

Your username

password

Your password

messageId

Message id


Query Message


Sample Codes


Using
PHP

$username = '';
// your resalty.net username

$password = '';
// your password


$client =
new

SoapClient
(
'http://www.resalty.net/api/soap'
);

try {


$query = $client
-
>queryMessage($username, $password, $messageId );


var_dump($query);

} catch(
SoapFault

$exception ) {


echo $exception
-
>faultcode .
' : '

.$exception
-
>faultstring . PHP_EOL;

}





Co
pyright ©

2012 Resalty.net. All rights reserved.


Using
.NET



Add web reference to the
given web service URL.



Rebuild the project.



Write this code
.



Resalty.
Resalty_WebService_SoapPortClient

c

=

new

Resalty_WebService_SoapPortClient
();

string


username = “”;
// your resalty.net username

string


password = “”;
// your password

string


messageid

= “”;
// Thr message id that is needed


Resalty_Dto_SmsMessage

res

=

c.queryMessage(username,

password,

messageid);

Console
.WriteLine(
"
countMessagesSent={0}
\
nres.countMessagesFailed={1}
\
nres.countMessagesQueued={
2}
\
nres.countMessagesRejected={3}
\
nres.countMessagesStopped={4}"
,

res.countMessagesSent,

res.count
MessagesFailed,

res.countMessagesQueued,

res.countMessagesRejected,

res.countMess
agesStopped);



Return Value


Resalty_Dto_SmsMessage


Exceptions


Code

Description

missingParams

At least one mandatory parameter is missing

accessDenied

Invalid username/password

invalidMessageId

No message found with that id





Co
pyright ©

2012 Resalty.net. All rights reserved.


Get
User Balance


This section describes how to get the current user balance in points


Method

public

float

getBalance
(String
username
, String
password
)


Input parameters


Parameter

Description

username

Your username

password

Your password


Get User Balance


Sample Code


Using
PHP


$username = '';
// your resalty.net username

$password = '';
// your password


$client =
new

SoapClient
(
'http://www.resalty.net/api/soap'
);

try {


$balance = $client
-
>getBalance($username, $password);


var_dump($balance);

} catch(
SoapFault

$exception ) {


echo $exception
-
>faultcode .
' : '

.$exception
-
>faultstring . PHP_EOL;

}




Co
pyright ©

2012 Resalty.net. All rights reserved.


Using
.
NET



Add web reference to the
given web service URL.



Rebuild the project.



Write this code
.

string

username

=

""
;

//

your

resalty.net

username

string

password

=

""
;

//

your

password


Resalty.
Resalty_WebService_SoapPortClient

c

=

new

Resalty_WebService_SoapPortClient
();


Single

balance

=

c.getBalance(username,

password);


Console
.WriteLine(balance);



Return Value


Count of points in your balance as
float


Exceptions


Code

Description

missingParams

At least one mandatory parameter is missing

accessDenied

Invalid username/password





Co
pyright ©

2012 Resalty.net. All rights reserved.


Get Current Server Time

This section describes how to get the
current server time

Method

public

String
getCurrentTime
()


Input parameters


no paramters needed


Get Current Server Time


Sample Code


Using
PHP

$client =
new

SoapClient
(
'http://www.resalty.net/api/soap'
);

try {


var_dump( $client
-
>getCurrentTime() );



} catch(
SoapClient

$exception ) {


echo $exception
-
>faultcode .
' : '

.$exception
-
>faultstring . PHP_EOL;

}


Using .NET



Add web reference to the
given web service URL.



Rebuild the project.



Write this code
.


string

username

=

""
;

//

your

resalty.net

username

string

password

=

""
;

//

your

password


Resalty.
Resalty_WebService_SoapPortClient

c

=

new

Resalty_WebService_SoapPortClient
();


string
currTime

=

c.

getCurrentTime()
;


Console
.WriteLine(currTime);




Co
pyright ©

2012 Resalty.net. All rights reserved.


Return Value


Current server time formatted as
Y
YYYMMDDHHmmss

Exceptions

No Exceptions

Return Value Type: Resalty_Dto_SmsMessage

Table below lists the parameter and their types for the return value of type
Resalty_Dto_SmsMessage
that is used in
the methods above.

Parameter

Type

Description

Id

String

40 char message id

countMessagesTotal

int

Total number of SMS messages to be sent

countMessagesQueued

int

Count of queued SMS messages

countMessagesSent

int

Count of sent SMS messages

countMessagesRejected

int

Count of rejected mobile numbers

countMessagesFailed

Int

Count of failed SMS messages

countMessagesStopped

int

Count of stopped SMS messages


Get in touch..

Website

http://www.resalty.net

For
Technical Support
:

E
-
mail:
support@resalty.net