423,309 Members | 2,193 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 423,309 IT Pros & Developers. It's quick & easy.

Basic Authentication ... solution seems a mystery?

P: n/a
I'm cross posting from mscom.webservices.general as I have received no answer
there:

There has been a number of recent posts requesting how to satisfactorily
enable BASIC authorization at the HTTP level but as yet no fully useful
answer.

I too have been trying to call an apache/axis webservice which desires a
username/password from my C# Client. (ie the equivalent of
_call.setUsername("Myname") name from within a Java client proxy) Try as I
may I cannot get the AUTHORIZATION attribute to be included in the http
header. Some mention has been made of directly inserting the attribute into
the header ... but how does one get hold of the request object to do this?
Using the Credentials object method does not work for me.

Any clues ..?

Nov 21 '05 #1
Share this Question
Share on Google+
13 Replies


P: n/a
I think you just have to create a class that inherits from SoapHeader, then
include the <SoapHeader()> attribute to the method that will use it. I hope
I understood your question correctly.

ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfSystemWebServicesProtocolsSoapHeaderAttribute ClassTopic.htm

ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpguide/html/cpconalteringsoapmessageusingsoapextensions.htm

"Pete" <phayward_delete@delete_bigfoot.com> wrote in message
news:74**********************************@microsof t.com...
I'm cross posting from mscom.webservices.general as I have received no
answer
there:

There has been a number of recent posts requesting how to satisfactorily
enable BASIC authorization at the HTTP level but as yet no fully useful
answer.

I too have been trying to call an apache/axis webservice which desires a
username/password from my C# Client. (ie the equivalent of
_call.setUsername("Myname") name from within a Java client proxy) Try as I
may I cannot get the AUTHORIZATION attribute to be included in the http
header. Some mention has been made of directly inserting the attribute
into
the header ... but how does one get hold of the request object to do this?
Using the Credentials object method does not work for me.

Any clues ..?

Nov 21 '05 #2

P: n/a
Thanks Jared,
However I'm looking for authentication at the http level not at the soap
level.
The SOAP/AXIS server I'm looking to connect my client desires basic
authentication
within the http header.
ie looking to see how to set the AUTHENTICATION attribute within the http
header.
Pete
"Jared" wrote:
I think you just have to create a class that inherits from SoapHeader, then
include the <SoapHeader()> attribute to the method that will use it. I hope
I understood your question correctly.

ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfSystemWebServicesProtocolsSoapHeaderAttribute ClassTopic.htm

ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpguide/html/cpconalteringsoapmessageusingsoapextensions.htm

"Pete" <phayward_delete@delete_bigfoot.com> wrote in message
news:74**********************************@microsof t.com...
I'm cross posting from mscom.webservices.general as I have received no
answer
there:

There has been a number of recent posts requesting how to satisfactorily
enable BASIC authorization at the HTTP level but as yet no fully useful
answer.

I too have been trying to call an apache/axis webservice which desires a
username/password from my C# Client. (ie the equivalent of
_call.setUsername("Myname") name from within a Java client proxy) Try as I
may I cannot get the AUTHORIZATION attribute to be included in the http
header. Some mention has been made of directly inserting the attribute
into
the header ... but how does one get hold of the request object to do this?
Using the Credentials object method does not work for me.

Any clues ..?


Nov 21 '05 #3

P: n/a
Sorry about that.
Try looking into the System.Net.WebHeaderCollection object or the
System.Net namespace in general. The webclient may have the functionality
you are looking for.

"Pete" <phayward_delete@delete_bigfoot.com> wrote in message
news:AC**********************************@microsof t.com...
Thanks Jared,
However I'm looking for authentication at the http level not at the soap
level.
The SOAP/AXIS server I'm looking to connect my client desires basic
authentication
within the http header.
ie looking to see how to set the AUTHENTICATION attribute within the http
header.
Pete
"Jared" wrote:
I think you just have to create a class that inherits from SoapHeader,
then
include the <SoapHeader()> attribute to the method that will use it. I
hope
I understood your question correctly.

ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfSystemWebServicesProtocolsSoapHeaderAttribute ClassTopic.htm

ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpguide/html/cpconalteringsoapmessageusingsoapextensions.htm

"Pete" <phayward_delete@delete_bigfoot.com> wrote in message
news:74**********************************@microsof t.com...
> I'm cross posting from mscom.webservices.general as I have received no
> answer
> there:
>
> There has been a number of recent posts requesting how to
> satisfactorily
> enable BASIC authorization at the HTTP level but as yet no fully useful
> answer.
>
> I too have been trying to call an apache/axis webservice which desires
> a
> username/password from my C# Client. (ie the equivalent of
> _call.setUsername("Myname") name from within a Java client proxy) Try
> as I
> may I cannot get the AUTHORIZATION attribute to be included in the http
> header. Some mention has been made of directly inserting the attribute
> into
> the header ... but how does one get hold of the request object to do
> this?
> Using the Credentials object method does not work for me.
>
> Any clues ..?
>


Nov 21 '05 #4

P: n/a
old
take a look at this link
Pass Current Credentials to an ASP.NET Web Service
http://support.microsoft.com/?kbid=813834
"Jared" <VB***********@email.com> wrote in
news:10*************@corp.supernews.com:
Sorry about that.
Try looking into the System.Net.WebHeaderCollection object or the
System.Net namespace in general. The webclient may have the
functionality you are looking for.

"Pete" <phayward_delete@delete_bigfoot.com> wrote in message
news:AC**********************************@microsof t.com...
Thanks Jared,
However I'm looking for authentication at the http level not at the
soap level.
The SOAP/AXIS server I'm looking to connect my client desires basic
authentication
within the http header.
ie looking to see how to set the AUTHENTICATION attribute within the
http header.
Pete
"Jared" wrote:
I think you just have to create a class that inherits from
SoapHeader, then
include the <SoapHeader()> attribute to the method that will use it.
I hope
I understood your question correctly.

ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfSystem
WebServicesProtocolsSoapHeaderAttributeClassTopic. htm

ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpguide/html/cpconalte
ringsoapmessageusingsoapextensions.htm

