2012-02-28 68 views
3

我有一個WCF服務是:您可以使用SoapUI測試證書保護的WCF服務嗎?

  • 使用BasicHttpBinding(如果你能回答WsHttpBinding甚至更​​好!)
  • 使用TransportWithMessageCredential安全
  • 使用,運輸和X.509證書信息安全

我希望能夠使用SoapUI測試此服務。

然而,當我試圖這樣做,似乎超過WCF的消息了SoapUI跡象預計,導致這個錯誤(在應用程序日誌中檢測到啓用ServiceModel審計後):

CryptographicException: Unable to resolve the '#id-100' URI in the signature to compute the digest.

或者,當我使用WsHttpBinding我得到異常:

MessageSecurityException: The message received over Transport security has unsigned 'To' header.

類似的問題已經提出:

這不打我作爲一個 「Java的交談MS WCF」 的問題 - 我有一個Java測試客戶端沒有問題的工作。同樣,我可以使用WCFStorm來測試服務。但是,SoapUI已經成爲事實上的測試標準,特別是對於非Windows用戶。

那麼,有沒有人設法克服這些問題,並使用SoapUI測試證書安全的WCF服務?

感謝

我相信這個問題是無法解決的,根據我自己的測試和250賞金沒有產生一個答案。

的「web.config文件」是動態生成的,但它有效地匹配以下兩種綁定:

<wsHttpBinding> 
    <binding name="WSHttpBinding_ITwoWayAsync" closeTimeout="00:01:00" 
     openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" 
     bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" 
     maxBufferPoolSize="250000" maxReceivedMessageSize="250000" 
     messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" 
     allowCookies="false"> 
     <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 
      maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
     <security mode="TransportWithMessageCredential"> 
     <transport clientCredentialType="Certificate" proxyCredentialType="None" realm="" /> 
     <message clientCredentialType="Certificate" negotiateServiceCredential="false" 
       establishSecurityContext="false" 
      algorithmSuite="Default" /> 
     </security> 
    </binding> 
    </wsHttpBinding> 

<basicHttpBinding> 
    <binding name="BasicHttpBinding_ITwoWayAsync" closeTimeout="00:01:00" 
     openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" 
     bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" 
     maxBufferPoolSize="250000" maxReceivedMessageSize="250000" 
     messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" 
     allowCookies="false"> 
     <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 
      maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
     <security mode="TransportWithMessageCredential"> 
     <transport clientCredentialType="Certificate" proxyCredentialType="None" realm="" /> 
     <message clientCredentialType="Certificate" algorithmSuite="Default" /> 
     </security> 
    </binding> 
    </basicHttpBinding> 
+0

可以請你在web.config文件中分享你的system.servicemodel設置嗎? – Nabheet 2012-03-06 21:29:14

回答

1

這對於SoapUI是不可能的,我不得不使用另一個名爲WCFStorm的工具。

1

我已經能夠使用自定義的WCF綁定和PFX證書文件來做到這一點。我不得不使用自定義綁定,因爲我需要限制對一個證書的訪問 - 這不在此問題的範圍之內。我的證書pfx文件具有公鑰和私鑰。私鑰受密碼保護。我不能以任何其他證書格式獲得此工作。

在了SoapUI,我去文件 - >首選項 - > SSL設置: - >密鑰庫名稱:path_to_PFX_file - >庫密碼:your_private_key_password

這裏是我的網頁。配置設置幾乎與basicHttpBinding幾乎相同:

<customBinding> 
<binding name="MyServiceBindingConfiguration"> 
    <security authenticationMode="UserNameOverTransport" includeTimestamp="false" requireDerivedKeys="false" securityHeaderLayout="Lax" messageProtectionOrder="SignBeforeEncrypt" messageSecurityVersion="WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10"> 
     <localClientSettings maxClockSkew="00:30:00" /> 
     <localServiceSettings maxClockSkew="00:30:00" /> 
     <secureConversationBootstrap /> 
    </security> 
    <textMessageEncoding messageVersion="Soap11"> 
     <readerQuotas maxDepth="32" maxStringContentLength="524288" maxArrayLength="524288" maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
    </textMessageEncoding> 
    <httpsTransport requireClientCertificate="true" /> 
</binding> 
</customBinding> 

希望這會有所幫助。

+1

嗨Nabheet。感謝您的反饋,但這個例子看起來沒有消息安全性(只是傳輸安全性)。即您的郵件不是經過證書籤名的。 – 2012-03-08 01:09:58

+0

有趣...我認爲,因爲有一個messageProtectionOrder =「SignBeforeExcrypt」,它會簽署該消息,然後加密它。我將需要做更多的研究。順便說一句,只是一個隨機的想法 - 也許messageProtectionOrder不同之間的基本/ wsHttpBinding和SoapUI ... – Nabheet 2012-03-08 16:07:11

+0

這個問題似乎是(從鏈接的文章),使用WsHttp時,SoapUI不簽署'到'元素,和使用BasicHttp時簽署太多元素。 – 2012-03-09 05:13:36

1

我有完全相同的問題。我沒有與BasicHttpBinding一起工作,但確實與WsHttpBinding一起工作。我也有錯誤The message received over Transport security has unsigned 'To' header。我創建了一個解決此問題的博客帖子。請閱讀博文Connect SoapUI to WCF service certificate authentication瞭解更多信息。

您必須設置簽名中的部分。默認情況下,SoapUI簽名整個請求,但這不是WCF默認的,所以我們必須設置我們想簽名的部分。因此,添加名稱「To」,名稱空間「http://www.w3.org/2005/08/addressing」(這是我的名稱空間,但檢查您的)並將Encode設置爲「Element」。請檢查您的請求中的WS-A面板。檢查尋址並設置默認的「To」複選框。