get request in web service (.asmx) with accent

Viewed 13

I created a simple web service to show my problem. In this service, I have one method HelloWord with a Class1 parameter. This class Class1 has just one string attribute.

My problem is: When I put vogals with accents or symbols and get the request, I receive just "?????????". Why this is happening and how I correct this?

Web Service:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;

namespace testeService
{
    /// <summary>
    /// Summary description for testeAsmx
    /// </summary>
    [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 testeAsmx : System.Web.Services.WebService
    {

        [WebMethod]
        public string HelloWorld(Class1 testClass)
        {
            return testClass.test;
        }


    }

    public class Class1
    {
        public string test { get; set; }
    }
}

Xml request sent in postman:

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <HelloWorld xmlns="http://tempuri.org/">
      <testClass>
        <test>áãàäåæóõô</test>
      </testClass>
    </HelloWorld>
  </soap:Body>
</soap:Envelope>

Xml response received in postman:

<?xml version="1.0" encoding="utf-8"?>
<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>
        <HelloWorldResponse xmlns="http://tempuri.org/">
            <HelloWorldResult>??????????????????</HelloWorldResult>
        </HelloWorldResponse>
    </soap:Body>
</soap:Envelope>

enter image description here

Obs1: I tried to encoding with utf-8, UTF-8 and ISO-8859-1 and nothing happens.

0 Answers
Related