"Pete" <phayward_delete@delete_bigfoot.com> wrote in message
news:74**********************************@microsof t.com...
> I'm cross posting from mscom.webservices.general as I have
> received no answer
> there:
>
> There has been a number of recent posts requesting how to
> satisfactorily
> enable BASIC authorization at the HTTP level but as yet no fully
> useful answer.
>
> I too have been trying to call an apache/axis webservice which
> desires a
> username/password from my C# Client. (ie the equivalent of
> _call.setUsername("Myname") name from within a Java client proxy)
> Try as I
> may I cannot get the AUTHORIZATION attribute to be included in the
> http header. Some mention has been made of directly inserting the
> attribute into
> the header ... but how does one get hold of the request object to
> do this?
> Using the Credentials object method does not work for me.
>
> Any clues ..?
>


Nov 21 '05 #5

P: n/a
Thanks ... however I am aware of this, but the Credentials technique
(discussed int the link you kindly prvided) passes the credentails at the
SOAP Header level not the HTTP header level which in my case is desired for
the APache/AXIS server.
In the meantime I am looking at the info that Jared supplied.
PS I'm not using a web client, rather a windows forms client.
Pete

"old" wrote:
take a look at this link
Pass Current Credentials to an ASP.NET Web Service
http://support.microsoft.com/?kbid=813834
"Jared" <VB***********@email.com> wrote in
news:10*************@corp.supernews.com:
Sorry about that.
Try looking into the System.Net.WebHeaderCollection object or the
System.Net namespace in general. The webclient may have the
functionality you are looking for.

"Pete" <phayward_delete@delete_bigfoot.com> wrote in message
news:AC**********************************@microsof t.com...
Thanks Jared,
However I'm looking for authentication at the http level not at the
soap level.
The SOAP/AXIS server I'm looking to connect my client desires basic
authentication
within the http header.
ie looking to see how to set the AUTHENTICATION attribute within the
http header.
Pete
"Jared" wrote:

I think you just have to create a class that inherits from
SoapHeader, then
include the <SoapHeader()> attribute to the method that will use it.
I hope
I understood your question correctly.

ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfSystem
WebServicesProtocolsSoapHeaderAttributeClassTopic. htm

ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpguide/html/cpconalte
ringsoapmessageusingsoapextensions.htm

"Pete" <phayward_delete@delete_bigfoot.com> wrote in message
news:74**********************************@microsof t.com...
> I'm cross posting from mscom.webservices.general as I have
> received no answer
> there:
>
> There has been a number of recent posts requesting how to
> satisfactorily
> enable BASIC authorization at the HTTP level but as yet no fully
> useful answer.
>
> I too have been trying to call an apache/axis webservice which
> desires a
> username/password from my C# Client. (ie the equivalent of
> _call.setUsername("Myname") name from within a Java client proxy)
> Try as I
> may I cannot get the AUTHORIZATION attribute to be included in the
> http header. Some mention has been made of directly inserting the
> attribute into
> the header ... but how does one get hold of the request object to
> do this?
> Using the Credentials object method does not work for me.
>
> Any clues ..?
>



Nov 21 '05 #6

P: n/a
I was referring to the System.Net.WebClient. You can send a post message to
a client with this class, I believe you can modify the headers, it's been a
while since i've used it.

"Pete" <phayward_delete@delete_bigfoot.com> wrote in message
news:C8**********************************@microsof t.com...
Thanks ... however I am aware of this, but the Credentials technique
(discussed int the link you kindly prvided) passes the credentails at the
SOAP Header level not the HTTP header level which in my case is desired
for
the APache/AXIS server.
In the meantime I am looking at the info that Jared supplied.
PS I'm not using a web client, rather a windows forms client.
Pete

"old" wrote:
take a look at this link
Pass Current Credentials to an ASP.NET Web Service
http://support.microsoft.com/?kbid=813834
"Jared" <VB***********@email.com> wrote in
news:10*************@corp.supernews.com:
> Sorry about that.
> Try looking into the System.Net.WebHeaderCollection object or the
> System.Net namespace in general. The webclient may have the
> functionality you are looking for.
>
> "Pete" <phayward_delete@delete_bigfoot.com> wrote in message
> news:AC**********************************@microsof t.com...
>> Thanks Jared,
>> However I'm looking for authentication at the http level not at the
>> soap level.
>> The SOAP/AXIS server I'm looking to connect my client desires basic
>> authentication
>> within the http header.
>> ie looking to see how to set the AUTHENTICATION attribute within the
>> http header.
>> Pete
>>
>>
>> "Jared" wrote:
>>
>>> I think you just have to create a class that inherits from
>>> SoapHeader, then
>>> include the <SoapHeader()> attribute to the method that will use it.
>>> I hope
>>> I understood your question correctly.
>>>
>>> ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfSystem
>>> WebServicesProtocolsSoapHeaderAttributeClassTopic. htm
>>>
>>> ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpguide/html/cpconalte
>>> ringsoapmessageusingsoapextensions.htm
>>>
>>> "Pete" <phayward_delete@delete_bigfoot.com> wrote in message
>>> news:74**********************************@microsof t.com...
>>> > I'm cross posting from mscom.webservices.general as I have
>>> > received no answer
>>> > there:
>>> >
>>> > There has been a number of recent posts requesting how to
>>> > satisfactorily
>>> > enable BASIC authorization at the HTTP level but as yet no fully
>>> > useful answer.
>>> >
>>> > I too have been trying to call an apache/axis webservice which
>>> > desires a
>>> > username/password from my C# Client. (ie the equivalent of
>>> > _call.setUsername("Myname") name from within a Java client proxy)
>>> > Try as I
>>> > may I cannot get the AUTHORIZATION attribute to be included in the
>>> > http header. Some mention has been made of directly inserting the
>>> > attribute into
>>> > the header ... but how does one get hold of the request object to
>>> > do this?
>>> > Using the Credentials object method does not work for me.
>>> >
>>> > Any clues ..?
>>> >
>>>
>>>
>>>
>
>


