How do I change the return of a method (Webmethod) in ASMX?

Asked

Viewed 10 times

0

I developed an ASMX with a method, and when executing the code on the return of this method, it mounts an XML from a certain class defined by an XSD Schema, which however comes a TAG with suffix result, how can I change this ?

    [WebMethod]
    public UpsertContasResponse upsertContas(upsertContas.req req)
    {
       ---- codigos  -----
            var cliRetorno = new UpsertContasResponse()
            {
                codigo = req.Codigo,
                descricao = (erro == null ? null : erro),
                status = "OK",
                OrgBukrs = "XXXX"
            };
           
            return cliRetorno;
     }

XML that is generated in return :

<Soap:Envelope xmlns:Soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> Soap:Body 0000000281 OK XXXX </Soap:Body> </Soap:Envelope>

I want to change the name of this tag " "that I do not define anywhere, as I do ??

  • Which tag " "? where are you seeing this?

  • problem has been solved. I actually changed the asmx method making the process by adding the parameters below above the Method. [Soapdocumentmethod(Responseelementname = "Upsertcontasreponse")] [Return: Xmlelement("result")] This caused it to generate me the return in the expected XML format.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.