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.

Adding elements to the header of a SoapEnvelope

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
SA - 22 Jul 2004 16:02 GMT
Hi all,

I need to provide the service with a piece of infrastructure information,
namely where to send "events" to during a long-running process.

I can't use ReplyTo because the reply to the Soap message must be sent to
the Address.

I tried adding a new element to the header of my SoapEnvelope like this:

Envelope.Header.AppendChild(SomeXml)

(SomeXml is an XmlDocument,
<EventReceiverUrl>soap.tcp://somehost/someuri</EventReceiverUrl>)

At the time I am doing this, Envelope.Header is Nothing. I try to set this
header after I have added my body object to the envelope. I am going to have
to write a custom input and output filter? Or am I missing something here?

Thanks,

Signature

Sven

Lucien - 27 Jul 2004 17:29 GMT
I don't quite follow the ReplyTo issue. ReplyTo is set by default for
request response in WSE (even if you don't set it). The default value is the
anonymous role as outlined in WS-Addressing.

There are several ways to create headers. One way is to add reference
properties in the destination EPR. Another way is to use the SoapHeader
attribute of ASMX. The other option is the one you suggested. Create one
first:

XmlElement header = message.Context.Envelope.CreateHeader();

> Hi all,
>
[quoted text clipped - 16 lines]
>
> Thanks,
SA - 28 Jul 2004 21:52 GMT
> I don't quite follow the ReplyTo issue. ReplyTo is set by default for
> request response in WSE (even if you don't set it). The default value is the
> anonymous role as outlined in WS-Addressing.

OK, I can't set the ReplyTo value of the SoapEnvelope header myself, because
then the response would be sent to that address. Not what I want. In a
sense, what I want is unrelated messages to be sent to some specified
address, and the response sent to the sender of the request.

> There are several ways to create headers. One way is to add reference
> properties in the destination EPR. Another way is to use the SoapHeader
> attribute of ASMX. The other option is the one you suggested. Create one
> first:

OK, not sure if we are talking about the same side. I am talking
client-side. Also, I don't use an autogenerated proxy. Setting the
SoapHeader attribute of ASMX seems to be done server-side, and would thus
only work if the proxy is autogenerated.

> XmlElement header = message.Context.Envelope.CreateHeader();

OK, this might help... I hadn't seen this function yet.

Thanks.

> > Hi all,
> >
[quoted text clipped - 17 lines]
> >
> > Thanks,
Lucien - 29 Jul 2004 00:42 GMT
To clarify my EPR/header suggestion: If you add an referenceProperty to the
destination on the client, it will get serialized as a header on the request
message. Likewise if you add an ReferenceProperty to the ReplyTo it will get
serialized on the response message (and serialized as a type on the
request).

If you set the ReplyTo yourself to anonymous role the response would be sent
back to the client. If you want to send another message from the service
besides the reply you can add that logic in the service method (and I assume
you want to use a header on the request to indicate the address).

> > I don't quite follow the ReplyTo issue. ReplyTo is set by default for
> > request response in WSE (even if you don't set it). The default value is
[quoted text clipped - 47 lines]
> > >
> > > Thanks,
SA - 29 Jul 2004 22:54 GMT
> If you set the ReplyTo yourself to anonymous role the response would be sent
> back to the client. If you want to send another message from the service
> besides the reply you can add that logic in the service method (and I assume
> you want to use a header on the request to indicate the address).

Yes, and that works great. Simply using CreateHeader was the answer. I am
still familiarizing myself with the object model of WSE 2.0, as you can
tell...

I now have a clean implementation, instead of trying to fit that address
somewhere in the body.

Thanks.

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.