Nov 21 '05 #7

P: n/a
Thanks Jared, however I'm not using a web client, I'm using Windows Forms
client(and I've tried a console client to keep things simple with the same
results). I have only have the web reference. So I think I need to be able
somehow to get the web request object and from there access the Http Request
object and from there be able to set the contents of the http header ???
Anyone any clues or examples on how to do this? It's the same problem as my
orginal question however I'm not getting any closer it seems.

When I use a Java client, it's really easy to set the http AUTHORIZATION
attributes. Not so apparently in .Net. This is so basic I'll bet the answer
is really easy but it has me stumped :)

Pete

"Jared" wrote:
I was referring to the System.Net.WebClient. You can send a post message to
a client with this class, I believe you can modify the headers, it's been a
while since i've used it.

"Pete" <phayward_delete@delete_bigfoot.com> wrote in message
news:C8**********************************@microsof t.com...
Thanks ... however I am aware of this, but the Credentials technique
(discussed int the link you kindly prvided) passes the credentails at the
SOAP Header level not the HTTP header level which in my case is desired
for
the APache/AXIS server.
In the meantime I am looking at the info that Jared supplied.
PS I'm not using a web client, rather a windows forms client.
Pete

"old" wrote:
take a look at this link
Pass Current Credentials to an ASP.NET Web Service
http://support.microsoft.com/?kbid=813834
"Jared" <VB***********@email.com> wrote in
news:10*************@corp.supernews.com:

> Sorry about that.
> Try looking into the System.Net.WebHeaderCollection object or the
> System.Net namespace in general. The webclient may have the
> functionality you are looking for.
>
> "Pete" <phayward_delete@delete_bigfoot.com> wrote in message
> news:AC**********************************@microsof t.com...
>> Thanks Jared,
>> However I'm looking for authentication at the http level not at the
>> soap level.
>> The SOAP/AXIS server I'm looking to connect my client desires basic
>> authentication
>> within the http header.
>> ie looking to see how to set the AUTHENTICATION attribute within the
>> http header.
>> Pete
>>
>>
>> "Jared" wrote:
>>
>>> I think you just have to create a class that inherits from
>>> SoapHeader, then
>>> include the <SoapHeader()> attribute to the method that will use it.
>>> I hope
>>> I understood your question correctly.
>>>
>>> ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfSystem
>>> WebServicesProtocolsSoapHeaderAttributeClassTopic. htm
>>>
>>> ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpguide/html/cpconalte
>>> ringsoapmessageusingsoapextensions.htm
>>>
>>> "Pete" <phayward_delete@delete_bigfoot.com> wrote in message
>>> news:74**********************************@microsof t.com...
>>> > I'm cross posting from mscom.webservices.general as I have
>>> > received no answer
>>> > there:
>>> >
>>> > There has been a number of recent posts requesting how to
>>> > satisfactorily
>>> > enable BASIC authorization at the HTTP level but as yet no fully
>>> > useful answer.
>>> >
>>> > I too have been trying to call an apache/axis webservice which
>>> > desires a
>>> > username/password from my C# Client. (ie the equivalent of
>>> > _call.setUsername("Myname") name from within a Java client proxy)
>>> > Try as I
>>> > may I cannot get the AUTHORIZATION attribute to be included in the
>>> > http header. Some mention has been made of directly inserting the
>>> > attribute into
>>> > the header ... but how does one get hold of the request object to
>>> > do this?
>>> > Using the Credentials object method does not work for me.
>>> >
>>> > Any clues ..?
>>> >
>>>
>>>
>>>
>
>


Nov 21 '05 #8

P: n/a
Pete,
I'm not talking about a browser or a web page, I too am talking about a
..NET WinForms application. Take the following code snippit for example:

Sub PostAMessage()
Dim Site As String = "http://www.yoursite.com"
Dim Web As New System.Net.WebClient
Web.Headers.Add("AUTHORIZATION", "SOMEVALUE")
Dim Stream As System.IO.Stream
Stream = Web.OpenRead(Site)
Dim Reader As New System.IO.StreamReader(Stream)
Dim Output As String = Reader.ReadToEnd()
Stream.Flush()
Stream.Close()
Reader.Close()
End Sub

This code is declared and used inside a windows application. The name of the
object I have been referring to is WebClient. You may want to see if it can
handle what you are trying to do.

Jared

"Pete" <phayward_delete@delete_bigfoot.com> wrote in message
news:53**********************************@microsof t.com...
Thanks Jared, however I'm not using a web client, I'm using Windows Forms
client(and I've tried a console client to keep things simple with the same
results). I have only have the web reference. So I think I need to be able
somehow to get the web request object and from there access the Http
Request
object and from there be able to set the contents of the http header ???
Anyone any clues or examples on how to do this? It's the same problem as
my
orginal question however I'm not getting any closer it seems.

When I use a Java client, it's really easy to set the http AUTHORIZATION
attributes. Not so apparently in .Net. This is so basic I'll bet the
answer
is really easy but it has me stumped :)

Pete

"Jared" wrote:
I was referring to the System.Net.WebClient. You can send a post message
to
a client with this class, I believe you can modify the headers, it's been
a
while since i've used it.

