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>