This is my first attempt at writing an XML web service.
I have a query successfully written for SQL Server that returns XML data
using FOR XML AUTO. It seems rather than processing the XML and building a
text string in XML format to return, there should be some way to directly
return the XML I get from SQL Server. What I seem to be getting is a
properly formatted XML string that is not identified as XML (not sure why),
but I want this to work pretty much like an RSS feed. I don't know how those
are generated, but whatever requests them knows what to do with them. What I
return should also be recognizable as an XML document. What is the best way
to do this?
Thanks!
Tony 8 2051
I do not have an answer right this second, as it has been awhile, but the
answer is located in books online.
By default, you get an XML snippet from the FOR XML features in SQL Server.
There is either a flag that returns a proper root or an easy way to get it
to return. Then you will have valid XML.
If I get the chance, I will post, but take a look at the SQL books online
FOR XML documentation and you should find the answer.
--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA
Subscribe to my blog http://gregorybeamer.spaces.live.com/lists/feed.rss
or just read it: http://gregorybeamer.spaces.live.com/
********************************************
| Think outside the box! |
********************************************
"Anthony Bollinger" <to***@noemail.noemailwrote in message
news:%2*****************@TK2MSFTNGP02.phx.gbl...
This is my first attempt at writing an XML web service.
I have a query successfully written for SQL Server that returns XML data
using FOR XML AUTO. It seems rather than processing the XML and building a
text string in XML format to return, there should be some way to directly
return the XML I get from SQL Server. What I seem to be getting is a
properly formatted XML string that is not identified as XML (not sure
why), but I want this to work pretty much like an RSS feed. I don't know
how those are generated, but whatever requests them knows what to do with
them. What I return should also be recognizable as an XML document. What
is the best way to do this?
Thanks!
Tony
properly formatted XML string that is not identified as XML (not sure
why), but I want this to work pretty much like an RSS feed. I don't know
how those
I think the reason is that the XML string does not have a root.
You can use:
SELECT * FROM TableName FOR XML RAW('NameOfRootElement')
HTH
--
Happy Hacking,
Gaurav Vaish | http://dwt.sourceforge.net http://blogs.mastergaurav.com | http://eduzine.edujini-labs.com
--------------------------------
properly formatted XML string that is not identified as XML (not sure
why), but I want this to work pretty much like an RSS feed. I don't know
how those
I think the reason is that the XML string does not have a root.
You can use:
SELECT * FROM TableName FOR XML RAW('NameOfRootElement')
HTH
--
Happy Hacking,
Gaurav Vaish | http://dwt.sourceforge.net http://blogs.mastergaurav.com | http://eduzine.edujini-labs.com
--------------------------------
Thank you for your answer. I am not sure which SQL books online you mean.
Could you post a URL or two?
I do not think the issue I am having is proper XML, since I have that, but
rather it is not identified on the receiving end as XML, even though the
returned file is properly formatted. In fact, my first line is:
<?xml version="1.0" encoding="utf-8" ?>
And the remainder is a full XML document.
Unfortunately, I must need to set something additional in the web service
response, because consumers are not recognizing this as an XML file. Is
there a way to set the type of the response? I think I have seen this.
Many thanks! --Tony
"Cowboy (Gregory A. Beamer)" <No************@comcast.netNoSpamMwrote in
message news:%2****************@TK2MSFTNGP04.phx.gbl...
>I do not have an answer right this second, as it has been awhile, but the answer is located in books online.
By default, you get an XML snippet from the FOR XML features in SQL
Server. There is either a flag that returns a proper root or an easy way
to get it to return. Then you will have valid XML.
If I get the chance, I will post, but take a look at the SQL books online
FOR XML documentation and you should find the answer.
--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA
Subscribe to my blog http://gregorybeamer.spaces.live.com/lists/feed.rss
or just read it: http://gregorybeamer.spaces.live.com/
********************************************
| Think outside the box! |
********************************************
"Anthony Bollinger" <to***@noemail.noemailwrote in message
news:%2*****************@TK2MSFTNGP02.phx.gbl...
>This is my first attempt at writing an XML web service.
I have a query successfully written for SQL Server that returns XML data using FOR XML AUTO. It seems rather than processing the XML and building a text string in XML format to return, there should be some way to directly return the XML I get from SQL Server. What I seem to be getting is a properly formatted XML string that is not identified as XML (not sure why), but I want this to work pretty much like an RSS feed. I don't know how those are generated, but whatever requests them knows what to do with them. What I return should also be recognizable as an XML document. What is the best way to do this?
Thanks! Tony
"Anthony Bollinger" <to***@noemail.noemailwrote in message
news:uN**************@TK2MSFTNGP05.phx.gbl...
>the answer is located in books online.
take a look at the SQL books online
Thank you for your answer. I am not sure which SQL books online you mean.
Gregory is referring to SQL Server Books Online - an electronic helpfile
installed (optionally) when you install SQL Server 2005. If you installed
it, you'll find the link in Start, Programs, SQL Server 2005, Documentation
and Tutorials.
--
Mark Rae
ASP.NET MVP http://www.markrae.net
re:
!I am not sure which SQL books online you mean.
!Could you post a URL or two?
SQL Server Books Online...
General info : http://msdn.microsoft.com/en-us/library/ms166018.aspx
Download : http://www.microsoft.com/downloads/d...displaylang=en
Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"Anthony Bollinger" <to***@noemail.noemailwrote in message news:uN**************@TK2MSFTNGP05.phx.gbl...
Thank you for your answer. I am not sure which SQL books online you mean. Could you post a URL or two?
I do not think the issue I am having is proper XML, since I have that, but rather it is not identified on the
receiving end as XML, even though the returned file is properly formatted. In fact, my first line is:
<?xml version="1.0" encoding="utf-8" ?>
And the remainder is a full XML document.
Unfortunately, I must need to set something additional in the web service response, because consumers are not
recognizing this as an XML file. Is there a way to set the type of the response? I think I have seen this.
Many thanks! --Tony
"Cowboy (Gregory A. Beamer)" <No************@comcast.netNoSpamMwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>>I do not have an answer right this second, as it has been awhile, but the answer is located in books online.
By default, you get an XML snippet from the FOR XML features in SQL Server. There is either a flag that returns a proper root or an easy way to get it to return. Then you will have valid XML.
If I get the chance, I will post, but take a look at the SQL books online FOR XML documentation and you should find the answer.
-- Gregory A. Beamer MVP, MCP: +I, SE, SD, DBA
Subscribe to my blog http://gregorybeamer.spaces.live.com/lists/feed.rss
or just read it: http://gregorybeamer.spaces.live.com/
******************************************** | Think outside the box! | ******************************************** "Anthony Bollinger" <to***@noemail.noemailwrote in message news:%2*****************@TK2MSFTNGP02.phx.gbl...
>>This is my first attempt at writing an XML web service.
I have a query successfully written for SQL Server that returns XML data using FOR XML AUTO. It seems rather than processing the XML and building a text string in XML format to return, there should be some way to directly return the XML I get from SQL Server. What I seem to be getting is a properly formatted XML string that is not identified as XML (not sure why), but I want this to work pretty much like an RSS feed. I don't know how those are generated, but whatever requests them knows what to do with them. What I return should also be recognizable as an XML document. What is the best way to do this?
Thanks! Tony
Thanks for that. Also, I think you are referring to the ROOT
keyword/function which will generate a root node around your XML elements in
query results returned from SQL 2005. --Joe
Yes, that is it. I assume you found the SQL books online file?
--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA
Subscribe to my blog http://gregorybeamer.spaces.live.com/lists/feed.rss
or just read it: http://gregorybeamer.spaces.live.com/
********************************************
| Think outside the box! |
********************************************
"Anthony Bollinger" <to***@noemail.noemailwrote in message
news:uV**************@TK2MSFTNGP04.phx.gbl...
Thanks for that. Also, I think you are referring to the ROOT
keyword/function which will generate a root node around your XML elements
in query results returned from SQL 2005. --Joe
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Varun |
last post by:
Hi There,
I have a form("myRequest.asp") and the values from it are
retrieved into the page ("output_Print.asp") on which I have two
buttons('Save As Complete' and 'Save As Incomplete'). When the...
|
by: Zhichun Pu |
last post by:
Hi guys,
I can't seem to get anything returned from functions.
If I use the <script src = ... > command, nothing works. But if I
define the functions locally within the file, then it works.
...
|
by: Robert Oschler |
last post by:
I have a "child" document that I use for an IFRAME element that I put into
several "parent" documents. These "parent" documents therefore contain the
IFRAME whose SRC property is set to the...
|
by: jen_designs |
last post by:
Is there a way to return the character position on a page? Not the x
and y coordinates, but the number of characters on a page. For
instance i have a html page with the following text: This is my...
|
by: davo |
last post by:
I've been puzzled by this one for ages. I've tried everything I can think of, and now it is time to ask for help.
THE APPLICATION
A J2EE application which reads an XML file from the /WEB-INF/xml...
|
by: MSDNAndi |
last post by:
Hi,
I have a set of simple webservices calls that worked fine using .NET
Framework 1.0.
I am calling a Java/Apache based webservices, the calling side is not able
to supply a proper WSDL.
...
|
by: weston |
last post by:
I've got a piece of code where, for all the world, it looks like this
fails in IE 6:
hometab = document.getElementById('hometab');
but this succeeds:
hometabemt =...
|
by: kurtj |
last post by:
Hello Gurus:
I have a validation script (below) that is somehow messed up. If the
Name field is blank, I get the alert message, then the browser window
goes to a blank document with the word...
|
by: Sudarhan |
last post by:
Hello frnds
I have created a webbased form using asp and javascript .. while submitting the form i am validating the fields in the form .it validates the field and returns alert message. but when...
|
by: TompIfe |
last post by:
Hi,
I have a web service that reads data from an Access database using
datareader and place the data in an array that
the web method returns.
Now, I want to make the web service also to return an...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |