Groups | Blog | Home
all groups > dotnet web services > january 2006 >

dotnet web services : NET Web Service and XML


Sam
1/26/2006 7:42:05 AM
Hello all,

I have a requirement to to return a XML response for incoming posts to my
webservice. In addition, I can not write out to a file. I must process this
in memory. The XML response must be as follows

<xml version='1.0' standalone='no'?><!DOCTYPE SMSRESPONSE SYSTEM
'response_generic_v1.dtd'>
<SMSRESPONSE>
<REQUESTID>HTTP_T1_ID0_R302</REQUESTID>
<SMSRESPONSE>

-------------------------------------------------------------------------------------------
I coded a simple web service to see if i could return the right format as
follows

<WebMethod()> Public Function Sms() As Xml.XmlDocument
Dim strResponseData As String
Dim objXMLResponseDocument As Xml.XmlDocument = New Xml.XmlDocument

strResponseData = "<?xml version='1.0' standalone='no'?><!DOCTYPE
SMSRESPONSE SYSTEM 'response_generic_v1.dtd'>"
strResponseData += "<SMSRESPONSE>"
strResponseData += "<REQUESTID>HTTP_T1_ID0_R302</REQUESTID>"
strResponseData += "</SMSRESPONSE>"

objXMLResponseDocument.LoadXml(strResponseData)
Return objXMLResponseDocument

End Function

-------------------------------------------------------------------------------------------
When i call the function i get the following back
<?xml version="1.0" encoding="utf-8" ?>
<SMSRESPONSE>
<REQUESTID>HTTP_T1_ID0_R302</REQUESTID>
</SMSRESPONSE>

-------------------------------------------------------------------------------------------
I've tried everything to return the right format with no luck..

BTW: I added a few lines to dump the xml to a file before the return
[strOut.WriteLine(objXMLResponseDocument.OuterXml)]
Antonio Dias
1/28/2006 11:52:01 PM
don't know if this is going to sound stupid but why don't you try to
return the string that you built instead of loading it to a XmlDocument
and returning the document?

On Thu, 26 Jan 2006 15:42:05 -0000, Sam <Sam@discussions.microsoft.com>
[quoted text, click to view]



--
Sam
1/30/2006 6:58:51 AM
When I was testing this I tried the return type as string. The return string
type return the following:

<?xml version="1.0" encoding="utf-8" ?>
<string xmlns="http://tempuri.org/SMSGateway/SMSClaim"><?xml version='1.0'
standalone='no'?><!DOCTYPE SMSRESPONSE SYSTEM
'response_generic_v1.dtd'><SMSRESPONSE><REQUESTID>HTTP_T1_ID0_R302</REQUESTID></SMSRESPONSE></string>

Thank you for your response. However, I am still trying to find an answer.
/frown.

Thanks,

Sam

[quoted text, click to view]
AddThis Social Bookmark Button