我用c#控制塔程序想调用一个Webservice服务端(http://xurrency.com/api.wsdl),服务端编码是ISO-8859-1
代码如下:using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{ ServiceReference1.xurrencyPortTypeClient a = new ConsoleApplication1.ServiceReference1.xurrencyPortTypeClient();
string[] strs = a.getCurrencies();
}
}
}
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel >
<bindings>
<basicHttpBinding>
<binding name="xurrencyBinding" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="6553600" maxBufferPoolSize="524288" maxReceivedMessageSize="6553600"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://xurrency.com/servidor_soap.php" binding="basicHttpBinding"
bindingConfiguration="xurrencyBinding" contract="ServiceReference1.xurrencyPortType"
name="xurrencyPort" />
</client>
</system.serviceModel>
</configuration>
按如上配置a对象可以生成,但是a.getCurrencies()报错,错误信息为(The content type text/xml; charset=ISO-8859-1 of the response message does not match the content type of the binding (text/xml; charset=utf-8))我把textEncoding="utf-8"改成textEncoding="ISO-8859-1"
a对象都生成不了,错误信息为(The text encoding 'iso-8859-1' used in the text message format is not supported.
Parameter name: encoding)这个到底怎么搞啊?
代码如下:using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{ ServiceReference1.xurrencyPortTypeClient a = new ConsoleApplication1.ServiceReference1.xurrencyPortTypeClient();
string[] strs = a.getCurrencies();
}
}
}
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel >
<bindings>
<basicHttpBinding>
<binding name="xurrencyBinding" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="6553600" maxBufferPoolSize="524288" maxReceivedMessageSize="6553600"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://xurrency.com/servidor_soap.php" binding="basicHttpBinding"
bindingConfiguration="xurrencyBinding" contract="ServiceReference1.xurrencyPortType"
name="xurrencyPort" />
</client>
</system.serviceModel>
</configuration>
按如上配置a对象可以生成,但是a.getCurrencies()报错,错误信息为(The content type text/xml; charset=ISO-8859-1 of the response message does not match the content type of the binding (text/xml; charset=utf-8))我把textEncoding="utf-8"改成textEncoding="ISO-8859-1"
a对象都生成不了,错误信息为(The text encoding 'iso-8859-1' used in the text message format is not supported.
Parameter name: encoding)这个到底怎么搞啊?
textEncoding="utf-8"