"Pete" <phayward_delete@delete_bigfoot.com> wrote in message
news:C8**********************************@microsof t.com...
> Thanks ... however I am aware of this, but the Credentials technique
> (discussed int the link you kindly prvided) passes the credentails at
> the
> SOAP Header level not the HTTP header level which in my case is desired
> for
> the APache/AXIS server.
> In the meantime I am looking at the info that Jared supplied.
> PS I'm not using a web client, rather a windows forms client.
> Pete
>
> "old" wrote:
>
>> take a look at this link
>> Pass Current Credentials to an ASP.NET Web Service
>> http://support.microsoft.com/?kbid=813834
>>
>>
>> "Jared" <VB***********@email.com> wrote in
>> news:10*************@corp.supernews.com:
>>
>> > Sorry about that.
>> > Try looking into the System.Net.WebHeaderCollection object or
>> > the
>> > System.Net namespace in general. The webclient may have the
>> > functionality you are looking for.
>> >
>> > "Pete" <phayward_delete@delete_bigfoot.com> wrote in message
>> > news:AC**********************************@microsof t.com...
>> >> Thanks Jared,
>> >> However I'm looking for authentication at the http level not at the
>> >> soap level.
>> >> The SOAP/AXIS server I'm looking to connect my client desires basic
>> >> authentication
>> >> within the http header.
>> >> ie looking to see how to set the AUTHENTICATION attribute within
>> >> the
>> >> http header.
>> >> Pete
>> >>
>> >>
>> >> "Jared" wrote:
>> >>
>> >>> I think you just have to create a class that inherits from
>> >>> SoapHeader, then
>> >>> include the <SoapHeader()> attribute to the method that will use
>> >>> it.
>> >>> I hope
>> >>> I understood your question correctly.
>> >>>
>> >>> ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfSystem
>> >>> WebServicesProtocolsSoapHeaderAttributeClassTopic. htm
>> >>>
>> >>> ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpguide/html/cpconalte
>> >>> ringsoapmessageusingsoapextensions.htm
>> >>>
>> >>> "Pete" <phayward_delete@delete_bigfoot.com> wrote in message
>> >>> news:74**********************************@microsof t.com...
>> >>> > I'm cross posting from mscom.webservices.general as I have
>> >>> > received no answer
>> >>> > there:
>> >>> >
>> >>> > There has been a number of recent posts requesting how to
>> >>> > satisfactorily
>> >>> > enable BASIC authorization at the HTTP level but as yet no fully
>> >>> > useful answer.
>> >>> >
>> >>> > I too have been trying to call an apache/axis webservice which
>> >>> > desires a
>> >>> > username/password from my C# Client. (ie the equivalent of
>> >>> > _call.setUsername("Myname") name from within a Java client
>> >>> > proxy)
>> >>> > Try as I
>> >>> > may I cannot get the AUTHORIZATION attribute to be included in
>> >>> > the
>> >>> > http header. Some mention has been made of directly inserting
>> >>> > the
>> >>> > attribute into
>> >>> > the header ... but how does one get hold of the request object
>> >>> > to
>> >>> > do this?
>> >>> > Using the Credentials object method does not work for me.
>> >>> >
>> >>> > Any clues ..?
>> >>> >
>> >>>
>> >>>
>> >>>
>> >
>> >
>>
>>
>>


Nov 21 '05 #9

P: n/a
Pete,
I have exhausted my knowledge of webservices, my experience with them is
solely from the Microsoft platforms, where I can use my trusty soap headers
and ICredentials. It seems as though everyone else has shied away from this
post, I would try to find a group on Apache or try to post in the
microsoft.public.framework.aspnet.webservices groups. Best of luck and when
you find your answer post it so others can benefit.
Jared

"Pete" <phayward_delete@delete_bigfoot.com> wrote in message
news:63**********************************@microsof t.com...
Thanks Jared. You have excellently and precisely laid out the
functionality
of what I'm looking for except that I need it in the context of a "Web
Reference" that I have rather than a newly declared web client (which I
think
means I miss out on the ease of use of a web reference I presume). i.e I
need
to be able to "wind" backwards to the http context from the web reference
which seems to be protocol agnostic (which makes sense as protocols other
than http could potentially be used for the soap message). So I suppose a
better way to phrase the question is "How may I obtain the http context
from
a web reference?"
I could, I suppose construct the web service call "by hand" ignoring the
ease of use of Visual Studio inserting a web reference for me. But this
seems
such a pity as it would mean considerably more work (I think).

Still, I'll look further into what you have suggested ...:)

Thanks again.

Pete

"Jared" wrote:
Pete,
I'm not talking about a browser or a web page, I too am talking about
a
..NET WinForms application. Take the following code snippit for example:

Sub PostAMessage()
Dim Site As String = "http://www.yoursite.com"
Dim Web As New System.Net.WebClient
Web.Headers.Add("AUTHORIZATION", "SOMEVALUE")
Dim Stream As System.IO.Stream
Stream = Web.OpenRead(Site)
Dim Reader As New System.IO.StreamReader(Stream)
Dim Output As String = Reader.ReadToEnd()
Stream.Flush()
Stream.Close()
Reader.Close()
End Sub

This code is declared and used inside a windows application. The name of
the
object I have been referring to is WebClient. You may want to see if it
can
handle what you are trying to do.

Jared

