Re: Inserting a SOAP Header in a client request

From: john deviney (johndeviney_at_discussions.microsoft.com)
Date: 01/13/05


Date: Thu, 13 Jan 2005 10:59:02 -0800

Sorry if my original post was not clear. Let me clarify the options I was
exploring:

Option 1: custom SoapHeader and modify the ws client proxy by hand to
reference the new SoapHeader..

Option 2: custom SoapExtension and modify the stream by hand via
ChainStream().

Option 3: custom Soap Extension and SoapHeader and modify the SoapMessage
via ProcessMessage().

So, it sounds like option 3 is not really an option. Option 2 means working
with a byte stream instead of a Soap API. ChainStream() is the only place we
can modify the message before serialization? I guess I'm still not quite
clear on the distinction between ChainStream() and ProcessMessage().

Given that this is all in the context of a web service request, I shouldn't
have to work at the byte level to add a soap header to a soap message. I
imagine the Stream could somehow be converted to a SoapMessage before adding
the soap header but that would be inefficient given that it will be converted
into a SoapMessage later in the call chain.

WSE is something I will explore but for the time being this is what I am
working with. I need to research Axis 1.1 support of WS-Security and compare
it to .Net.
The server side of this solution already exists and works for a different
client implementation.

Clean insertion of a custom soap header on the client side should be
relatively painless. This is how it's done in Axis (Java):

         // setup authorization header
         SOAPHeaderElement authHeader = new SOAPHeaderElement( "",
"AuthHeader" );
         MessageElement usernameElement = ( MessageElement )
authHeader.addChildElement( "UserName" );
         MessageElement passwordElement = ( MessageElement )
authHeader.addChildElement( "Password" );
         usernameElement.setObjectValue("jdoe");
         passwordElement.setObjectValue("password");
         call.addHeader( authHeader );

John

"Dilip Krishnan" wrote:

> Hello john,
> I dont see the difference in what you call the second option and the
> third option. What you seem to be missing is overriding the chain stream
> and writing to the stream (which I gather you dont wish to do). The problem
> with your code is .. yes you're using the soap object model to add the header
> but you've failed to modify the stream by writing that information back into
> the stream. Also have you considered using WSE? and also are you sure the
> java service is not using WS-Security? If it is, you would need to send standard
> username tokens as opposed to a custom auth header
>
> HTH
> Regards,
> Dilip Krishnan
> MCAD, MCSD.net
> dkrishnan at geniant dot com
> http://www.geniant.com
>



Relevant Pages

  • Re: Inserting a SOAP Header in a client request
    ... Every Soap based ... So all you need to do is write to the chained stream using an xml writer. ... custom SoapHeader and modify the ws client proxy by hand to ... > SoapMessage before adding the soap header but that would be ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: Binary serialization
    ... I told you yesterday that you could do this with custom binary ... DATA members from the class in question the method of writing each ... then written to the stream by the base class. ... Is serialization the answer to the above problem? ...
    (microsoft.public.dotnet.general)
  • Re: Restricting OpenFileDialog operations.
    ... a custom UI wouldn't have been sufficient ... >> requirement is that an OpenFileDialog not be able to modify the directory ... >> the functionality to modify the directory contents. ... >> but you can't make it stink. ...
    (microsoft.public.dotnet.framework)
  • Re: Restricting OpenFileDialog operations.
    ... a custom UI wouldn't have been sufficient ... > requirement is that an OpenFileDialog not be able to modify the directory ... > the functionality to modify the directory contents. ... If any account should be able to modify the directory ...
    (microsoft.public.dotnet.framework)
  • Re: modify the server-side playlist while streaming
    ... model will only change the text of the playlist file and the publishing point ... stream is running) the effect is visible directly, the playlist in the GUI ... i find out that is possible to modify a broadcast serverside-playlist within ...
    (microsoft.public.windowsmedia.sdk)

Loading