How to call a Web Service using username and password as credentials

Normally when connecting to a web service requiring username/password credentials the channel should be encrypted. BizTalk requires the channel to use HTTPS as the protocol when using BasicHttp bindings. As this was an internal web service the channel did not required any encryption.

These are the steps required to use username authentication without requiring a SSL transport.

1. Create a Custom WCF solicit-response send port as shown.

image

2. Click the Configure button and ensure the Binding Type is set to customBinding. Also check that the Binding section only contains textMessageEncoding and httpTransport as shown.

image

3. Click on textMessageEncoding and ensure you have selected the correct messageVersion. As my endpoint is an asmx web service I have chosen Soap12 as the message version.

image

4. Set the authentication scheme to match your web service by clicking on the httpTransport binding. The web service I was using required Ntlm. If you chose the incorrect authentication schema, an error will be generated in the event log when calling the web service.

Below is a screenshot of the settings for my service. Note the maxBufferSize, maxBufferPoolSize and maxReceivedMessageSize properties will need to match the web service settings also.

image

5. The username and password are then entered into the Credentials tab as shown below.

image

 

Enjoy…