"Pete" <phayward_delete@delete_bigfoot.com> wrote in message
news:53**********************************@microsof t.com...
> Thanks Jared, however I'm not using a web client, I'm using Windows
> Forms
> client(and I've tried a console client to keep things simple with the
> same
> results). I have only have the web reference. So I think I need to be
> able
> somehow to get the web request object and from there access the Http
> Request
> object and from there be able to set the contents of the http header
> ???
> Anyone any clues or examples on how to do this? It's the same problem
> as
> my
> orginal question however I'm not getting any closer it seems.
>
> When I use a Java client, it's really easy to set the http
> AUTHORIZATION
> attributes. Not so apparently in .Net. This is so basic I'll bet the
> answer
> is really easy but it has me stumped :)
>
> Pete
>
> "Jared" wrote:
>
>> I was referring to the System.Net.WebClient. You can send a post
>> message
>> to
>> a client with this class, I believe you can modify the headers, it's
>> been
>> a
>> while since i've used it.
>>
>> "Pete" <phayward_delete@delete_bigfoot.com> wrote in message
>> news:C8**********************************@microsof t.com...
>> > Thanks ... however I am aware of this, but the Credentials technique
>> > (discussed int the link you kindly prvided) passes the credentails
>> > at
>> > the
>> > SOAP Header level not the HTTP header level which in my case is
>> > desired
>> > for
>> > the APache/AXIS server.
>> > In the meantime I am looking at the info that Jared supplied.
>> > PS I'm not using a web client, rather a windows forms client.
>> > Pete
>> >
>> > "old" wrote:
>> >
>> >> take a look at this link
>> >> Pass Current Credentials to an ASP.NET Web Service
>> >> http://support.microsoft.com/?kbid=813834
>> >>
>> >>
>> >> "Jared" <VB***********@email.com> wrote in
>> >> news:10*************@corp.supernews.com:
>> >>
>> >> > Sorry about that.
>> >> > Try looking into the System.Net.WebHeaderCollection object or
>> >> > the
>> >> > System.Net namespace in general. The webclient may have the
>> >> > functionality you are looking for.
>> >> >
>> >> > "Pete" <phayward_delete@delete_bigfoot.com> wrote in message
>> >> > news:AC**********************************@microsof t.com...
>> >> >> Thanks Jared,
>> >> >> However I'm looking for authentication at the http level not at
>> >> >> the
>> >> >> soap level.
>> >> >> The SOAP/AXIS server I'm looking to connect my client desires
>> >> >> basic
>> >> >> authentication
>> >> >> within the http header.
>> >> >> ie looking to see how to set the AUTHENTICATION attribute within
>> >> >> the
>> >> >> http header.
>> >> >> Pete
>> >> >>
>> >> >>
>> >> >> "Jared" wrote:
>> >> >>
>> >> >>> I think you just have to create a class that inherits from
>> >> >>> SoapHeader, then
>> >> >>> include the <SoapHeader()> attribute to the method that will
>> >> >>> use
>> >> >>> it.
>> >> >>> I hope
>> >> >>> I understood your question correctly.
>> >> >>>
>> >> >>> ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfSystem
>> >> >>> WebServicesProtocolsSoapHeaderAttributeClassTopic. htm
>> >> >>>
>> >> >>> ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpguide/html/cpconalte
>> >> >>> ringsoapmessageusingsoapextensions.htm
>> >> >>>
>> >> >>> "Pete" <phayward_delete@delete_bigfoot.com> wrote in message
>> >> >>> news:74**********************************@microsof t.com...
>> >> >>> > I'm cross posting from mscom.webservices.general as I have
>> >> >>> > received no answer
>> >> >>> > there:
>> >> >>> >
>> >> >>> > There has been a number of recent posts requesting how to
>> >> >>> > satisfactorily
>> >> >>> > enable BASIC authorization at the HTTP level but as yet no
>> >> >>> > fully
>> >> >>> > useful answer.
>> >> >>> >
>> >> >>> > I too have been trying to call an apache/axis webservice
>> >> >>> > which
>> >> >>> > desires a
>> >> >>> > username/password from my C# Client. (ie the equivalent of
>> >> >>> > _call.setUsername("Myname") name from within a Java client
>> >> >>> > proxy)
>> >> >>> > Try as I
>> >> >>> > may I cannot get the AUTHORIZATION attribute to be included
>> >> >>> > in
>> >> >>> > the
>> >> >>> > http header. Some mention has been made of directly inserting
>> >> >>> > the
>> >> >>> > attribute into
>> >> >>> > the header ... but how does one get hold of the request
>> >> >>> > object
>> >> >>> > to
>> >> >>> > do this?
>> >> >>> > Using the Credentials object method does not work for me.
>> >> >>> >
>> >> >>> > Any clues ..?
>> >> >>> >
>> >> >>>
>> >> >>>
>> >> >>>
>> >> >
>> >> >
>> >>
>> >>
>> >>
>>
>>
>>


Nov 21 '05 #10

P: n/a
Hi Jared ... bingo ... if one persists long enough. The solution is to
override in the GetResponse in the auto generated proxy class aka:

protected override System.Net.WebRequest GetWebRequest(Uri uri)
{
System.Net.WebRequest request = base.GetWebRequest (uri);

string username = "FFlinstone";
string password = "I_love_Wilma";

string auth = username + ":" + password;
byte[] binaryData = new Byte[auth.Length];
binaryData = Encoding.UTF8.GetBytes(auth);
auth = Convert.ToBase64String(binaryData);
auth = "Basic " + auth;

request.Headers["AUTHORIZATION"] = auth;

return request;
}

then one gets a header that looks like:

<HTTPHeaders>
<user-agent>Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client
Protocol 1.1.4322.2032)</user-agent>
<authorization>Basic RkZsaW5zdG9uZTpJX2xvdmVfV2lsbWE=</authorization>
<content-type>text/xml; charset=utf-8</content-type>
<soapaction>" "</soapaction>
<content-length>930</content-length>
<expect>100-continue</expect>
<connection>Keep-Alive</connection>
<host>localhost:8080</host>
</HTTPHeaders>

Which is exactly what I want :)

Many thanks for your time

"Jared" wrote:
Pete,
I have exhausted my knowledge of webservices, my experience with them is
solely from the Microsoft platforms, where I can use my trusty soap headers
and ICredentials. It seems as though everyone else has shied away from this
post, I would try to find a group on Apache or try to post in the
microsoft.public.framework.aspnet.webservices groups. Best of luck and when
you find your answer post it so others can benefit.
Jared

