Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
soap4r-middleware-192
Advanced tools
This small library provides a Rack Middleware interface to exposing Soap4r server endpoints. This is a lightweight alternative to using ActionWebService for exposing SOAP in a Rails application, as well as allowing SOAP endpoints in any other Rack-based application. It's been tested with Rails 2.3.x, but should work fine in Rails 3 as well.
$ gem install soap4r-middleware
First, get yourself some Soap4r endpoint code. The easiest way to do this is to generate it from a WSDL file. Details are in the Soap4r documentation, or see http://dev.ctor.org/soap4r/wiki/HowtouseWSDL4R , but basically:
$ wsdl2ruby.rb --wsdl /path/to/definiton.wsdl --type server
You'll get some generated files. One of them will be named
like *APIService.rb
, near the bottom will be a class of the same name.
To enable middleware functionality, you want to copy this class'
initialization code into a new class that subclasses Soap4r::Middleware::Base
, and replace the initialize method with a block passed to setup
. For instance:
gem 'soap4r-middleware' # or use Bundler
require 'soap4r-middleware'
class MyAPIMiddleware < Soap4r::Middleware::Base
setup do
self.endpoint = %r{^/url/to/soap/endpoint/}
servant MyAPIPort.new
MyAPIPort::Methods.each do |definitions|
opt = definitions.last
if opt[:request_style] == :document
@router.add_document_operation(servant, *definitions)
else
@router.add_rpc_operation(servant, *definitions)
end
end
self.mapping_registry = UrnMyAPIMappingRegistry::EncodedRegistry
self.literal_mapping_registry = UrnMyAPIMappingRegistry::LiteralRegistry
end
end
Then use this middleware anywhere you'd use a Rack middleware. It
doubles as a Rack application as well, so you can host it directly using
run MyAPIMiddleware.new
in your rackup.ru
file.
I guess I could wrap wsdl2ruby.rb
and make this automatic.
Sometimes you just gotta SOAP. Might as well make it suck as little as possible.
FAQs
Unknown package
We found that soap4r-middleware-192 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.