简体   繁体   中英

Proxy web Service .net

i am writing a proxy web service which accepts the xml and sends it to another http service. problem is when i read the xml it always comes as null.

here is my code

      [WebMethod]
        public string HelloWorld(string xml)
        {

             xml= @"<env> <body>" + xml + @"</body> </env>";           
            return HttpPost("hhtp://testservice/", xml) ;
        }

here is my request xml

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">
   <soapenv:Header/>
   <soapenv:Body>
      <HelloWorld>
         <!--Optional:-->
         <xml>
            <request1>
            <value1 test="a"/>
        </request1>
</xml>
      </HelloWorld>
   </soapenv:Body>
</soapenv:Envelope>

if i use the Visual studio debugger and give the xml below i can see the values comming in, but using soapui to send the xml above i had i get Null as xml.

            <request1>
            <value1 test="a"/>
        </request1>

UPDATE I used XMDocument instead of using string

Use the XmlTextReader object to read the disk file into the XmlDocument object.

You can find a code sample from the following code project url,

http://www.codeproject.com/KB/XML/csreadxml1.aspx

Hope this helps you...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM