none
Web Services Change Econding return values RRS feed

  • Question

  • I have a C# web service which has one web methods which return the values with  UTF-8 encoding, and I want to change it to ISO-8859-1. How I can do that?

    Actually when the consumer call the web service the answer is:

    <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="" xmlns:xsi="" xmlns:xsd="">  <soap:Body>    <CreateRecordResponse xmlns="">      <CreateRecordResult>          <VALUE1>Valor Resultado</VALUE1>          <ERROR>OK</ERROR >          <ID>00100101</ID>      </CreateRecordResult>    </CreateRecordResponse >  </soap:Body></soap:Envelope>

    But I need this one:

    <?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="" xmlns:xsd="" xmlns:xsi="" xmlns:SOAP-ENC="">  <SOAP-ENV:Body>    <CreateRecordResponse xmlns="">      <return>        <VALUE1>Valor Resultado</VALUE1>        <ERROR> OK </ERROR>        <ID>00100101</ID>      </return>    </CreateRecordResponse>  </SOAP-ENV:Body></SOAP-ENV:Envelope>

    Using SAOP Version:

    SOAP 1.1

    The following is a sample SOAP 1.1 request and response.  The placeholders shown need to be replaced with actual values.

    SOAP 1.1

    The following is a sample SOAP 1.1 request and response.  The placeholders shown need to be replaced with actual values.

    POST /xxxx.asmx HTTP/1.1 Host: localhost Content-Type: text/xml; charset=utf-8 (I need the answer on ISO-8859-1Content-Length: length SOAPAction: "XXXXXX" <?xml version="1.0" encoding="utf-8"?>

    I need the format on

    <?xml version="1.0" encoding="ISO-8859-1"?>

    • Moved by Anne Jing Wednesday, July 16, 2014 3:17 AM
    Monday, July 14, 2014 4:09 PM

Answers

  • Hi,

    It seems that you are using the ASMX Web Service, then first please try to add the following to your config file to see if it helps:

    <globalization requestEncoding="ISO-8859-1"
                   responseEncoding="ISO-8859-1"
                   fileEncoding="ISO-8859-1"/>

    If the above can not help, please try to post your question to the ASMX Web Service forum, then you will get good replies from the ASMX Web Service experts.
    #ASMX Web Service Forum:
    http://forums.asp.net/28.aspx .

    Thanks for your understanding.

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Wednesday, July 16, 2014 5:48 AM
    Moderator

All replies

  • This is no my case, I need to return the webservice values on ISO-8859-1 format, because the consumer only supports this format.
    Monday, July 14, 2014 11:47 PM
  • This is no my case, I need to return the webservice values on ISO-8859-1 format, because the consumer only supports this format.

    In this case I'm the provider and the other side is the consumer. and the consumer need encoding ISO-8859-1, and the default format for ASP.WEB Services is UTF-8.


    Monday, July 14, 2014 11:50 PM
  • Hi,

    It seems that you are using the ASMX Web Service, then first please try to add the following to your config file to see if it helps:

    <globalization requestEncoding="ISO-8859-1"
                   responseEncoding="ISO-8859-1"
                   fileEncoding="ISO-8859-1"/>

    If the above can not help, please try to post your question to the ASMX Web Service forum, then you will get good replies from the ASMX Web Service experts.
    #ASMX Web Service Forum:
    http://forums.asp.net/28.aspx .

    Thanks for your understanding.

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Wednesday, July 16, 2014 5:48 AM
    Moderator