Thoughts on Systems Integration using Microsoft Technologies

BizTalk WCF Service Consuming Wizard – HTTP 407 Proxy Authentication Required

I got this error recently running the BizTalk WCF Consuming Wizard whilst working at a customers office when I didn’t previously (sensitive parts of the error message have been removed):

BizTalk WCF Service Consuming Wizard HTTP 407 Error

BizTalk WCF Service Consuming Wizard HTTP 407 Error

I think it was due to installation of internet security software on my development VM by the company’s infrastructure team and/or a new set of group policies being applied to the domain in which my VM is connected too…

Anyhow, it was obvious that all traffic from my VM was now going through a web proxy for the purposes of filtering traffic and I needed to install proxy client software.  This would entail some internal processes being enacted.

Being impatient to progress (and seeing this as an opportunity to try something out that I had read about a few weeks previously) I decided to see if a I could use SvcUtil.exe, providing my proxy credentials so enabling the SvcUtil.exe to authenticate against the web proxy for me.

It would be great if the BizTalk WCF Service Consuming Wizard had proxy authentication support!  Maybe I’m missing a trick here??

Based on this article here on Stack Overflow, I created a small proxy class, created a strong name key file for it and then installed it in the GAC on my dev VM:

Proxy.cs snippet

Proxy.cs snippet

I then edited my SvcUtil config file as follows, adding a reference to the proxy class assembly:

SvcUtil.exe.config file

SvcUtil.exe.config file

Then using the simple batch script below, I could run SvcUtil with proxy authentication included and hey presto, I could download the WSDL and associated XSD import files!

GetServiceDefinition.bat file

GetServiceDefinition.bat file

This saved me the annoyance of having to download each imported XSD file individually and then modifying the path in the parent WSDL.

I have a GitHub repo here containing the source code for the solution (as usual, provided under the terms of the MIT licence).

Advertisements

4 responses

  1. What using Fiddler as intermediate proxy??

    February 25, 2014 at 10:40 pm

    • Good idea – a great tool! A Forefront TMG client has been installed on my dev VM now so I no longer get the error. However this workaround might help someone else out.

      February 26, 2014 at 7:32 am

  2. This is a creative solution to an age old problem James. Forefront TMG client also makes life a whole lot easier when you’ve got access to that.

    One thing that has worked for me on most .NET apps with proxy problems is to insert the below section into the apps config file (creating one if it didn’t already exist) in the system.net section. In this case it would most likely need to be inserted into your Visual Studio console file since the WCF Service consuming wizard appears to be a Visual Studio addin rather than a standalone wizard.

    For this to work you would need your proxy settings configured in IE, and you’d need to be running Visual Studio as a user that has rights to communicate through the proxy server, so either log on to your VM as a domain user, or run Visual Studio as a domain user if you prefer to logon to your VM using local credentials.

    February 26, 2014 at 11:54 am

    • Thanks Johann – a good suggestion. If I get a chance, I will try this out by disabling my Forefront TMG client and then trying the steps you suggest.

      Yes I have had my fair share of proxy problems too – usually when under pressure to get something done!!

      February 26, 2014 at 4:59 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s