好吧,所以我的任务是基本上自动化我公司内部的一些Web服务请求。由于我知道wsdl位置,因此我创建了一个简单的空白控制台应用程序并添加了指向该wsdl的服务引用。 VS创建了代理类和app.config文件,它随之而来。这是它生成的app.config文件:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<customBinding>
<binding name="TestBinding">
<security authenticationMode="UserNameOverTransport" messageSecurityVersion="WSSecurity11WSTrust13WSSecureConversation13WSSecurityPolicy12">
</security>
<httpTransport/>
</binding>
<binding name="STSBinding">
<security allowInsecureTransport="False"
authenticationMode="UserNameOverTransport"
requireSignatureConfirmation="false"
messageSecurityVersion="WSSecurity11WSTrust13WSSecureConversation13WSSecurityPolicy12">
</security>
<textMessageEncoding messageVersion="Soap12WSAddressing10" />
<httpsTransport/>
</binding>
</customBinding>
<ws2007FederationHttpBinding>
<binding name="WS2007FederationHttpBinding_TestsService">
<security mode="TransportWithMessageCredential">
<message establishSecurityContext="false" issuedKeyType="BearerKey"
issuedTokenType="http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0">
<issuer address="https://sts.abc.com/idp/sts.wst" bindingConfiguration="STSBinding" binding="customBinding"/>
<issuerMetadata address="http://docs.oasis-open.org/ws-sx/ws-trust/200512/ws-trust-1.3.wsdl" />
<tokenRequestParameters>
<trust:SecondaryParameters xmlns:trust="http://docs.oasis-open.org/ws-sx/ws-trust/200512">
<trust:TokenType xmlns:trust="http://docs.oasis-open.org/ws-sx/ws-trust/200512">http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0</trust:TokenType>
<trust:KeyType xmlns:trust="http://docs.oasis-open.org/ws-sx/ws-trust/200512">http://docs.oasis-open.org/ws-sx/ws-trust/200512/Bearer</trust:KeyType>
<trust:Claims Dialect="http://schemas.xmlsoap.org/ws/2005/05/identity"
xmlns:trust="http://docs.oasis-open.org/ws-sx/ws-trust/200512">
<wsid:ClaimType Uri="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name"
Optional="true" xmlns:wsid="http://schemas.xmlsoap.org/ws/2005/05/identity" />
<wsid:ClaimType Uri="http://schemas.microsoft.com/ws/2008/06/identity/claims/role"
Optional="true" xmlns:wsid="http://schemas.xmlsoap.org/ws/2005/05/identity" />
<wsid:ClaimType Uri="http://schemas.xmlsoap.org/claims/AppId"
xmlns:wsid="http://schemas.xmlsoap.org/ws/2005/05/identity" />
<wsid:ClaimType Uri="http://schemas.xmlsoap.org/claims/Environment"
xmlns:wsid="http://schemas.xmlsoap.org/ws/2005/05/identity" />
<wsid:ClaimType Uri="http://schemas.xmlsoap.org/claims/SecondLvlAuthzId"
xmlns:wsid="http://schemas.xmlsoap.org/ws/2005/05/identity" />
</trust:Claims>
<trust:CanonicalizationAlgorithm xmlns:trust="http://docs.oasis-open.org/ws-sx/ws-trust/200512">http://www.w3.org/2001/10/xml-exc-c14n#</trust:CanonicalizationAlgorithm>
<trust:EncryptionAlgorithm xmlns:trust="http://docs.oasis-open.org/ws-sx/ws-trust/200512">http://www.w3.org/2001/04/xmlenc#aes256-cbc</trust:EncryptionAlgorithm>
</trust:SecondaryParameters>
</tokenRequestParameters>
</message>
</security>
</binding>
</ws2007FederationHttpBinding>
</bindings>
<client>
<endpoint address="https://Tests.abc.com/201308/TestsService.svc"
binding="ws2007FederationHttpBinding" bindingConfiguration="WS2007FederationHttpBinding_TestsService"
contract="ServiceReference1.TestsService" name="WS2007FederationHttpBinding_TestsService" />
</client>
</system.serviceModel>
</configuration>
我自己添加了CustomBindings,显然是想尝试使用它。到目前为止,我在错误之后遇到了很多错误,因为我试图像这样使用客户端:
TestServiceClient vClient = new TestServiceClient();
ServiceProcessingDirectivesType vType = new ServiceProcessingDirectivesType();
UserContextType vUserContextType = new UserContextType();
ServiceCallContextType vServiceCallContextType = new ServiceCallContextType();
GetSummaryRequest vRequest = new GetSummaryRequest();
vClient.ClientCredentials.UserName.UserName = "Test";
vClient.ClientCredentials.UserName.UserName = "Pass";
vClient.GetSummary(vType, vUserContextType, ref vServiceCallContextType, vRequest);
我几乎无法控制那里的网络服务。我不确定继续调试问题的最佳方法。我还缺少配置中的东西吗?如果我是,我该怎么知道?
我现在遇到的最新错误是: &#34; {&#34;无法通过AppliesTo确定合作伙伴SP连接:https://dc-balances-acp.fmr.com/201308/BalancesService.svc&#34;}&#34;
答案 0 :(得分:0)
您正在使用联合安全。
错误的含义是找不到要使用的服务提供商。
您的配置中的客户端地址和根据错误调用的服务不匹配。
您的程序似乎没有使用您发布的配置。