avlasics
5 years agoOccasional Contributor
WCF WsHttp Binding SOAPUI returns BadContextToken fault
My company has asked me to evaluate SmartBear products to see if we can automate our WCF (SOAP) testing and we have budget to pay for whatever licenses we need for test automation. However, I cannot...
- 5 years ago
I found a workaround - so I wanted to share with anyone else struggling with WCF message security.
We simply created a new endpoint and binding in WCF that uses transport security (https) only. This is for our test environments only - not production - but in WCF it can be done using the web.config file.
1. added new binding in WsHttpBinding section
<wsHttpBinding> ... <binding name="wsHttpBindingTransport" closeTimeout="00:10:00" openTimeout="00:10:00" sendTimeout="00:10:00" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"> <readerQuotas maxArrayLength="2147483647" maxNameTableCharCount="2147483647" maxStringContentLength="2147483647" maxDepth="2147483647" maxBytesPerRead="2147483647"/> <security mode="Transport"> <transport clientCredentialType="None"/> </security> </binding> </wsHttpBinding>
2. Added new endpoint in services section
<services> ... <endpoint address="/test" name="wsHttpBindingTransport" binding="wsHttpBinding" contract="MSC.WebServices.IMSCLinkService" bindingConfiguration="wsHttpBindingTransport"> <identity> <dns value="localhost"/> </identity> </endpoint> ... </services>
So we just need to add /test to the end of our existing URL - https://<url>/service.svc/test
Also, the WS-A "Add default wsa:To" checkbox needs to be checked - which is normal for WCF.
In SOAPUI it shows up as a new interface called wsHttpBindingTransport.