![]() |
Click here to advertise with us
|
|
|||||||
| Web Services Anything about web service development with VB.NET |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hi
I'm starting to play around with Web Services in work now, I have been able to do a simple web services get, edit or insert command. The simple get command returns the below xml (Fig 1) [XML] <classcustomer> <userId>1</userId> <username>newnewusername</username> <userForename>newnewforname</userForename> <surename>swdxdsd</surename> </classcustomer> [/XML] Now I need to do a more complex get command. The get command needs to be able to have sub nodes and look like the blow xml output (Fig 2) [XML] <classcustomer> <userId>1</userId> <username>newnewusername</username> <userForename>newnewforname</userForename> <surename>swdxdsd</surename> <group> <group id='1'>Group1</group> <group id='2'>Group2</group> </group> </classcustomer> [/XML] The Code I use at the moment is simple. It has the asmx.vb class the uses the below function [VB] Public Function getcustomer(ByVal id As Integer) As ClassLibrary.classcustomer objcust.userId = id objcust.getCustomer() Return objcust End Function [/VB] Within the classcustomer class it has public property's surename, userForename, username and userId. These are set within the getCustomer function wihtin the classcustomer. This then produces the xml output in Fig 1. <b>How do I add sub nodes within the xml (Fig 2)? Is there an easy way of altering the node names etc?</b> Thanks |
|
|||
|
You should rewritten the class(classcustomer) into the class that can be serialized xml, then you use it in you web service method, for output, you serialized it to xml, just like it.
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|