Hello Bill,
Thanks for posting in the group.
Consuming web service when the client is behind a proxy server is a FAQ. We
could refer to MSDN article:
"HOW TO: Configure an XML Web Service Client by Using the .NET Framework to
Work with a Proxy Server"
http://support.microsoft.com/?id=307220
VS.NET uses the Wsdl.exe tool when you add web references. So you can use
Wsdl.exe directly. These are standard solutions to the proxy server issue.
Solution1
--------------
Get the wsdl file locally and add the reference to it.
- In IE on the client machine, type
http://MachineX/Webservice1/Service1.asmx?wsdl
- In IE on the client machine, go to View | Source, copy and save the wsdl
file locally named test.wsdl
- Under the VS.NET command prompt on the client machine, type c:\>wsdl.exe
test.wsdl.
- The Web service proxy source file named service1.cs is generated.
- In VS.NET, right click on the client project, Add, Add Existing Items...
to add service1.cs to the project.
- Code the client to use the web proxy server if it is necessary (see
note2).
- Build the project.
Solution2
--------------
Use the Wsdl.exe tool to specify the proxy and credentials to generate the
proxy code.
- Under the VS.NET command prompt, type: c:\>wsdl.exe
<http://MachineX/Webservice1/Service1.asmx> /proxy:proxyURL
/proxyusername:u sername /proxypassword:p assword /proxydomain:dom ain
- The Web service proxy source file named service1.cs is generated.
- In VS.NET, right click on the client project, Add, Add Existing Items...
to add service1.cs to the project.
- Code the client to use the web proxy server if it is necessary (see
note2).
- Build the project.
Note1:
Run wsdl.exe by itself, you will see a list of usage. Short forms are
'/pu:', '/pp:' and '/pd:'
Note2:
You need code the client to use the web proxy server as follows:
[C#]
MyMath.Math math = new MyMath.Math();
// Set the proxy server to proxyserver, set the port to 80, and specify to
bypass
the proxy server
// for local addresses.
IWebProxy proxyObject = new WebProxy("http://proxyserver:80" , true);
math.Proxy = proxyObject;
// Call the Add XML Web service method.
int total = math.Add(8, 5);
http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfSystemWebS ervicesProtocol sHttpWebClientP rotocolClassPro xyTopic.asp
I tested the above and it works fine on my side. Could you please check it
and post here with the testing results? Also, please posting sample code
slice may also help community to understand the problem well.
Does that answer your question?
Best regards,
Yanhong Huang
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.