2011-07-06 110 views
12

我想配置我的WCF(.NET 4.0)服務,以便它可以使用soapUI進行測試。我正在使用wsHttpBinding和消息安全性。我的目標是在公共測試端點上公開該服務,並嘗試使用使用soapUI測試的loadUI對其進行加載測試。爲此,端點需要安全,並且由於我的生產端點將使用消息安全性,我認爲我的測試人員也應該使用它來實現接近生產負載測試結果。soapUI與WCF消息安全

我似乎無法配置soapUI成功調用該服務。我已經嘗試了許多簽名和加密輸入和輸出與客戶端和服務器證書的組合。有沒有人設法實現WCF和soapUI的成功的消息安全配置?

下面是從我的配置exerpts:

綁定:

<wsHttpBinding> 

      <binding name="MessageSecurity"> 
       <security mode="Message"> 
        <message clientCredentialType="Certificate" negotiateServiceCredential="false"/> 
       </security> 
      </binding> 

     </wsHttpBinding> 

行爲

<behaviors> 
     <serviceBehaviors> 
      <behavior name="customBehavior"> 
       <serviceMetadata httpGetEnabled="True"/> 
       <serviceDebug includeExceptionDetailInFaults="True"/> 

       <serviceCredentials> 
        <clientCertificate> 
         <authentication certificateValidationMode="PeerTrust"/> 
        </clientCertificate> 
        <serviceCertificate findValue="MyWebServicesCertificate" x509FindType="FindBySubjectName" storeLocation="LocalMachine" storeName="My"/> 
       </serviceCredentials> 
      </behavior> 
     </serviceBehaviors> 

     <endpointBehaviors> 
      <behavior name="webHttp"> 
       <webHttp/> 
      </behavior> 
     </endpointBehaviors> 

    </behaviors> 
</system.serviceModel> 

服務:

  <service behaviorConfiguration="customBehavior" name="MyService"> 

      <!-- Service Endpoint --> 
      <endpoint name="Production" address="" binding="wsHttpBinding" bindingConfiguration="MessageSecurity" contract="IMyService"> 

       <identity> 
        <dns value="web_services_svr"/> 
       </identity> 
      </endpoint> 




      <host> 
       <baseAddresses> 
        <add baseAddress="http://web_services_svr/MyService.svc" /> 
       </baseAddresses> 
      </host> 

     </service> 
+1

從SOAPUI嘗試連接時發生的錯誤究竟是什麼? – kroonwijk

+0

嘗試從控制檯應用程序調用服務。使用fiddler捕獲請求和響應並進行驗證。 –

回答

0

有一個網絡,那裏是一個Web代理在了SoapUI的問題。假設沒有其他問題,您必須在SoapUI中配置代理設置才能使其工作。

1

將negotiateServiceCredential設置爲false並且還將EstablishSecuritySession設置爲false。

之後這種互操作性是可能的。如果您在合同上添加ProtectionLecel.Sign(例如,不加密),則更容易。

+0

+1:這是一個很好的建議,但它仍然不想工作。將「negotiateServiceCredential」和「establishSecuritySession」設置爲false之後,WCF跟蹤日誌中會出現另一個錯誤 - 「沒有可以接受帶有操作的消息的通道」http://schemas.xmlsoap.org/ws/2005/ 02 /信賴/ RST /問題」「。 – VoodooChild

+0

如果您將兩者都設置爲false,那麼在soapui中也不需要任何類型的安全性 –

0

嘗試使用Firefox插件或捲曲進行調用。如果您可以使用任何工具成功運行調用,請嘗試複製請求並從soapUI運行它。如果通話使用任何其他工具,它應該在soapUI中也能正常工作,除非您撥打soap/tcp電話

1

您可能想檢查幾件事情。

1)設置negotiateServiceCredential = 「假」

<wsHttpBinding> 
    <binding name="wsHttpSecure"> 
     <security mode="Message"> 
     <message clientCredentialType="UserName" negotiateServiceCredential="false"  
        establishSecurityContext="false" algorithmSuite="Default" /> 
     </security> 
    </binding> 
</wsHttpBinding> 

2)另外,還要確保在SOAP UI你對號 「添加默認WSA要」

檢查此鏈接 http://ddkonline.blogspot.com.br/2012/10/wcf-45-host-unreachable-when-calling.html

3 )通過客戶證書檢查以下鏈接

http://www.soapui.org/SOAP-and-WSDL/applying-ws-security.html

我希望有幫助。