Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. Pass a xml doc to a web service?

Pass a xml doc to a web service?

Scheduled Pinned Locked Moved XML / XSL
csharpquestionvisual-studiocomxml
6 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jason Weibel
    wrote on last edited by
    #1

    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.

    P 1 Reply Last reply
    0
    • J Jason Weibel

      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.

      P Offline
      P Offline
      Philip Fitzsimons
      wrote on last edited by
      #2

      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."

      J 2 Replies Last reply
      0
      • P Philip Fitzsimons

        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."

        J Offline
        J Offline
        Jason Weibel
        wrote on last edited by
        #3

        I’ll look at it, thanks. Jason W.

        1 Reply Last reply
        0
        • P Philip Fitzsimons

          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."

          J Offline
          J Offline
          Jason Weibel
          wrote on last edited by
          #4

          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.

          P 1 Reply Last reply
          0
          • J Jason Weibel

            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.

            P Offline
            P Offline
            Philip Fitzsimons
            wrote on last edited by
            #5

            whats the client code.... also "ByVal" - should be ByRef?


            "When the only tool you have is a hammer, a sore thumb you will have."

            J 1 Reply Last reply
            0
            • P Philip Fitzsimons

              whats the client code.... also "ByVal" - should be ByRef?


              "When the only tool you have is a hammer, a sore thumb you will have."

              J Offline
              J Offline
              Jason Weibel
              wrote on last edited by
              #6

              Thanks, Jason W.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups