Visual Basic .NET Forums  
Click here to advertise with us

Go Back   Visual Basic .NET Forums > ASP.NET > Web Services

Web Services Anything about web service development with VB.NET

VB.NET Forums Newsletter Signup:
Email address:


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-24-2009, 5:00 AM
VB.NET Forum Newbie
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Oct 2008
Age: 27
Posts: 8
Reputation: 0
vbcoop is on a distinguished programming path ahead
Default Web Service XML output

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 09-23-2009, 12:23 AM
Banned
.NET Framework: .NET 3.0 (VS 2005/2008)
 
Join Date: Sep 2009
Posts: 6
Reputation: 0
Sabrina Gage is on a distinguished programming path ahead
Default

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





All times are GMT -4. The time now is 12:17 PM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2


For advertising opportunities click here.