"Pete" <phayward_delete@delete_bigfoot.com> wrote in message
news:63**********************************@microsof t.com...
Thanks Jared. You have excellently and precisely laid out the
functionality
of what I'm looking for except that I need it in the context of a "Web
Reference" that I have rather than a newly declared web client (which I
think
means I miss out on the ease of use of a web reference I presume). i.e I
need
to be able to "wind" backwards to the http context from the web reference
which seems to be protocol agnostic (which makes sense as protocols other
than http could potentially be used for the soap message). So I suppose a
better way to phrase the question is "How may I obtain the http context
from
a web reference?"
I could, I suppose construct the web service call "by hand" ignoring the
ease of use of Visual Studio inserting a web reference for me. But this
seems
such a pity as it would mean considerably more work (I think).

Still, I'll look further into what you have suggested ...:)

Thanks again.

Pete

"Jared" wrote:
Pete,
I'm not talking about a browser or a web page, I too am talking about
a
..NET WinForms application. Take the following code snippit for example:

Sub PostAMessage()
Dim Site As String = "http://www.yoursite.com"
Dim Web As New System.Net.WebClient
Web.Headers.Add("AUTHORIZATION", "SOMEVALUE")
Dim Stream As System.IO.Stream
Stream = Web.OpenRead(Site)
Dim Reader As New System.IO.StreamReader(Stream)
Dim Output As String = Reader.ReadToEnd()
Stream.Flush()
Stream.Close()
Reader.Close()
End Sub

This code is declared and used inside a windows application. The name of
the
object I have been referring to is WebClient. You may want to see if it
can
handle what you are trying to do.

Jared

"Pete" <phayward_delete@delete_bigfoot.com> wrote in message
news:53**********************************@microsof t.com...
> Thanks Jared, however I'm not using a web client, I'm using Windows
> Forms
> client(and I've tried a console client to keep things simple with the
> same
> results). I have only have the web reference. So I think I need to be
> able
> somehow to get the web request object and from there access the Http
> Request
> object and from there be able to set the contents of the http header
> ???
> Anyone any clues or examples on how to do this? It's the same problem
> as
> my
> orginal question however I'm not getting any closer it seems.
>
> When I use a Java client, it's really easy to set the http
> AUTHORIZATION
> attributes. Not so apparently in .Net. This is so basic I'll bet the
> answer
> is really easy but it has me stumped :)
>
> Pete
>
> "Jared" wrote:
>
>> I was referring to the System.Net.WebClient. You can send a post
>> message
>> to
>> a client with this class, I believe you can modify the headers, it's
>> been
>> a
>> while since i've used it.
>>
>> "Pete" <phayward_delete@delete_bigfoot.com> wrote in message
>> news:C8**********************************@microsof t.com...
>> > Thanks ... however I am aware of this, but the Credentials technique
>> > (discussed int the link you kindly prvided) passes the credentails
>> > at
>> > the
>> > SOAP Header level not the HTTP header level which in my case is
>> > desired
>> > for
>> > the APache/AXIS server.
>> > In the meantime I am looking at the info that Jared supplied.
>> > PS I'm not using a web client, rather a windows forms client.
>> > Pete
>> >
>> > "old" wrote:
>> >
>> >> take a look at this link
>> >> Pass Current Credentials to an ASP.NET Web Service
>> >> http://support.microsoft.com/?kbid=813834
>> >>
>> >>
>> >> "Jared" <VB***********@email.com> wrote in
>> >> news:10*************@corp.supernews.com:
>> >>
>> >> > Sorry about that.
>> >> > Try looking into the System.Net.WebHeaderCollection object or
>> >> > the
>> >> > System.Net namespace in general. The webclient may have the
>> >> > functionality you are looking for.
>> >> >
>> >> > "Pete" <phayward_delete@delete_bigfoot.com> wrote in message
>> >> > news:AC**********************************@microsof t.com...
>> >> >> Thanks Jared,
>> >> >> However I'm looking for authentication at the http level not at
>> >> >> the
>> >> >> soap level.
>> >> >> The SOAP/AXIS server I'm looking to connect my client desires
>> >> >> basic
>> >> >> authentication
>> >> >> within the http header.
>> >> >> ie looking to see how to set the AUTHENTICATION attribute within
>> >> >> the
>> >> >> http header.
>> >> >> Pete
>> >> >>
>> >> >>
>> >> >> "Jared" wrote:
>> >> >>
>> >> >>> I think you just have to create a class that inherits from
>> >> >>> SoapHeader, then
>> >> >>> include the <SoapHeader()> attribute to the method that will
>> >> >>> use
>> >> >>> it.
>> >> >>> I hope
>> >> >>> I understood your question correctly.
>> >> >>>
>> >> >>> ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfSystem
>> >> >>> WebServicesProtocolsSoapHeaderAttributeClassTopic. htm
>> >> >>>
>> >> >>> ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpguide/html/cpconalte
>> >> >>> ringsoapmessageusingsoapextensions.htm
>> >> >>>
>> >> >>> "Pete" <phayward_delete@delete_bigfoot.com> wrote in message
>> >> >>> news:74**********************************@microsof t.com...
>> >> >>> > I'm cross posting from mscom.webservices.general as I have
>> >> >>> > received no answer
>> >> >>> > there:
>> >> >>> >
>> >> >>> > There has been a number of recent posts requesting how to
>> >> >>> > satisfactorily
>> >> >>> > enable BASIC authorization at the HTTP level but as yet no
>> >> >>> > fully
>> >> >>> > useful answer.
>> >> >>> >
>> >> >>> > I too have been trying to call an apache/axis webservice
>> >> >>> > which
>> >> >>> > desires a
>> >> >>> > username/password from my C# Client. (ie the equivalent of
>> >> >>> > _call.setUsername("Myname") name from within a Java client
>> >> >>> > proxy)
>> >> >>> > Try as I
>> >> >>> > may I cannot get the AUTHORIZATION attribute to be included
>> >> >>> > in
>> >> >>> > the
>> >> >>> > http header. Some mention has been made of directly inserting
>> >> >>> > the
>> >> >>> > attribute into
>> >> >>> > the header ... but how does one get hold of the request
>> >> >>> > object
>> >> >>> > to
>> >> >>> > do this?
>> >> >>> > Using the Credentials object method does not work for me.
>> >> >>> >
>> >> >>> > Any clues ..?
>> >> >>> >
>> >> >>>
>> >> >>>
>> >> >>>
>> >> >
>> >> >
>> >>
>> >>
>> >>
>>
>>
>>


