locked
Rest or web api consume xml input RRS feed

  • Question

  • User-148788041 posted

    Hi<br>
    Given a url and xml string in a file or xml string <br>
    1.url <br>
    2.c:/rest.xml<br>
    Or <br>
    Xml string in a textbox.<br>
    i want to write<br>
    Delete method<br>
    Get method<br>
    Post method<br>
    Put or patch method<br>
    Options
    Thursday, January 3, 2019 7:02 AM

All replies

  • User36583972 posted

    Hi Guhananth,


    Hi<br>
    Given a url and xml string in a file or xml string <br>
    1.url <br>
    2.c:/rest.xml<br>
    Or <br>
    Xml string in a textbox.<br>
    i want to write<br>
    Delete method<br>
    Get method<br>
    Post method<br>
    Put or patch method<br>
    Options

    We can not understand your question clearly. You may can give us a detailed information steps by steps.

    If you have make a test on your side, please include all necessary code snippets for anyone else to be able to reproduce your issue from scratch along with a detailed description about the results including any exception messages.

    Besides, if you want to pass a xml data to your Web API, You can use the following code to accept XML and retrieve the raw data.

    [HttpPost]
    public string ReturnXmlDocument(HttpRequestMessage request)
    {
        var doc = new XmlDocument();
        doc.Load(request.Content.ReadAsStreamAsync().Result);
        return doc.DocumentElement.OuterXml;
    }
    

    For more detailed, please refer the following post solution:

    How to post a xml value to web api?
    https://forums.asp.net/t/1787686.aspx?How+to+post+a+xml+value+to+web+api+

    Best Regards,

    Yong Lu

    Friday, January 4, 2019 6:34 AM
  • User-148788041 posted
    Using Get,post,put,patch,head,options how to consume web api using xml string input
    Wednesday, January 9, 2019 1:59 AM
  • User36583972 posted

    Hi Guhananth,

    Using Get,post,put,patch,head,options how to consume web api using xml string input

    Please show us all necessary code snippets you have made a test on your side, and describe clearly which issue you have faced.

    Besides, a running demo which can reproduce your issue is very important if necessary.


    Best Regards,

    Yong Lu

    Wednesday, January 9, 2019 8:20 AM