.net wcf调用java的需要认证的接口
1、wcf直接添加java的webservice地址,这都是常规操作,没必要好说
2、修改config配置文件,添加headers消息头节点,这个需要注意
3、OK直接调用里面的方法即可,全部搞定
1 <system.serviceModel> 2 <bindings> 3 <basicHttpBinding> 4 <binding name="UserServiceImplServiceSoapBinding" /> 5 </basicHttpBinding> 6 </bindings> 7 <client> 8 <endpoint address="http://iamldap.foton.com.cn:9080/IAMService/services/soap/userService" 9 binding="basicHttpBinding" bindingConfiguration="UserServiceImplServiceSoapBinding" 10 contract="wcuser.IuserService" name="UserServiceImplPort"> 11 <headers> 12 <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> 13 <wsse:UsernameToken> 14 <wsse:Username>fotonAppQCTSsys</wsse:Username> 15 <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">QCTSsys</wsse:Password> 16 </wsse:UsernameToken> 17 </wsse:Security> 18 </headers> 19 </endpoint> 20 </client> 21 </system.serviceModel>
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步