Vuoi cambiare encoding per un WebService? Non si può

Probabilmente non vi è mai capito di doverlo fare, ma se volete cambiare l'encoding del risultato di un webservice, quello che si trova nella dichiarazione dell'XML, da UTF-8 a qualcos'altro... non lo potete fare: sembra che si quella stringa sia "hardcoded" nel generatore di webservice.

Questo post, "Encoding limitations in ASMX", riporta un commento di uno sviluppatore del team MS che ha lavorato a questo:

We decided not to do this feature for 3 reasons:
1. UTF-8 can represent all Unicode characters
2. The Xml spec requires that all Xml processors understand UTF-8
3. We were short for time and there were other interesting features to consider.

We found out later that in the real world #2 just isn't the case. If we'd known that we probably would have made a different decision.

Interessante la 3a spiegazione "We were short for time" ...

Un'altro caso dove le specifiche non sono rispettate, e bisogna sviluppare sw che gestisce anche le cose non a specifica.

powered by IMHO 1.3

posted @ lunedì 12 giugno 2006 15.54

Print

Comments on this entry:

# re: Vuoi cambiare encoding per un WebService? Non si può

Left by Marco De Sanctis at 12/06/2006 16.52
Gravatar
Premetto che potrei sbagliarmi, ma la cosa interessante, Simone, è che (ma potrei sbagliarmi) i proxy che vengono generati aggiungendo web references si aspettano UTF-8. Infatti ho avuto alcune grane nel far funzionare con .NET 1.1 un servizio sviluppato in Delphi7

# re: Vuoi cambiare encoding per un WebService? Non si può

Left by Simone Chiaretta at 12/06/2006 17.09
Gravatar
Il problema che il proxy ora viene generato da qualche tool java di un cliente e, anche se tutti i proxy generator dovrebbero andare con UTF-8, quello poi non fa corretamente il parsing della risposta se è in UTF-8

# re: Vuoi cambiare encoding per un WebService? Non si può

Left by Lorenzo Barbieri at 12/06/2006 18.43
Gravatar
Non potresti mettere un filtro asp.net (o come cavolo si chiamano) che ti cambia al volo l'encoding del messaggio generato per quella webapp?

# re: Vuoi cambiare encoding per un WebService? Non si può

Left by Simone Chiaretta at 12/06/2006 18.59
Gravatar
Prima vediamo se il cliente riesce ad aggiornare il suo proxy x supportare UTF-8 (che è una delle caratteristiche standard di un proxy x webservices)
Se poi non ci riesce troveremo un modo
Comments have been closed on this topic.
«febbraio»
domlunmarmergiovensab
2930311234
567891011
12131415161718
19202122232425
26272829123
45678910