There are two ways that I can think of:
1) if the proxy supports setting credentials, set the credentials using
that.
2) You can override the GetWebRequest() method of gthe proxy. Then, on the
WebRequest object that you get, you can set NetworkCredentials.
feroze
=============
[quoted text, click to view] "Markus Brandy" <da_joker@gmx.net> wrote in message
news:b75bcd72.0406280510.5b8ad90b@posting.google.com...
> Hi,
>
> I have to use a Java web service that requires HTTP authentication, so
> I have to send username and password in the HTTP headers.
>
> My C# application has a client implementation that looks like this:
>
> [System.Diagnostics.DebuggerStepThroughAttribute()]
> [System.ComponentModel.DesignerCategoryAttribute("code")]
>
[System.Web.Services.WebServiceBindingAttribute(Name="MyServiceSoapBinding",
> Namespace="http://localhost:8080/services/MyService")]
> public class MyService :
> System.Web.Services.Protocols.SoapHttpClientProtocol {
>
> public MyService() {
> this.Url = "http://localhost:8080/services/MyService";
> }
>
> [System.Web.Services.Protocols.SoapRpcMethodAttribute("",
> RequestNamespace="http://webservices.my",
> ResponseNamespace="http://localhost:8080/services/MyService")]
> public void addUserData(UserData in0) {
> this.Invoke("addUserData", new object[] {
> in0});
> }
>
> public System.IAsyncResult BeginaddUserData(UserData in0,
> System.AsyncCallback callback, object asyncState) {
> return this.BeginInvoke("addUserData", new object[] {
> in0}, callback, asyncState);
> }
>
> public void EndaddUserData(System.IAsyncResult asyncResult) {
> this.EndInvoke(asyncResult);
> }
> };
>
> The client uses the service like this:
>
> MyService myService = new MyService();
> myService.addUserData(userData);
>
> It works fine, if no authentication is required. How can I implement
> the HTTP authentication?
>
> Thanks,
> Markus Brandy