WCF を使用して外部 Web サービスに接続しています。外部 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 セキュア チャネルの信頼関係を確立できませんでした。
だから私はサーバー証明書をに設定しようとしました
_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();
}
}
この単純なリクエストは最初は機能していましたが、今ではセキュリティ トークン認証の問題が発生しています。