Nov 21 '05 #11

P: n/a
Pete,
Good catch! Thanks for posting the answer, at least for my benefit.
Jared

"Pete" <phayward_delete@delete_bigfoot.com> wrote in message
news:ED**********************************@microsof t.com...
Hi Jared ... bingo ... if one persists long enough. The solution is to
override in the GetResponse in the auto generated proxy class aka:

protected override System.Net.WebRequest GetWebRequest(Uri uri)
{
System.Net.WebRequest request = base.GetWebRequest (uri);

string username = "FFlinstone";
string password = "I_love_Wilma";

string auth = username + ":" + password;
byte[] binaryData = new Byte[auth.Length];
binaryData = Encoding.UTF8.GetBytes(auth);
auth = Convert.ToBase64String(binaryData);
auth = "Basic " + auth;

request.Headers["AUTHORIZATION"] = auth;

return request;
}

then one gets a header that looks like:

<HTTPHeaders>
<user-agent>Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client
Protocol 1.1.4322.2032)</user-agent>
<authorization>Basic RkZsaW5zdG9uZTpJX2xvdmVfV2lsbWE=</authorization>
<content-type>text/xml; charset=utf-8</content-type>
<soapaction>" "</soapaction>
<content-length>930</content-length>
<expect>100-continue</expect>
<connection>Keep-Alive</connection>
<host>localhost:8080</host>
</HTTPHeaders>

Which is exactly what I want :)

Many thanks for your time

"Jared" wrote:
Pete,
I have exhausted my knowledge of webservices, my experience with them
is
solely from the Microsoft platforms, where I can use my trusty soap
headers
and ICredentials. It seems as though everyone else has shied away from
this
post, I would try to find a group on Apache or try to post in the
microsoft.public.framework.aspnet.webservices groups. Best of luck and
when
you find your answer post it so others can benefit.
Jared

