Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / July 2004

Tip: Looking for answers? Try searching our database.

Mustunderstand exception raised but method still called

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
John Harkin - 09 Jul 2004 15:36 GMT
Hi,

Just started investigating with Wse 2.0.
I have a asp.net web servive that is not wse aware.
Put together simple client that called method of it providing
username/password via WSE 2.0.
Client received exception message back
"An unhandled exception of type
'System.Web.Services.Protocols.SoapHeaderException' occurred in
system.web.services.dll

Additional information:
System.Web.Services.Protocols.SoapHeaderException: SOAP header
Security was not understood.
  at System.Web.Services.Protocols.SoapHeaderHandling.EnsureHeadersUnderstood(SoapHeaderCollection
headers)
  at System.Web.Services.Protocols.SoapServerProtocol.WriteReturns(Object[]
returnValues, Stream outputStream)
  at System.Web.Services.Protocols.WebServiceHandler.WriteReturns(Object[]
returnValues)
  at System.Web.Services.Protocols.WebServiceHandler.Invoke()
"

however the web service method was successfully called , i know this
as it adds a row to database table. Is this behaviour to be expected ?
I wouldn't expect this .

One other question is that most sample Wse 2.0 code shows "checks"
being carried out inside the web service method code e.g

[WebMethod]
       [SoapDocumentMethod(ResponseElementName="StockQuotes")]
public StockQuote[] StockQuoteRequest( [XmlArray(IsNullable=true),
XmlArrayItem("Symbol", IsNullable=false)] string[] symbols )
       {
           // Reject any requests which are not valid SOAP requests
           if (RequestSoapContext.Current == null)
               throw new ApplicationException("Only SOAP requests are
permitted.");

           // Check if the soap message contains all the required
message parts
           AppBase.VerifyMessageParts(RequestSoapContext.Current);

If i wanted to for every method ensure the username/password was valid
before entering the method how do i do this with WSE 2.0 ?. It sounds
like something it must support , i just don't see how to achieve it.

All help welcome.

Regards
John
Softwaremaker - 10 Jul 2004 02:15 GMT
Hi John,

Very strange indeed !!!

1) your asmx is not wse-aware so I am assuming you are using the normal
SoapHttpClientProtocol on your client proxy
2) BUT if you sending a usernametoken via WSE, then you should be using the
Microsoft.Web.Services2.WebServicesClientProtocol
3) Point 2 must be correct if you are generating the exception seen below
4) I tried something similar to create a file from my WS
5) Once an client exception was invoked, execution stops >>> No files or
database writes should be created

As for your 2nd question:

I hope i understood your q correctly :)

1) WSE's pipelines and filters authenticates the usernametoken for you
automatically
2) If you are using WSE2.0, and sending a password in PlainText > WSE checks
against your Windows Authentication or SAM
If you are sending a Hashed or NO password, you need to write your own
Custom UsernameTokenManagerClass derived from UsernameTokenManager and
then implement your own AuthenticateToken method (ie. Check against some
dataStore). Then load your custom UsernameTokenManager type into the
Web.cofig file of your service.
3) WSE's filters will take care of the rest for you.

There are ample examples for you in the WSE Documentation.

hth.

Signature

Thank you very much

Warmest Regards,
Softwaremaker
Architect | Evangelist | Consultant

Microsoft Regional Director
http://www.microsoft.com/rd

+++++++++++++++++++++++++++++++++

> Hi,
>
[quoted text clipped - 11 lines]
> Security was not understood.
>    at System.Web.Services.Protocols.SoapHeaderHandling.EnsureHeadersUnderstood(Soa
pHeaderCollection
> headers)
>    at
System.Web.Services.Protocols.SoapServerProtocol.WriteReturns(Object[]
> returnValues, Stream outputStream)
>    at
System.Web.Services.Protocols.WebServiceHandler.WriteReturns(Object[]
> returnValues)
>    at System.Web.Services.Protocols.WebServiceHandler.Invoke()
[quoted text clipped - 29 lines]
> Regards
> John
John Harkin - 13 Jul 2004 10:36 GMT
Hi,
Thanks for the info.
Yep i modified client proxy to inherit from
Microsoft.Web.Services2.WebServicesClientProtocol.
Its defintely writing to database as i have debugged into it.

As i have not updated WS to use WSE , where/what in the plumbing is
doing check for MustUnderstand? It appears to be doing it too late.!

Thanks for answer to 2nd part of my question.

Regards

> Hi John,
>
[quoted text clipped - 84 lines]
> > Regards
> > John
Lucien - 14 Jul 2004 22:29 GMT
This seems to be an issue in ASMX (it will repro without ASMX as well). I'll
check if this is a known bug.

> Hi,
> Thanks for the info.
[quoted text clipped - 56 lines]
> > > Security was not understood.
> > >    at

