cs590vc – tutorial 9 calling web services from second life

15
CS590VC – Tutorial 9 Calling Web Services from Second life

Upload: felix-cummings

Post on 28-Dec-2015

223 views

Category:

Documents


4 download

TRANSCRIPT

CS590VC – Tutorial 9

Calling Web Services from Second life

Things to do today…….• Connect to an existing US Zip web service.

• Call the GetInfoByZIP() method to retrieve information by providing Zip code from SL client

• Parse the information and display in channel 0 of SL

• Learn about creating one’s own web service and publishing that to IIS

• And of course, for me, go to Muddy’s after the class and brood on some “interesting” stuffs

What is a “Web Service”?• Web Service – A programmable XML-Based service available

over the web through SOAP requests which returns results through SOAP responses

• WSDL – An XML based protocol for information exchange. Jointly developed by Microsoft and IBM. Keywords include “Message Name”, “Port Type”, “Binding Name” and “Service Name”.

• Popular web services includes Google, Amazon, Ebay, Google Maps, Google Desktop Search, Yahoo Maps, Mappoint, Terra Webservices

Using HTTP for invoking web services

• Web services can be fetched from the internet using llHTTPRequest function.

• llHTTPRequest invokes the event http_response

• Returns only raw text (HTML source code) of the web page

Calling an existing web service• Search for an existing web service in the internet. (A

good place to start with can be http://www.webservicex.net/WCF/Default.aspx )

• Get the url of the web service and download the LSL script (client): “web service.txt” from blackboard.

• Paste the url as the value of the sourceURL string variable

• Attach the service method argument to the url

Calling a custom built service• Create a service on the .Net platform in C#

• Publish that service to IIS server under the default website virtual directory

• Note the IP address of the host

• Provide access permission to the virtual directory

• Use the IP in the sourceURL variable as before

How to create a web service?

Select Language as “Visual C#” and appropriate location to create your project by typing the path or by hitting the browse button

HTTP

http://kc-sce-class/cs551/group1/<your folder/filename>

Code for Web Service

• Type in the below mentioned code, and comment the part which is green in color

Publishing the web service - 1

Publishing the web service - 2

Publishing the web service - 3

Publishing the web service - 4

Publishing the web service - 5

Reference

• Creating your world – official guide to advanced content creation for second life