2014-10-27 161 views
0

發送SOAP請求WCF我有一個WCF web服務,如果我把它從WPF客戶端應用程序,這是不是在同一臺機器上,也沒有在同一個域中正常工作。客戶端應用程序的的app.config是:從沒有.NET客戶端

<bindings> 
     <basicHttpBinding> 
     <binding name="BasicHttpBinding_IMyService" closeTimeout="00:05:00" 
      openTimeout="00:05:00" receiveTimeout="00:10:00" sendTimeout="00:05:00" 
      allowCookies="false" bypassProxyOnLocal="false" maxBufferPoolSize="1524288000" 
      maxReceivedMessageSize="1524288000" useDefaultWebProxy="true"> 
      <readerQuotas maxDepth="2000" maxStringContentLength="819200" maxArrayLength="163840" maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
      <security mode="TransportWithMessageCredential" /> 
     </binding> 
     </basicHttpBinding> 
    </bindings> 

    <client> 
     <endpoint address="https://my.service.com/MyService.svc" 
     binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMyService" 
     contract="LicenseService.IMyService" name="BasicHttpBinding_IMyService" /> 
    </client> 

調用WCF服務,我與小提琴手 SOAP信封嗅出後,我修改了時間戳,我複製/粘貼在客戶端的內容,實例Chrome郵差,我發送請求到WCF,我收到一個錯誤。在那裏下面是SOAP請求包絡和給定的錯誤,這太籠統了,我無法在任何地方找到一個好的解決方案。我最好的猜測是它與WPF處理安全令牌的方式有關,但我無法找到問題所在。令牌只能使用一次?任何人都可以幫忙?

錯誤消息:

與動作「」不能在接收器進行處理,由於在一個EndpointDispatcher失配ContractFilter該消息。這可能是 ,因爲合同不匹配( 發件人與收件人之間的不匹配操作)或發件人 與收件人之間的綁定/安全不匹配。檢查發送方和接收方是否具有相同的 合同和相同的綁定(包括安全要求,例如 消息,傳輸,無)。

SOAP信封:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> 
    <s:Header> 
    <o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> 
     <u:Timestamp u:Id="_0"> 
     <u:Created>2014-10-24T09:39:11.198Z</u:Created> 
     <u:Expires>2014-10-24T09:44:11.198Z</u:Expires> 
     </u:Timestamp> 
     <o:UsernameToken u:Id="token"> 
     <o:Username>MyUsername</o:Username> 
     <o:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">password</o:Password> 
     </o:UsernameToken> 
    </o:Security> 
    </s:Header> 
    <s:Body> 
    <GetProduct xmlns="http://tempuri.org/"> 
     <productGuid>productGuid</productGuid> 
    </GetProduct> 
    </s:Body> 
</s:Envelope> 

回答

0

WCF服務使用CustomValidation與WS-Security的。客戶端不支持WS-Security,因此無法處理SOAP消息的頭部。在客戶端更多的WS令牌沒有刷新,它已經被WCF服務使用