from soap4r-ml
>> > > Ideally, soap4r will offer clearly defined message interceptor API (chain),
>> > > that allows attaching processors of outgoing and incoming messages, instead
>> > > of modifying the core soap4r classes (they way wss4r does it now).
> >
> > Interceptor. Yes. It should be allowed though I don't have any idea
> > about how the API should be for now.
Something like this was my thinking ....
client = SOAP::WSDLDriverFactory....
# assign outgoing interceptors
client.before << proc { |request| logger.debug(request.xml)}
client.before << proc { |request|
# sign the request document;
request.xml = sign(request.xml)
}
# assign incoming interceptors
client.after << proc { |response| logger.debug(response.xml)}
client.after << proc { |response| verify(response.xml) }
# invoke operation will 'call' outgoing interceptors, and when the response
is received the incoming interceptor chain is executed.
client.call_method
The block argument are the request / response context
including the raw xml. The blocks can update the raw message.