Hello,
What is the preferred way to consume .NET webservices in rails? Currently
we have a file in the lib directory handling all this but I would like a
cleaner way to
1 - have the services act more "model" like so we can access data
like
NETApi.get_users()
2 - Allow the rails client to login only once, as logging in each time for
a request can be very slow on a very large wsdl file
Any suggestions? I am using soap4r now and it works fine but I think it
can be tidier. Also logging in to the NET site on startup slows down
launching future rails instances. Some sample below
module NETAPILibrary
require ''soap/wsdlDriver''
require ''soap/header/simplehandler''
require ''uuid''
class AutheticationHeaderHandler < SOAP::Header::SimpleHandler
#The header is named "SecureHeader" in this web service.
@@HEADER_NAME = ''AuthenticationHeader''
def initialize(namespace, companyID, userID)
super(XSD::QName.new(namespace, @@HEADER_NAME))
@user_element = XSD::QName.new(namespace, ''CompanyId'')
@password_element = XSD::QName.new(namespace, ''UserId'')
@companyID, @userID = companyID, userID
end
def on_simple_outbound
{@user_element => @companyID, @password_element => @userID}
end
end
def bt_initialize
$soap = SOAP::WSDLDriverFactory.new($BT_WSDL_URL).create_rpc_driver
$soap.headerhandler <<
AutheticationHeaderHandler.new("http://testapi.com/",
$bt_rootid,$bt_user_id)
end
def bt_getmemberbyemail(email)
res = $soap.GetMemberByEmail(:email => email)
return res.getMemberByEmailResult.iD
end
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---