"Pete" <phayward_delete@delete_bigfoot.com> wrote in message
news:63**********************************@microsof t.com...
> Thanks Jared. You have excellently and precisely laid out the
> functionality
> of what I'm looking for except that I need it in the context of a "Web
> Reference" that I have rather than a newly declared web client (which I
> think
> means I miss out on the ease of use of a web reference I presume). i.e
> I
> need
> to be able to "wind" backwards to the http context from the web
> reference
> which seems to be protocol agnostic (which makes sense as protocols
> other
> than http could potentially be used for the soap message). So I suppose
> a
> better way to phrase the question is "How may I obtain the http context
> from
> a web reference?"
> I could, I suppose construct the web service call "by hand" ignoring
> the
> ease of use of Visual Studio inserting a web reference for me. But this
> seems
> such a pity as it would mean considerably more work (I think).
>
> Still, I'll look further into what you have suggested ...:)
>
> Thanks again.
>
> Pete
>
> "Jared" wrote:
>
>> Pete,
>> I'm not talking about a browser or a web page, I too am talking
>> about
>> a
>> ..NET WinForms application. Take the following code snippit for
>> example:
>>
>> Sub PostAMessage()
>> Dim Site As String = "http://www.yoursite.com"
>> Dim Web As New System.Net.WebClient
>> Web.Headers.Add("AUTHORIZATION", "SOMEVALUE")
>> Dim Stream As System.IO.Stream
>> Stream = Web.OpenRead(Site)
>> Dim Reader As New System.IO.StreamReader(Stream)
>> Dim Output As String = Reader.ReadToEnd()
>> Stream.Flush()
>> Stream.Close()
>> Reader.Close()
>> End Sub
>>
>> This code is declared and used inside a windows application. The name
>> of
>> the
>> object I have been referring to is WebClient. You may want to see if
>> it
>> can
>> handle what you are trying to do.
>>
>> Jared
>>
>> "Pete" <phayward_delete@delete_bigfoot.com> wrote in message
>> news:53**********************************@microsof t.com...
>> > Thanks Jared, however I'm not using a web client, I'm using Windows
>> > Forms
>> > client(and I've tried a console client to keep things simple with
>> > the
>> > same
>> > results). I have only have the web reference. So I think I need to
>> > be
>> > able
>> > somehow to get the web request object and from there access the Http
>> > Request
>> > object and from there be able to set the contents of the http header
>> > ???
>> > Anyone any clues or examples on how to do this? It's the same
>> > problem
>> > as
>> > my
>> > orginal question however I'm not getting any closer it seems.
>> >
>> > When I use a Java client, it's really easy to set the http
>> > AUTHORIZATION
>> > attributes. Not so apparently in .Net. This is so basic I'll bet the
>> > answer
>> > is really easy but it has me stumped :)
>> >
>> > Pete
>> >
>> > "Jared" wrote:
>> >
>> >> I was referring to the System.Net.WebClient. You can send a post
>> >> message
>> >> to
>> >> a client with this class, I believe you can modify the headers,
>> >> it's
>> >> been
>> >> a
>> >> while since i've used it.
>> >>
>> >> "Pete" <phayward_delete@delete_bigfoot.com> wrote in message
>> >> news:C8**********************************@microsof t.com...
>> >> > Thanks ... however I am aware of this, but the Credentials
>> >> > technique
>> >> > (discussed int the link you kindly prvided) passes the
>> >> > credentails
>> >> > at
>> >> > the
>> >> > SOAP Header level not the HTTP header level which in my case is
>> >> > desired
>> >> > for
>> >> > the APache/AXIS server.
>> >> > In the meantime I am looking at the info that Jared supplied.
>> >> > PS I'm not using a web client, rather a windows forms client.
>> >> > Pete
>> >> >
>> >> > "old" wrote:
>> >> >
>> >> >> take a look at this link
>> >> >> Pass Current Credentials to an ASP.NET Web Service
>> >> >> http://support.microsoft.com/?kbid=813834
>> >> >>
>> >> >>
>> >> >> "Jared" <VB***********@email.com> wrote in
>> >> >> news:10*************@corp.supernews.com:
>> >> >>
>> >> >> > Sorry about that.
>> >> >> > Try looking into the System.Net.WebHeaderCollection object
>> >> >> > or
>> >> >> > the
>> >> >> > System.Net namespace in general. The webclient may have the
>> >> >> > functionality you are looking for.
>> >> >> >
>> >> >> > "Pete" <phayward_delete@delete_bigfoot.com> wrote in message
>> >> >> > news:AC**********************************@microsof t.com...
>> >> >> >> Thanks Jared,
>> >> >> >> However I'm looking for authentication at the http level not
>> >> >> >> at
>> >> >> >> the
>> >> >> >> soap level.
>> >> >> >> The SOAP/AXIS server I'm looking to connect my client desires
>> >> >> >> basic
>> >> >> >> authentication
>> >> >> >> within the http header.
>> >> >> >> ie looking to see how to set the AUTHENTICATION attribute
>> >> >> >> within
>> >> >> >> the
>> >> >> >> http header.
>> >> >> >> Pete
>> >> >> >>
>> >> >> >>
>> >> >> >> "Jared" wrote:
>> >> >> >>
>> >> >> >>> I think you just have to create a class that inherits from
>> >> >> >>> SoapHeader, then
>> >> >> >>> include the <SoapHeader()> attribute to the method that will
>> >> >> >>> use
>> >> >> >>> it.
>> >> >> >>> I hope
>> >> >> >>> I understood your question correctly.
>> >> >> >>>
>> >> >> >>> ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfSystem
>> >> >> >>> WebServicesProtocolsSoapHeaderAttributeClassTopic. htm
>> >> >> >>>
>> >> >> >>> ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpguide/html/cpconalte
>> >> >> >>> ringsoapmessageusingsoapextensions.htm
>> >> >> >>>
>> >> >> >>> "Pete" <phayward_delete@delete_bigfoot.com> wrote in message
>> >> >> >>> news:74**********************************@microsof t.com...
>> >> >> >>> > I'm cross posting from mscom.webservices.general as I have
>> >> >> >>> > received no answer
>> >> >> >>> > there:
>> >> >> >>> >
>> >> >> >>> > There has been a number of recent posts requesting how to
>> >> >> >>> > satisfactorily
>> >> >> >>> > enable BASIC authorization at the HTTP level but as yet no
>> >> >> >>> > fully
>> >> >> >>> > useful answer.
>> >> >> >>> >
>> >> >> >>> > I too have been trying to call an apache/axis webservice
>> >> >> >>> > which
>> >> >> >>> > desires a
>> >> >> >>> > username/password from my C# Client. (ie the equivalent of
>> >> >> >>> > _call.setUsername("Myname") name from within a Java client
>> >> >> >>> > proxy)
>> >> >> >>> > Try as I
>> >> >> >>> > may I cannot get the AUTHORIZATION attribute to be
>> >> >> >>> > included
>> >> >> >>> > in
>> >> >> >>> > the
>> >> >> >>> > http header. Some mention has been made of directly
>> >> >> >>> > inserting
>> >> >> >>> > the
>> >> >> >>> > attribute into
>> >> >> >>> > the header ... but how does one get hold of the request
>> >> >> >>> > object
>> >> >> >>> > to
>> >> >> >>> > do this?
>> >> >> >>> > Using the Credentials object method does not work for me.
>> >> >> >>> >
>> >> >> >>> > Any clues ..?
>> >> >> >>> >
>> >> >> >>>
>> >> >> >>>
>> >> >> >>>
>> >> >> >
>> >> >> >
>> >> >>
>> >> >>
>> >> >>
>> >>
>> >>
>> >>
>>
>>
>>


Nov 21 '05 #12

P: n/a
JLJ
Pete,
you lost me on this one. I am looking at my "auto generated proxy" class
which is the client binding and see no GetWebRequest method to override.

Is the code you list here implemented on the server side or the client side?

I have the exact same problem - I need to set an HTTP header name/value pair
outside of SOAP, but can't seem to get a handle on the HTTP Request context
in order to insert my stuff.

Thanks
-John J.

"Pete" wrote:
>
>
>


Nov 21 '05 #13

P: n/a
JLJ
Never mind - I figured it out. Thanks!

In my case, I am attempting to stuff an http header into the request prior
to it getting sent to the service. It is a SAML Token value.

In my proxy class for the web service method, I override GetWebRequest

public class MyService.MyWebServiceMessageBinding...{
....
protected override System.Net.WebRequest GetWebRequest(Uri uri) {
System.Net.WebRequest request = System.Net.WebRequest.Create(uri);
request.Headers["samltokenheader"]=LoginTest.sc.SAMLToken;
return request;
}
.....
}

it works just great. Too bad it takes so damn long to find out this
information. Thanks for getting me going in the right direction.

"JLJ" wrote:
Pete,
you lost me on this one. I am looking at my "auto generated proxy" class
which is the client binding and see no GetWebRequest method to override.

Is the code you list here implemented on the server side or the client side?

I have the exact same problem - I need to set an HTTP header name/value pair
outside of SOAP, but can't seem to get a handle on the HTTP Request context
in order to insert my stuff.

Thanks
-John J.

"Pete" wrote:
>>
>>
>>

Nov 21 '05 #14

This discussion thread is closed

Replies have been disabled for this discussion.