Link to home
Start Free TrialLog in
Avatar of GeneBe
GeneBeFlag for United States of America

asked on

changing the xml tag on the web service result

public int Calculator(int fristno, int secondno)
        {
            return(fristno + secondno);
        }

this will give int as an element tag. how do I customized that?
Avatar of ste5an
ste5an
Flag of Germany image

Post a concise and complete example. The important parts are missing. Also post your XML.
Avatar of GeneBe

ASKER

source code:

    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
    // [System.Web.Script.Services.ScriptService]
    public class Calculator : System.Web.Services.WebService
    {

        [WebMethod]

        public int WSCalculator(int fristno, int secondno)
        {
            return (fristno + secondno);
        }

    }

entered:  fristno = 10 and secondno = 30

WebService response:
<?xml version="1.0" encoding="UTF-8"?>
<int xmlns="http://tempuri.org/">40</int>


I want to change the "int" to "Sum"  like so <int xmlns="http://tempuri.org/">40</int>
to <Sum xmlns="http://tempuri.org/">40</Sum>
Avatar of GeneBe

ASKER

this is the xml response:
<?xml version="1.0" encoding="UTF-8"?>
<string xmlns="http://tempuri.org/">
<Member>
<LastName>Gabriel</LastName>
<FirstName>Julian</FirstName>
<AltKey>000011101</AltKey>
<HCFANbr>000011101</HCFANbr>
<ContractNbr>0000111</ContractNbr>
<BirthDate>2001-06-14T00:00:00</BirthDate>
</Member>
</string>
ASKER CERTIFIED SOLUTION
Avatar of GeneBe
GeneBe
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial