V J

Wednesday, December 15, 2004

How to create & passes Web Services Objects {XSD}

Hello All, Now this time, with a topic about passing and consuming objects b/w subscriber (the one who is using you Web Service) and the provider (the one who expose Web Service). How can they able to pass objects just like the way we passes, consumes objects in windows, web application. Well for Web Services, as you all know that data is passing over http over soap, so your object must be xml searlize object. But how to create a searlize object. Like the way if i want to create a Student object with two attributes FirstName and LastName, what i have to do,,,

  1. Create a new file (xsd dataset)
  2. Now add a element here, you will see others 2, but select element.
  3. Name that element to Student
  4. Now write FirstName in the input box and select string data type
  5. Enter LastName and select string again
  6. You can also switch to the XML window, in which you will see all the xml of this, what it do, its create an xml searlize object with Student having 2 attributes.
  7. In this manner you have created an Web Service, but you your client cant consume it, you have to do little effort more.
  8. Open you vs.net command prompt and browse the directory where your Student.xsd file is placed
  9. Run this command xsd /l:VB /classes Student.xsd
  10. This command creates a vb class for student
  11. Now back to your web service and expose any method in which you instantiate or take this student class as input args
  12. You will see that this object will contains those 2 attributes
  13. Anyone consuming your this Web Service page will able to consume this object and can fill the data into your developed object.

You have noticed that how easy to create and expose your objects in Web Services. About the back-end work, that how soap and .net managaes, all this, its kust creates a series of http commands overs soap which feels like an Object for you, however originally its not an Object.

Thats why Web Services makes life easier.

Easy ..........

Wajahat Abbas

0 Comments:

Post a Comment

<< Home