Pass a xml doc to a web service?
-
I’m fairly new to the web service world so try not to laugh if this is a dumb question. Using visual studio .net I have created a web service and a client side app to make requests to that service. The current requests are simply passing string variables. If possible I would like to pass the entire contents of an xml document, how is this done? Thanks Jason W.
-
I’m fairly new to the web service world so try not to laugh if this is a dumb question. Using visual studio .net I have created a web service and a client side app to make requests to that service. The current requests are simply passing string variables. If possible I would like to pass the entire contents of an xml document, how is this done? Thanks Jason W.
here is a simple example:
[WebMethod( Description = "a test of passing XML documents" )] public XmlDocument AddElementToDocument(XmlDocument source, string elementName) { source.ChildNodes[0].AppendChild(source.createElement(elementName)); return source; }
"When the only tool you have is a hammer, a sore thumb you will have."
-
here is a simple example:
[WebMethod( Description = "a test of passing XML documents" )] public XmlDocument AddElementToDocument(XmlDocument source, string elementName) { source.ChildNodes[0].AppendChild(source.createElement(elementName)); return source; }
"When the only tool you have is a hammer, a sore thumb you will have."
I’ll look at it, thanks. Jason W.
-
here is a simple example:
[WebMethod( Description = "a test of passing XML documents" )] public XmlDocument AddElementToDocument(XmlDocument source, string elementName) { source.ChildNodes[0].AppendChild(source.createElement(elementName)); return source; }
"When the only tool you have is a hammer, a sore thumb you will have."
Ok, I have setup the web service as such, basically the VB equivalent of your code:
<WebMethod()> _ Public Function AddElementToDocument(ByVal source As XmlDocument) As String Return "Accepted" End Function
Now I can’t get the client app to pass the document to the service. The function is asking for a system.xml.xmlnode object. Why is it prompting for that and what needs to be done about it? Thanks your help. Jason W. -
Ok, I have setup the web service as such, basically the VB equivalent of your code:
<WebMethod()> _ Public Function AddElementToDocument(ByVal source As XmlDocument) As String Return "Accepted" End Function
Now I can’t get the client app to pass the document to the service. The function is asking for a system.xml.xmlnode object. Why is it prompting for that and what needs to be done about it? Thanks your help. Jason W.whats the client code.... also "ByVal" - should be ByRef?
"When the only tool you have is a hammer, a sore thumb you will have."
-
whats the client code.... also "ByVal" - should be ByRef?
"When the only tool you have is a hammer, a sore thumb you will have."
Thanks, Jason W.