Develop SMS applications using Delphi and Web Services Technology

zhaozj2021-02-17  49

Develop SMS applications using Delphi and Web Services Technology

Collin

(Arlierever@sina.com)

Abstract: This article develops a Web Services technology-based application in Delphi by using the instance of using Delphi and Web Services technology to develop SMS applications.

Keywords: Delphi; Web Service; SMS application development

One mentioned application development based on Web Services technology, the development tool that the average person first thought of is VS.NET, in fact, as a boss of fast application development tools (RAD), Delphi began supporting Web Services from 6.0, this article By using Delphi 7.0 call Sina Send SMS for Sina SMS application development This example details how to develop Web Services-based applications in Delphi.

The first step is to prepare, learn about Sina SMS Web Service. Sina Send SMS's Web Service address is http://smsinter.sina.com.cn/ws/smswebservice0101.wsdl, the Web Service only has a method, the String Sendxml (Carrier, UserId, Password, MobileNumber, Content, MsgType) . All parameters are all String types, and their meaning is basically as follows (may not be correct).

Carrier: The name of the operator, it seems to be casually lost, it is recommended to enter "sina", if you enter other values, the message sent is particularly slow;

UserID: You are registered on Sina Wireless, if you are not registered on http://sms.sina.com.cn, you can't use this web service to send text messages;

Password: The password used when you register your phone on Sina;

Mobilenumber: The other party's mobile phone number;

Content: Send a short message content;

MsgType: I estimate to support MMS, but I don't know how to use it, it seems that I can lose anything, I am using "text".

Please refer to the relevant instructions on Sina Wireless website, but it is also a two-corner, which is not very clear. Since the backstage may use a message queue mechanism, there may be a long period of delay when busy.

Step 2, build a blank application first. Run Delphi 7, open the [File] -> [New] -> [Application] menu, Delphi automatically generates a default project. Change the default form FORM1 to SMS and save the work as SMSDemo.prj. As shown below:

figure 1

The third step is introduced into the web service. Open the [File] -> [New] -> [Other] menu, select the WebServices TAB page in the pop-up window, then select in which the WSDL Importer option is selected, click the OK button to pop up the WSDL Importer Wizard window, as shown in Figure 2 . Enter: http://smsinter.sina.com.cn/ws/smsWebService0101.wsdl (note, you can't lose wrong!), Click Next button, click Finishi button, complete the introduction of the Wave Send SMS Web Service. At this point, an engineering file will add a file that is smswebservice0101.pas, which is the Web Service generated by Delphi to introduce the declaration file, do not modify him. figure 2

In the fourth step, call the SMS send interface of the Web Service. In the SMS form, add four TEDIT controls, a TBUTTON control, a TMEMO control, and five TLABEL controls, and set it according to Figure 3.

image 3

The SMSWebService0101 contains SMSWEBService0101 in the USES statement of the SMSFRM unit to modify the Windows to access Sina Send SMS.

Write the following code in the Send button onclick event:

Procedure tsms.button1click (sender: TOBJECT);

Begin

Memo1.text: = getsmswebservicesoapport.sendxml (Edit1.Text,

Edit2.Text, Edit3.Text, Edit4.Text, Edit5.Text, 'Text');

END;

Note: Edit1, EDIT2, EDIT3, EDIT4, EDIT5 respectively correspond to operators, user names, passwords, other party numbers, messages on the interface; feedback on the MEMO1 corresponding interface.

The fifth step is sent to SMS using the SMS transmitting interface of Web Service. Compile, run SMSDemo.prj, enter your mobile phone ID in Sina Wireless, enter your password on Sina Wireless, then enter the other party's mobile phone number and message content, click the send button, slightly Waiting for a while, you will get feedback from the Web Service in the feedback information box. If everything is normal, the system will prompt your SMS to send success.

summary

From the above example we can see, just understand the concept of Web Services, under the help of Delphi, developing Web Services-based applications will not be a very difficult thing. Web Services is ideal for developing a cross-platform and cross-network communication (because the HTTP protocol is used as a firewall allowed), which can across heterogeneous architecture, contact customers, suppliers, corporate partners, and information systems within the company. Best solutions for business B2B, corporate information. As long as you expose your business logic, become a web service, you can make any designated partners to call these business logic, regardless of what the system runs on what platform, what development tools are used. Web Services is currently a very popular technology. This article is just a little bit of experience in learning, and there is definitely unable to understand or even mistakes. You are welcome to correct. (Full text)

转载请注明原文地址:https://www.9cbs.com/read-28384.html

New Post(0)