Documente Academic
Documente Profesional
Documente Cultură
How to create a web service with Visual Studio 2008, you can look at the
Microsoft website.
Once a web service is successfully created, you have to upload it to the
internet that is running Microsoft IIS with. NET framework 3.5 as its web
server.
Example you uploading to http://www.myserver.com/mywebservice.asmx
The next step is that you create a project in PowerBuilder. To be able to
access the web service, you have to import the first PB extention named
pbwsclient125.pbx that normally exist in the directory c:\program
files\sybase\shared\PowerBuilder
Once you have finished importing the PB extension, 3 user objects will
appear as shown below (figure 1).
figure 1
Next, you must create a Web Service Proxy Project. To do this, click the File
menu, New, select Project, and then select Web Service Project. (see figure
2)
figure 2
On the General tab, enter the information as shown below (figure 3).
figure 3
For Web Service tab, enter the information as shown below (figure 4).
we input during the creation of the Web Service Proxy Object, above.
Prefix WS_ is in accordance with the Prefix field, and is in accordance with
the Service1class name in the web service that we created in Visual Studio
(figure 5 and 6).
figure 5
figure 6
The final step is to create a window object that will be filled by the script to
call the web service. In that window, create a static text object and name
st_result, 2 editmask object and name em_1 and em_2, and a button. Save
and name it w_helloworld. For more details see the image below
In the button clicked event, type the following script:
1:
2:
3:
4: long rVal
5: decimal dResult, dValue1, dValue2
6:
7: conn = create SoapConnection //Instantiated connection
8:
9: rVal = Conn.CreateInstance(proxy_obj, "ws_service1")
10: Conn.setbasicauthentication( <yourdomain>, <yourusername>,
<yourpassword>)
11:
12: // Create proxy object
13: try
14:
dValue1= Dec(em_1.text)
15:
dValue2= Dec(em_2.text)
16:
dResult = proxy_obj.of_add2value(dValue1, dValue2)
17:
st_result.text = String(dResult)
18:
19:
// Invoke service
20: catch ( SoapException e )
21:
messagebox ("Error "+string(rVal), "Cannot invoke Web
service "+e.Text)
22:
// error handling
23: end try
24:
25: destroy conn
figure 7
figure 8