Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Howto add automatically a soap header in soap4r?
Henning Panke
6/22/2007 11:05:00 AM
Hi all,
I must access a webservices that expect the SOAP action as a soap
header. I want to add this soap header automatically but I dont know
where to hook in.
My actual solution is to create a header and remove it after consuming.
The code looks like this:
require 'SystemDriver.rb'
require 'soap/header/simplehandler'
# define the action soap header
class ActionHandler < SOAP::Header::SimpleHandler
HeaderName =
XSD::QName.new('
http://schemas.xmlsoap.org/ws/2004/08/addressing/','A...
)
@m_action
def initialize(action)
super(HeaderName)
@m_action = action
end
def on_simple_outbound
@m_action
end
end
# create the connection / interface
endpoint_url = "http://localhost:1500"
obj = Public.new( endpoint_url )
# enable debug output
obj.wiredump_dev = STDERR if $DEBUG
ns = '
http://mynamespace.com/my...
# getIdentity
# create action soap header
actionHandler = ActionHandler.new( ns + '/getIdentity' )
# add action soap header
obj.headerhandler.add( actionHandler )
# do the request
emptyRequest = nil
puts 'getIdentity: ' + obj.getIdentity(emptyRequest).identityString
puts ''
# remove action soap header for reusing the connection / interface
obj.headerhandler.delete( actionHandler )
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Howto add automatically a soap header in soap4r?
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password