1

我正在使用 WCF 连接到外部 Web 服务。我无法控制外部网络服务。我正在使用 SOAP UI 来测试连接。该请求直到昨天都运行良好,现在我得到此安全令牌无法验证异常。根据服务 wsdl,请求需要一个用户名,pwd 作为身份验证

为什么我在 Soap UI 上看到此错误。这是服务 URL。https://orserviceb2btest.oracleoutsourcing.com:443/soa-infra/services/default/MMISSOAPRequestReceiver!1.0*soa_d48cf4e0-5e7b-43ad-b430-727180d48841/RouteEDITtransactions_ep

这就是 SOAP UI 请求的样子

<soapenv:Envelope xmlns:cor="http://www.caqh.org/SOAP/WSDL/CORERule2.2.0.xsd" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Header>
      <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
         <wsse:UsernameToken wsu:Id="UsernameToken-25">
            <wsse:Username>SID</wsse:Username>
            <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">PWD</wsse:Password>

         </wsse:UsernameToken>
      </wsse:Security>
   </soapenv:Header>
   <soapenv:Body>
      <cor:COREEnvelopeRealTimeRequest>
         <PayloadType>X12_270_Request_005010X279A1</PayloadType>
         <ProcessingMode>RealTime</ProcessingMode>
         <PayloadID>339408072</PayloadID>
         <TimeStamp>2013-07-13:T23:30:29:45</TimeStamp>
         <SenderID>SID</SenderID>
         <ReceiverID>OUD</ReceiverID>
         <CORERuleVersion>2.2.0</CORERuleVersion>
         <Payload>Input string </Payload>
      </cor:COREEnvelopeRealTimeRequest>
   </soapenv:Body>
</soapenv:Envelope>

对此的回应

<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
   <env:Header/>
   <env:Body>
      <env:Fault xmlns:ns0="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
         <faultcode>ns0:FailedAuthentication</faultcode>
         <faultstring>FailedAuthentication : The security token cannot be authenticated.</faultstring>
         <faultactor/>
      </env:Fault>
   </env:Body>
</env:Envelope>

来自 WCF 客户端的相同请求给出以下错误无法为具有权限“orserviceb2btest.oracleoutsourcing.com”的 SSL/TLS 安全通道建立信任关系。

所以我尝试将 servercertificate 设置为

  _ORclient.ClientCredentials.ServiceCertificate.DefaultCertificate = GetCertificateFromStore(" *.oracleoutsourcing.com");

 private static X509Certificate2 GetCertificateFromStore(string certName)
        {

            // Get the certificate store for the current user.
            X509Store store = new X509Store(StoreLocation.CurrentUser);
            try
            {
                store.Open(OpenFlags.ReadOnly);

                // Place all certificates in an X509Certificate2Collection object.
                X509Certificate2Collection certCollection = store.Certificates;
                X509Certificate2Collection signingCert = certCollection.Find(X509FindType.FindBySubjectName, certName, false);

                if (signingCert.Count == 0)
                    return null;
                // Return the first certificate in the collection, has the right name and is current. 
                return signingCert[0];
            }
            finally
            {
                store.Close();
            }

        }

这个简单的请求最初是有效的,现在我看到了这个安全令牌身份验证问题。

4

0 回答 0