Chinaunix首页 | 论坛 | 博客
  • 博客访问: 313983
  • 博文数量: 118
  • 博客积分: 2010
  • 博客等级: 大尉
  • 技术积分: 1163
  • 用 户 组: 普通用户
  • 注册时间: 2009-08-27 12:09
文章分类

全部博文(118)

文章存档

2023年(20)

2022年(3)

2021年(1)

2020年(1)

2019年(7)

2013年(2)

2011年(1)

2010年(37)

2009年(46)

我的朋友

分类: WINDOWS

2009-10-12 19:45:18

Instructions for Creating Web Service Clients 
Creating Web Service Clients
You can create web service clients using either .Net Web Service studio or Apache Axis client library. You must first create a simple web service in AR System.

Creating a Simple Web Service
1. Create a regular form with core fields only and name the form Simple.
2. Right-click on Simple in the Forms window, and select Create Web
Service.
3. Change the name of the web service to SimpleWebService.
4. Click the Permissions tab and select Add All to give permissions to all.
5. Save the web service.
6. Click the WSDL (Web Services Description Language) tab and change to the location where the mid tier is installed, and click View. The WSDL for the web service should appear.
Creating a .Net Web Service Client
1. Install Microsoft .Net run-time and Visual Studio .Net 7.0.
2. Open Visual Studio .Net 7.0.
3. Choose File > New > Project.
4. Select Visual C# Projects from the set of available project types.
5. Select Console Application from Templates.
6. Enter WSClient for Name.
7. Enter the directory name (for example, C:\temp) in the location in which you choose to store the project files.
8. Click OK.
9. Choose View > Solution Explorer.
10. In Solution Explorer, right-click WSClient and select Add Web Reference.
11. In the Address bar, type the URL for WSDL (for example,
).
12. Enter the username and password, and click Login (this is only needed if public access is not given to SimpleWebService).
13. Click the Add Reference button.
14. Choose Project > Show All Files.
15. Navigate to SimpleWebService.cs under Web References in the Solution Explorer. Right-click SimpleWebService.cs and select View Code.
SimpleWebService.cs is the proxy class generated for making requests to SimpleWebService.
16. Click the Class1.cs tab and start editing.
17. After the “using System” statement, enter the following statement on a separate line:
using WSClient.;
18. Enter the following code in Main method (after the //TODO... statement ):
// create a proxy object to make web service requests
SimpleWebService proxy = new SimpleWebService();
// set up authentication info
AuthenticationInfo authInfo = new AuthenticationInfo();
authInfo.userName = "Demo"; // give a valid AR user name
authInfo.password = ""; // give a valid password
proxy.AuthenticationInfoValue = authInfo;
// declare variables
String Assigned_To;
String Short_Description;
StatusType Status;
String Submitter;
String Request_ID;
// supply values for creating an entry using OpCreate
Assigned_To = "Frank";
Short_Description = "Testing web service";
Status = StatusType.New;
Submitter = "Joe";
// make web service request to create an entry
Request_ID = proxy.OpCreate(Assigned_To, Short_Description, Status, Submitter);
Console.WriteLine("Successfully created a request with id: " + Request_ID);
// declare additional variables for get operation
DateTime Create_Date;
String Last_Modified_By;
DateTime Modified_Date;
String Status_History;
// make web service request to get the entry that was created above
Assigned_To = proxy.OpGet(ref Request_ID, out Create_Date, out Last_Modified_By, out Modified_Date,
out Short_Description, out Status, out Status_History, out Submitter);
Console.WriteLine();
Console.WriteLine("Following values have been returned by OpGet");
Console.WriteLine();
Console.WriteLine("Request_ID : " + Request_ID);
Console.WriteLine("Create_Date : " + Create_Date);
Console.WriteLine("Last_Modified_By : " + Last_Modified_By);
Console.WriteLine("Modified_Date : " + Modified_Date);
Console.WriteLine("Short_Description : " + Short_Description);
Console.WriteLine("Status : " + Status);
Console.WriteLine("Status_History : " + Status_History);
Console.WriteLine("Submitter : " + Submitter);
Console.WriteLine("Assigned_To : " + Assigned_To); 
19. Choose Build > Rebuild All.
20. Change directory to C:\temp\WSClient\bin\Debug.
21. Type WSClient.exe at the command prompt to run the client.

The following output appears:
Successfully created a request with id: 000000000000001
Following values have been returned by OpGet
Request_ID : 000000000000001
Create_Date : 7/17/2002 12:31:04 PM
Last_Modified_By : Demo
Modified_Date : 7/17/2002 12:31:04 PM
Short_Description : Testing web service
Status : New
Status_History : 2002-07-17T11:31:04-08:00 Demo
Submitter : Joe
Assigned_To : Frank


阅读(959) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~