肥皂标头Web服务 - UserNameToken

时间:2015-08-18 14:40:55

标签: .net wcf soapheader

我在vs2013上使用了一个需要UserNameToken的web服务。

当我在soapui上尝试请求时,一切都很好。

soapui请求就是这个,

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.kds.kkb.com.tr/">
<soapenv:Header>
      <wsse:Security  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-1">
            <wsse:Username>XXXX</wsse:Username>
            <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">YYYY</wsse:Password>          
         </wsse:UsernameToken>
     </wsse:Security>
   </soapenv:Header>
   <soapenv:Body>
      <ws:bakiyeSorgula>
         <BakiyePaketSorgulaInputBean>
            <kanal>5</kanal>
            <kullaniciAdSoyad></kullaniciAdSoyad>
            <kullaniciTckn></kullaniciTckn>
            <subeBayiAdi></subeBayiAdi>
            <subeBayiKodu></subeBayiKodu>
         </BakiyePaketSorgulaInputBean>
      </ws:bakiyeSorgula>
   </soapenv:Body>
</soapenv:Envelope>

当我尝试请求代码隐藏时,出现问题。

获取这些错误消息。

  

“从另一方收到了一个无担保或不正确安全的故障   派对。请参阅内部FaultException以获取故障代码和详细信息。“

     

“的mustUnderstand   头:[{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}安全]   不明白“

我的代码时钟就是这个,

        var client = new BasvuruIslemleriClient();
        client.ClientCredentials.UserName.UserName = "XXXX";
        client.ClientCredentials.UserName.Password = "YYYY";


        var bakiye = new bakiyePaketSorgulaInputBean()
        {
            kullaniciAdSoyad = "",
            kanal = "5",
            kullaniciTckn = "",
            subeBayiAdi = "",
            subeBayiKodu = "",
        };

        var result = client.bakiyeSorgula(bakiye);

0 个答案:

没有答案