WebService 常用的设置

Posted Johar

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了WebService 常用的设置相关的知识,希望对你有一定的参考价值。

1.修改WebService接收长度

<binding name="IAuthServiceSoap11Binding" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647"/>
<binding name="ICuServiceSoap11Binding" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647"/>


或者

<binding name="IAuthServiceSoap12Binding">
<textMessageEncoding messageVersion="Soap12" />
<httpTransport maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647"/>
</binding>
<binding name="ICuServiceSoap12Binding">
<textMessageEncoding messageVersion="Soap12" />
<httpTransport maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647"/>
</binding>

2. 设置WebService认证的用户名和密码

<basicHttpBinding>
<binding name="IWsOpsServiceSoap11Binding" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647" >
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Basic"/>
<message clientCredentialType="UserName"/>
</security>
</binding>
</basicHttpBinding>

 

string address = string.Format("http://{0}:{1}/ops/services/IWsOpsService.IWsOpsServiceHttpSoap11Endpoint/", ip, port);
var client = new WsOpsService.WsOpsServicePortTypeClient("IWsOpsServiceHttpSoap11Endpoint", address);
client.ClientCredentials.UserName.UserName = "admin";
client.ClientCredentials.UserName.Password = "123456";

 

























以上是关于WebService 常用的设置的主要内容,如果未能解决你的问题,请参考以下文章

常用免费的WebService列表

WebService入门实例教程

java调用第三方的webservice应用实例

WebService 常用的设置

WebServic调用天气预报服务

如何在调用WebService方法时,传递对象数组参数