Google Groups Home
Help | Sign in
How to add a unique headerhandler per service call?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
brian doll  
View profile
 More options May 1, 3:06 pm
From: brian doll <brian.d...@gmail.com>
Date: Thu, 1 May 2008 12:06:18 -0700 (PDT)
Local: Thurs, May 1 2008 3:06 pm
Subject: How to add a unique headerhandler per service call?
The Setup:
I'm currently using soap4r 1.5.8, ruby 1.8.6 on both Windows and
Linux, to communicate with web services served by Java (Apache Axis).

Right now, I have service calls working well, with our required custom
header, which includes various bits of information about the
requestor.

The service classes (one per wsdl) extend a base class that sets up
the driver with the appropriate information (endpoint, wsdl, etc.).
Since setting up the driver with a wsdl (local or over http) is
expensive, I'm building the service classes as singletons.

A service call, then, may look like this:
  FooService.instance.getFoo("bar")

As you may have guessed, I'm appending a custom header on the driver
during the creation of the wsdl driver factory.  Since the service
class is a singleton, this is done once, during the initial creation
of the (singleton) object.

The Problem:
The information that makes up our custom header, needs to be distinct
per service request.  Each call to the web service should have its
very own header associated to it.  I have no problem generating a
header with the unique information each time, but I can't figure out
how best to assure that my SOAP request uses my new header each time.

Many of us seem to be setting up the driver once, and reusing it for
successive service calls.  Since the headerhandler is a property of
the driver, it would seem difficult to associate a specific header
with a specific service call.

I thought about opening up  SOAP::WSDLDriverFactory (or my extension
of that class, actually) to allow a caller to "reset" the
headerhandler and add a new one in its place.  The problem with this
is that, again, this is associated with the driver, and not the
service call.  It would be possible then, that two concurrent requests
to the service class would attempt to send messages at the same time,
possibly resulting in the wrong header being associated to a service
call.

So, the short of it being:
Is there any way to associate a new header along with every new
service call to a soap wsdl driver?

Thanks very much for any assistance or thoughts on an approach...
b


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
brian doll  
View profile
 More options May 6, 8:16 pm
From: brian doll <brian.d...@gmail.com>
Date: Tue, 6 May 2008 17:16:22 -0700 (PDT)
Local: Tues, May 6 2008 8:16 pm
Subject: Re: How to add a unique headerhandler per service call?
I suppose it's possible that my use case is not common ;)

If anyone else needs to support unique headers per request (not per
driver), I've written about my (hackish) solution here:
http://emphaticsolutions.com/index.php/2008/05/06/soap-headers-per-re...


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bill Kocik  
View profile
 More options May 23, 11:40 am
From: Bill Kocik <bko...@gmail.com>
Date: Fri, 23 May 2008 08:40:49 -0700 (PDT)
Local: Fri, May 23 2008 11:40 am
Subject: Re: How to add a unique headerhandler per service call?

On May 6, 8:16 pm, brian doll <brian.d...@gmail.com> wrote:

> I suppose it's possible that my use case is not common ;)

It's not that unique - I found this message because I have a need to
do almost exactly the same thing. I'm integrating with Google's
AdSense API, and each call requires that you pass your developer email
address and password, and most requests also require that you pass a
client_id (which is the part that changes with every request).

> If anyone else needs to support unique headers per request (not per
> driver), I've written about my (hackish) solution here:http://emphaticsolutions.com/index.php/2008/05/06/soap-headers-per-re...

Thanks for writing that up. I'm gonna give it a shot myself.

-Bill


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google