powered by simpleCommunicator - 2.0.49     © 2025 Programmizd 02
Форумы / WCF, Web Services, Remoting [игнор отключен] [закрыт для гостей] / System.ServiceModel.ProtocolException: {"The content type text/xml; charset=windows-1251
8 сообщений из 8, страница 1 из 1
System.ServiceModel.ProtocolException: {"The content type text/xml; charset=windows-1251
    #36858277
Кто-нибудь сталкивался с такой ошибкой? В инете почитал - пишут что угодно - не поймешь ничего...

Вообще тут по ходу работы моей проги происходит обращение к Assist (для процессинга платиковых карт) - суппорту написал, но они молчат как партизаны. Это вообще-то даже не сам процессинг пока, а только курсы ЦБ вычитываются.
Дальше по алгоритму прога просто пока не пошла - слишком много проблем даже на этом этапе. Но все вызовы сервисов делаются по идее в той же среде (кодировки и вся прочая хрень).
Не понимаю, как может быть не та кодировка, если я тупо сгенерировал из студии стандартные обертки ServiceReference.
Совершенно никаких ручных правок не вносил.
Что вообще происходит?

System.ServiceModel.ProtocolException{"The content type text/xml; charset=windows-1251 of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 536 bytes of the response were: '<?xml version='1.0' encoding='windows-1251' standalone='no'?> <SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema'> <SOAP-ENV:Body SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'> <SOAP-ENV:Fault> <faultcode>5</faultcode> <faultstring>100</faultstring> <detail></detail> </SOAP-ENV:Fault> </SOAP-ENV:Body> </SOAP-ENV:Envelope>'."}
System.ServiceModel.ProtocolException: {"The content type text/xml; charset=windows-1251 of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 536 bytes of the response were: '<?xml version='1.0' encoding='windows-1251' standalone='no'?> <SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema'> <SOAP-ENV:Body SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'> <SOAP-ENV:Fault> <faultcode>5</faultcode> <faultstring>100</faultstring> <detail></detail> </SOAP-ENV:Fault> </SOAP-ENV:Body> </SOAP-ENV:Envelope>'."}
Data: {System.Collections.ListDictionaryInternal}
HelpLink: Nothing
InnerException: Nothing
Message: "The content type text/xml; charset=windows-1251 of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 536 bytes of the response were: '<?xml version='1.0' encoding='windows-1251' standalone='no'?> <SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema'> <SOAP-ENV:Body SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'> <SOAP-ENV:Fault> <faultcode>5</faultcode> <faultstring>100</faultstring> <detail></detail> </SOAP-ENV:Fault> </SOAP-ENV:Body> </SOAP-ENV:Envelope>'."
Source: "mscorlib"
StackTrace: " Server stack trace: at System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory factory, WebException responseException, ChannelBinding channelBinding) at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout) at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operati
on) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at AssistTestKurs.AssistSoapPort.GetRate(GetRateRequest request) at AssistTestKurs.AssistSoapPortClient.AssistTestKurs.AssistSoapPort.GetRate(GetRateRequest request) in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\www\bc44e63b\e2f0d5df\App_WebReferences.xi_emj5s.5.cs:line 158 at AssistTestKurs.AssistSoapPortClient.GetRate(Int32 shop_id, String login, String password, String currency, String date) in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\www\bc44e63b\e2f0d5df\App_WebReferences.xi_emj5s.5.cs:line 168 at Test.Button1_Click(Object sender, EventArgs e) in G:\Projects\Airts\Www\Test.aspx.vb:line 17"
TargetSite: {System.Reflection.RuntimeMethodInfo}
...
Рейтинг: 0 / 0
System.ServiceModel.ProtocolException: {"The content type text/xml; charset=windows-1251
    #36858436
AlexeiK
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Быдло-Кодер,

да все просто.
http же всегда передает в какой кодировке будет передано сообщение.
вот тебе говорят.что служба откуда ты берешь данные передает в 1251, а служба твоя имеет в биндинге настройку для utf8.
...
Рейтинг: 0 / 0
System.ServiceModel.ProtocolException: {"The content type text/xml; charset=windows-1251
    #36858852
а почему это происходит? мне надо изменить в конфигурации привязку?
я наверное туплю, но мне казалось, что если я вычитываю WSDL некой службы - то все биндинги там по умолчанию уже прописаны
мне наверное просто везло - я уже делал несколько проектов, обращающихся к внешним сервисам и мне не требовалось вручную менять биндинги в кодировках - из этого я сделал вывод что WSDL содержит все необходимые данные для кодировки
этот вывод неверный? после онлайнового выдергивания wsdl надо еще обязательно подгонять как минимум кодировку в биндинге чтобы обратиться к внешнему сервису?
...
Рейтинг: 0 / 0
System.ServiceModel.ProtocolException: {"The content type text/xml; charset=windows-1251
    #36858900
все, техподдержку Ассиста заклинило - они утверждают, что я не знаю своих логинов/паролей/shop_id (хотя я сейчас сижу в их панели и оттуда переговариваюсь с их суппортом)
остается понять в чем же дело (теперь уже без супорта Ассиста)

Итак, они мне отдали вот такой WSDL

Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
<?xml version="1.0" encoding="utf-8"?>
<definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:typens="http://www.assist.ru/type/" xmlns:stk="http://schemas.microsoft.com/soap-toolkit/wsdl-extension" xmlns:wsdlns="http://www.assist.ru/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Assist" targetNamespace="http://www.assist.ru/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/">
  <types>
    <xsd:schema xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://www.assist.ru/type/">
      <xsd:complexType name="SOAPStruct">
        <xsd:all>
          <xsd:element name="currency" type="xsd:string" />
          <xsd:element name="date" type="xsd:string" />
          <xsd:element name="rate" type="xsd:string" />
        </xsd:all>
      </xsd:complexType>
    </xsd:schema>
  </types>
  <message name="Assist.GetRate">
    <part name="shop_id" type="xsd:int" />
    <part name="login" type="xsd:string" />
    <part name="password" type="xsd:string" />
    <part name="currency" type="xsd:string" />
    <part name="date" type="xsd:string" />
  </message>
  <message name="Assist.GetRateResponse">
    <part name="return" type="typens:SOAPStruct" />
  </message>
  <portType name="AssistSoapPort">
    <operation name="GetRate" parameterOrder="shop_id login password currency date">
      <input message="wsdlns:Assist.GetRate" />
      <output message="wsdlns:Assist.GetRateResponse" />
    </operation>
  </portType>
  <binding name="AssistSoapBinding" type="wsdlns:AssistSoapPort">
    <stk:binding preferredEncoding="UTF-8" />
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc" />
    <operation name="GetRate">
      <soap:operation soapAction="http://www.assist.ru/rate/getrate" />
      <input>
        <soap:body use="encoded" namespace="http://www.assist.ru/message/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
      </input>
      <output>
        <soap:body use="encoded" namespace="http://www.assist.ru/message/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
      </output>
    </operation>
  </binding>
  <service name="Assist">
    <port name="AssistSoapPort" binding="wsdlns:AssistSoapBinding">
      <soap:address location="https://secure.assist.ru/rate/rateusd.cfm?format=4" />
    </port>
  </service>
</definitions>

MS Visual Studio сгенерировала мне вот такие привязки

Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
    <binding name="AssistSoapBinding6" closeTimeout="00:01:00" openTimeout="00:01:00"
     receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
     bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
     maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
     messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
     useDefaultWebProxy="true">
     <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
      maxBytesPerRead="4096" maxNameTableCharCount="16384" />
     <security mode="Transport">
      <transport clientCredentialType="None" proxyCredentialType="None"
       realm="" />
      <message clientCredentialType="UserName" algorithmSuite="Default" />
     </security>
    </binding>

Что здесь надо поправить за Visual Studio? (то что бросается в глаза - я пробовал править)
...
Рейтинг: 0 / 0
System.ServiceModel.ProtocolException: {"The content type text/xml; charset=windows-1251
    #36858976
ну собственно я перепробовал все кодировки, которые смог придумать
ISO-8859-5
ISO-8859-1
WINDOWS-1251
CP866
KOI8-r
KOI8-ru
utf-7

во всех случаях получил такое сообщение:
Код: plaintext
The text encoding 'iso-8859-5' used in the text message format is not supported. Parameter name: encoding

не понимаю, что за хрень - самый распространеный российский сервис...
как то ж он работает?
я ничего специального не делал - считал просто студией его WSDL

в чем тут хитрость - что такая элементарная задачка не решаема?
это все заточено именно одно для другого (и ни для чего другого не применимо) - биндинги, публичный платежный сервис, wcf, автоматически сгенерированный MS-студией враппер?
откуда ж такие глюки?
...
Рейтинг: 0 / 0
System.ServiceModel.ProtocolException: {"The content type text/xml; charset=windows-1251
    #36859493
AlexeiK
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Быдло-Кодер,

ты уже код дай, который можно запустить. хоре тут задачки по своему глючному коду задавать :)
...
Рейтинг: 0 / 0
System.ServiceModel.ProtocolException: {"The content type text/xml; charset=windows-1251
    #36859594
да нету тут никакого кода

обьявляется единственный обект, который возможно обьявить по сгенерированной обертке
в нем единственный метод, принимающий пять параметров - логин, пароль, shop_id, код валюты и дата

как такового кода нету = есть сгенерированный студией прокси-класс, по онлайновому обьявлению WSDL
есть единственный обявленный метод в WSDL, есть логин, пароль, номер магазина, которые я вижу в панели Ассиста, есть коды валют в документации (USD) и есть дата - ВСЕ.

какой тут может быть код - одна строчка обращения к прокси классу, сгенерированному студией по официально обьявленному публичному WSDL

насколько я понимаю - этот вопрос задан, чтобы увести обсуждение в сторону от того, КАКИЕ ИМЕННО кодировки поддерживает стандартный клиент WCF?
...
Рейтинг: 0 / 0
System.ServiceModel.ProtocolException: {"The content type text/xml; charset=windows-1251
    #36859723
Да, теперь я понял, что круче Ассиста только вареные яйца - не зря у них нет официального публичного форума техподдержки.

Впрочем к заданному вопросу вопросу о поддержке различных кодировок микрософтовским WCF-клиентом это отношения не имеет.
...
Рейтинг: 0 / 0
8 сообщений из 8, страница 1 из 1
Форумы / WCF, Web Services, Remoting [игнор отключен] [закрыт для гостей] / System.ServiceModel.ProtocolException: {"The content type text/xml; charset=windows-1251
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]