I have quite a bit of experience with Visual Basic .NET but I'm just now getting into Web Services. I'm writing a basic AJAX based script that needs to communicate with a web service to retrieve new data. I am attempting to retrieve new messages from the server / database.
What I need to do is be able to return just a very simple basic XML structure. I'd like to be able to create my XML by hand and return it instead of the web service returning it automatically. For instance. In testing, if I create my WebMethod with type String, and return it, the framework automatically wraps it in XML and puts my string into a String element within the XML. If I use a dataset, it returns the entire schema as well as additional properties. All data I need to return will be of type string and will be very simple, but I will be making requests approximately every 15 to 20 seconds and would like to reduce overhead by returning only a very simple structure. Here is an example of what I'm trying to accomplish. The XML I'd like to return would have two basic pieces of information, so let's use the following example (note that this isn't the actual data I'll be returning, but the structure is the same):
<Auths>
<Auth>
<Username>User</Username>
<Email>someemail@example.c
om</Email>
</Auth>
</Auths>
<Messages>
<Message>
<MessageTitle>Sample #1</MessageTitle>
<MessageTime>10:05 PM</MessageTime>
<MessageText>This is my sample message</MessageText>
</Message>
<Message>
<MessageTitle>Sample #2</MessageTitle>
<MessageTime>10:06 PM</MessageTime>
<MessageText>This is another sample message</MessageText>
</Message>
</Messages>
Is a Web Service the way to go or should I just use an ASPX Page and set the content type and manually return a string of XML?
Start Free Trial