Soap Extensions

  • Thread starter Christopher Padgett
  • Start date
C

Christopher Padgett

Hello Al

I have to invoke a Web service that expects a MIME message that contains a SOAP message. The SOAP message's header contains a security token that accords the WS-Security specification

I am guessing the Web service's client must undertake a couple steps

(1) It must build the SOAP message that contains the security token. I extended the Microsoft.Web.Services.WebServicesClientProtocol class because it offers the output filter that renders the security token

(2) It must build the MIME message that contains the SOAP message. I implemented a derived class of the SoapExtension class, attributed it to the client's method that invokes the service's method, and expected its ProcessMessage method to be invoked after the SOAP message had been serialized. No luck! The ProcessMessage method is invoked before the SOAP message has been serialized

Is it possible to "prioritize" the ProcessMessage method to be invoked after the output filters have been invoked

Should I be attacking my little problem from a different angle

Cheers Chri
 
S

Steven Cheng[MSFT]

Hi ,

Thank you for using Microsoft Newsgroup Service. Regarding on the issue, I
am
finding proper resource to assist you and we will update as soon as posible.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security(This posting is provided "AS IS",
with no warranties, and confers no rights.)
 
M

MSFT

Hi Chris,

Thank you for using MSDN Newsgroup. I am Luke and I am review this issue
currently. Regarding the issue, you want the ProcessMessage function can be
executed after the SOAP message has been serialized. In fact, the
ProcessMessage of a SOAPExtension will be executed four times in a round:

AfterDeserialize
AfterSerialize
BeforeDeserialize
BeforeSerialize

We can determine the current stage from SoapMessage's Stage property:

Public Overrides Sub ProcessMessage(message As SoapMessage)
Select Case message.Stage
Case SoapMessageStage.BeforeSerialize
Case SoapMessageStage.AfterSerialize
' Write the SOAP message out to a file.
WriteOutput(message)
Case SoapMessageStage.BeforeDeserialize
' Write the SOAP messae out to a file.
WriteInput(message)
Case SoapMessageStage.AfterDeserialize
Case Else
Throw New Exception("invalid stage")
End Select
End Sub


For more information about the order of SOAP Extensions Methods Invoked,
may refer to following article:

Altering the SOAP Message Using SOAP Extensions
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/htm
l/cpconAlteringSOAPMessageUsingSOAPExtensions.asp

How ASP.NET Web Services Work
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwebsrv/ht
ml/howwebmeth.asp

Hope this help.

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
C

Christopher Padgett

Luke

Thank you for your reply.

I have implemented the ProcessMessage logic but when I am debugging it
during the AfterSerialize stage, the output stream doesn't contain the
WSE elements (eg, the UserNameToken element). It seems to suggest that
the WSE filters in WSE are applied after the AfterSerialize stage.

This is my problem. If possible, I want to "prioritize" the WSE filters
before the AfterSerialize stage.

Your suggestions are appreciated.

Chris
 
M

MSFT

Hi Chris,

Due to the natrue of WSE, we can't use it before AfterSerialized. If you
want to perform some management on the SOAP message after all WSE filter,
you may create custom Filter (whthin WSE). For more information on this,
you may refer to:

Inside the Web Services Enhancements Pipeline
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwse/html/
insidewsepipe.asp

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,010
Latest member
MerrillEic

Latest Threads

Top