Sending Proxy Server Credentials in .NET
In .NET, a new proxy object can be created to include the authentication credentials required to access the Galileo Web Services via the proxy server. This proxy class is then sent with each call to the Galileo Web Services.
-
Create new proxy classes for each service.
-
In VisualStudio.NET, you can generate a new proxy stub by adding a Web Reference or by using the WSDL.exe tool. The Web Service URL is specified in the constructor for the generated class. Proxies can be point either to the Galileo Web Services test services or production services by modifying the URL in the proxy.
-
Import the proxy class into the Web Services project.
-
For each call to the Galileo Web Services, add references to the URL, port, and authentication parameters for the proxy server. The security and authentication credentials must be explicitly included in each call to a service. The following code provides sample calls to the Galileo Web Services in VB.NET and C#.
VB.NETSample Proxy Server Credentials
The following code provides
a sample of proxy credentials sent with a call to the Galileo Web Services.
See VB.NET Sample Calls for examples of requests with proxy server credentials.
Make the call to the Galileo Web Services. |
Public
Function |
|
Dim
|
Create and set up the credentials
for the Web Service. The namespaces for respective Web Services are User name and password are assigned
by Galileo. |
Dim
|
Dim
Password As String = " |
|
Dim
credentials As |
|
Dim
cc As |
|
|
|
|
|
Set up a |
Dim
|
URL of the proxy server. Confirm that the appropriate port is included. |
|
|
|
The User ID, password, and domain for the proxy server. |
|
|
|
Specify
the Document (root) XML element for the request and filter. This example
uses the A Host Access Profile is required to access Galileo Web Services. |
Dim
|
Return the response data as an XML element. |
Return
|
|
End Function |
Sample C# Proxy Server Credentials
The following code provides
a sample of proxy credentials sent with a call to the Galileo Web Services.
See C# Sample Calls for examples of
including requests with proxy server credentials.
Make the call to the Galileo Web Services. |
public
|
|
{ |
Create and set up the credentials
for the Web Service. The namespaces for respective Web Services are User name and password are assigned
by Galileo. |
|
string UserName = "UserName"; |
|
string Password = "Password"; |
|
NetworkCredential credentials = new NewtworkCredential (UserName, Password); |
|
CredentialCache cc = new CredentialCache(); |
|
cc.Add(new Uri(xws.Url), "Basic", credentials); |
|
xws.Credentials = cc; |
|
Set up a WebProxy to get through the firewall, if necessary. |
WebProxy wp = new WebProxy(); |
URL of the proxy server. Confirm that the appropriate port is included. |
wp.Address = new Uri("http://yourproxy.company.com:80"); |
|
wp.BypassProxyOnLocal = true; |
The User ID, password, and domain for the proxy server. |
wp.Credentials
= new NetworkCredential("userID","password", |
|
xws.Proxy = wp; |
Specify the Document (root) XML element for the request and filter. This example uses the SubmitXML method. A Host Access Profile is required to access the Galileo Web Services. |
XmlElement xmlResponse = xws.SubmitXml("HostAccessProfile", xmlRequest.DocumentElement, xmlFilter.DocumentElement); |
Return the response data as an XML element. |
return xmlResponse; |
|
} |