System.Web.Services.Protocols.SoapHeaderHandling.EnsureHeadersUnderstood(Soa
> > pHeaderCollection
> > > headers)
[quoted text clipped - 36 lines]
> > > Regards
> > > John
John Harkin - 15 Jul 2004 16:51 GMT
Hi,
Have you been able to reproduce the behaviour i have described?
John

> This seems to be an issue in ASMX (it will repro without ASMX as well). I'll
> check if this is a known bug.
[quoted text clipped - 106 lines]
> > > > Regards
> > > > John
Lucien - 15 Jul 2004 17:14 GMT
Yes I have (and found not WSE related). The WSE stack (messaging) works
correctly but the ASMX 1.1 still processes the webmethod. I'm investigating
if this is a known issue.

Lucien

> Hi,
> Have you been able to reproduce the behaviour i have described?
[quoted text clipped - 68 lines]
> > > > > Security was not understood.
> > > > >    at

System.Web.Services.Protocols.SoapHeaderHandling.EnsureHeadersUnderstood(Soa
> > > > pHeaderCollection
> > > > > headers)
[quoted text clipped - 26 lines]
> > > > >             // Check if the soap message contains all the required
> > > > > message parts

AppBase.VerifyMessageParts(RequestSoapContext.Current);

> > > > > If i wanted to for every method ensure the username/password was valid
> > > > > before entering the method how do i do this with WSE 2.0 ?. It sounds
[quoted text clipped - 4 lines]
> > > > > Regards
> > > > > John
John Harkin - 26 Jul 2004 09:09 GMT
Hi,
Sorry to be a pain but any progress in identfiying this as a definite bug.?
Regards
John

> Yes I have (and found not WSE related). The WSE stack (messaging) works
> correctly but the ASMX 1.1 still processes the webmethod. I'm investigating
[quoted text clipped - 135 lines]
> > > > > > Regards
> > > > > > John
Lucien - 28 Jul 2004 17:09 GMT
Sorry for the delay. I confirmed it's a known bug and fixed in next .NET
release.

> Hi,
> Sorry to be a pain but any progress in identfiying this as a definite bug.?
[quoted text clipped - 91 lines]
> > > > > > > Security was not understood.
> > > > > > >    at

System.Web.Services.Protocols.SoapHeaderHandling.EnsureHeadersUnderstood(Soa
> > > > > > pHeaderCollection
> > > > > > > headers)
[quoted text clipped - 17 lines]
> > > > > > >
> > > > > > > [WebMethod]

[SoapDocumentMethod(ResponseElementName="StockQuotes")]
> > > > > > > public StockQuote[] StockQuoteRequest( [XmlArray(IsNullable=true),
> > > > > > > XmlArrayItem("Symbol", IsNullable=false)] string[] symbols )
[quoted text clipped - 22 lines]
> > > > > > > Regards
> > > > > > > John
Softwaremaker - 29 Jul 2004 11:48 GMT
Hi John,

I still cannot replicate that error. Could you tell me the exact environment
on how its done ?

Thank you.

~Softwaremaker

> Sorry for the delay. I confirmed it's a known bug and fixed in next .NET
> release.
[quoted text clipped - 110 lines]
> > > > > > > > Security was not understood.
> > > > > > > >    at

System.Web.Services.Protocols.SoapHeaderHandling.EnsureHeadersUnderstood(Soa
> > > > > > > pHeaderCollection
> > > > > > > > headers)
> > > > > > > >    at

System.Web.Services.Protocols.SoapServerProtocol.WriteReturns(Object[]
> > > > > > > > returnValues, Stream outputStream)
> > > > > > > >    at
> > >  System.Web.Services.Protocols.WebServiceHandler.WriteReturns(Object[]
> > > > > > > > returnValues)
> > > > > > > >    at
System.Web.Services.Protocols.WebServiceHandler.Invoke()
> > > > > > > > "
> > > > > > > >
[quoted text clipped - 43 lines]
> > > > > > > > Regards
> > > > > > > > John
Softwaremaker - 29 Jul 2004 12:11 GMT
Ahh...OK I Got the error and the bug now. Was doing something wrong earlier
:P

Thanks.

~WT

> Hi John,
>
[quoted text clipped - 126 lines]
> > > > > > > > > Security was not understood.
> > > > > > > > >    at

System.Web.Services.Protocols.SoapHeaderHandling.EnsureHeadersUnderstood(Soa
> > > > > > > > pHeaderCollection
> > > > > > > > > headers)
[quoted text clipped - 3 lines]
> > > > > > > > > returnValues, Stream outputStream)
> > > > > > > > >    at

System.Web.Services.Protocols.WebServiceHandler.WriteReturns(Object[]
> > > > > > > > > returnValues)
> > > > > > > > >    at
[quoted text clipped - 47 lines]
> > > > > > > > > Regards
> > > > > > > > > John

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.