XmlDocument Web method returns type XmlNode

Ask a Question related to ASP.NET Web Services, Design and Development.

  1. #1

    Default XmlDocument Web method returns type XmlNode


    I developed a web method that returns type XmlDocument.

    But a client calling the web method will only accept the return value as
    datatype XmlNode.

    Why?


    --
    [url]http://antimeme.texeme.com[/url]
    John Bailo Guest

  2. Similar Questions and Discussions

    1. WS return type, XML string or XmlDocument, which is better?
      I'm developing a set of .NET WS for internal use. The server consumer is also .NET so compatibility is not an issue. I'm weighing on whether my WS...
    2. Help! My WebService method doen't return XmlDocument objects
      I've built a web service that has a method which should return XmlDocument object's. The problem is: in the client, inspecting the web service...
    3. Webservice method returns XML.
      I wrote webservice with one method Test. When i am trying to return a simple string it works form test client. When i am trying to return an XML...
    4. Relation between XmlNode and WSDL minoccurs or type
      I have a WSDL-file that looks like the following (Part of it) - <s:complexType name="Persoonslijst"> - <s:sequence> <s:element minOccurs="0"...
    5. loading xmlcontent from one xmldocument into another xmldocument
      Hi, I get xml data into one xmldocument and other xml data into a second xmldocument. Let's say the structure of the first is <Table>...
  3. #2

    Default RE: XmlDocument Web method returns type XmlNode

    Could be that the client doesn't want the entire xmlDocument.
    Change the return type to xmlNode

    Then, take your existing xmlDocument and add the following to be returned:
    xmlDocument.SelectSingleNode(XPath Expression Goes Here)



    "John Bailo" wrote:
    >
    > I developed a web method that returns type XmlDocument.
    >
    > But a client calling the web method will only accept the return value as
    > datatype XmlNode.
    >
    > Why?
    >
    >
    > --
    > [url]http://antimeme.texeme.com[/url]
    >
    James Flynn Guest

  4. #3

    Default Re: XmlDocument Web method returns type XmlNode

    James Flynn wrote:
    > Could be that the client doesn't want the entire xmlDocument.
    > Change the return type to xmlNode
    >
    > Then, take your existing xmlDocument and add the following to be returned:
    > xmlDocument.SelectSingleNode(XPath Expression Goes Here)
    Yes, I can read it via workarounds.

    It just disturbs me that an explicitly typed complex return type
    XmlDocument is translated to a completely different type when creating
    the web reference in the client (!)

    >
    >
    >
    > "John Bailo" wrote:
    >
    >
    >>I developed a web method that returns type XmlDocument.
    >>
    >>But a client calling the web method will only accept the return value as
    >>datatype XmlNode.
    >>
    >>Why?
    >>
    >>
    >>--
    >>[url]http://antimeme.texeme.com[/url]
    >>

    --
    [url]http://antimeme.texeme.com[/url]
    John Bailo Guest

  5. #4

    Default RE: XmlDocument Web method returns type XmlNode

    Hi John,

    In general, if you really want to return raw XML to the client, as opposed
    to normal classes or .NET based native data types, try and use XmlNode as
    the return type when coding an ASP.NET webMethod. The reason is that the
    return data comes from the first element child from the SOAP:Body element -
    and thus won't be a complete document. If you really want to make a pure
    XML document based interface, use simple ASP and the DOM, instead of
    ASP.Net. This is the case when you want to include processing instructions
    that point to XSLT, etc). Otherwise, if you are simply on the
    green-diamond slopes and wanting to return plain old XML, just use XmlNode
    instead of the DOM. You can still use the DOM to build your response, and
    then peel off the node you want to return (you can only return one!).

    Hope this helps,

    Dan Rogers
    Microsoft Corporation

    --------------------
    >From: John Bailo <jabailo@earthlink.net>
    >Newsgroups:
    microsoft.public.dotnet.framework.aspnet.webservic es,microsoft.public.dotnet
    general,microsoft.public.dotnet.languages.csharp
    >Subject: XmlDocument Web method returns type XmlNode
    >Date: Fri, 22 Oct 2004 10:54:22 -0700
    >Lines: 11
    >Message-ID: <2tsvqeF23c4s0U1@uni-berlin.de>
    >Mime-Version: 1.0
    >Content-Type: text/plain; charset=us-ascii; format=flowed
    >Content-Transfer-Encoding: 7bit
    >X-Trace: news.uni-berlin.de
    3LpxG5/QqYUFUyGyb/WBPw0wNdqJiK5DPPYt/mZzRHDfDoJ4D2
    >User-Agent: Mozilla Thunderbird 0.7.3 (Windows/20040803)
    >X-Accept-Language: en-us, en
    >Path:
    cpmsftngxa10.phx.gbl!TK2MSFTNGXA01.phx.gbl!cpmsftn gxa06.phx.gbl!TK2MSFTNGP08
    phx.gbl!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!f
    u-berlin.de!uni-berlin.de!not-for-mail
    >Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.general:149951
    microsoft.public.dotnet.languages.csharp:281723
    microsoft.public.dotnet.framework.aspnet.webservic es:26210
    >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservic es
    >
    >
    >I developed a web method that returns type XmlDocument.
    >
    >But a client calling the web method will only accept the return value as
    >datatype XmlNode.
    >
    >Why?
    >
    >
    >--
    >[url]http://antimeme.texeme.com[/url]
    >
    Dan Rogers Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139