Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modifying wash_out to work with EPIC EHR for health data #232

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# WashOut with EPIC WSDL

This is the modified version of wash_out gem. Thanks to 'inossidabile' for building the original one. Please look at the commits to understand the changes need to be made to make this webservice compatible to the way it is expected by EPIC. Your webservices that are built with original wash_out will work with all the wsdlbrowser.com like services out there but will fail with EPIC. Changes have been made here to reflect the strict type and xml checking that happens in EPIC.

# WashOut

WashOut is a gem that greatly simplifies creation of SOAP service providers.
Expand Down Expand Up @@ -153,7 +157,7 @@ inside your interface declarations.

## WSSE Authentication

WashOut provides two mechanism for WSSE Authentication.
WashOut provides two mechanism for WSSE Authentication.

### Static Authentication

Expand Down
10 changes: 10 additions & 0 deletions app/views/wash_out/document/wsdl.builder
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ xml.definitions 'xmlns' => 'http://schemas.xmlsoap.org/wsdl/',
'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema',
'xmlns:soap-enc' => 'http://schemas.xmlsoap.org/soap/encoding/',
'xmlns:wsdl' => 'http://schemas.xmlsoap.org/wsdl/',
'xmlns:wsam' => 'http://www.w3.org/2007/05/addressing/metadata',
'xmlns:wsx' => 'http://schemas.xmlsoap.org/ws/2004/09/mex',
'xmlns:wsap' => 'http://schemas.xmlsoap.org/ws/2004/08/addressing/policy',
'xmlns:msc' => 'http://schemas.microsoft.com/ws/2005/12/wsdl/contract',
'xmlns:wsp' => 'http://schemas.xmlsoap.org/ws/2004/09/policy',
'xmlns:wsu' => 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd',
'xmlns:soap12' => 'http://schemas.xmlsoap.org/wsdl/soap12/',
'xmlns:wsa10' => 'http://www.w3.org/2005/08/addressing',
'xmlns:wsaw' => 'http://www.w3.org/2006/05/addressing/wsdl',
'xmlns:wsa' => 'http://schemas.xmlsoap.org/ws/2004/08/addressing',
'name' => @name,
'targetNamespace' => @namespace do

Expand Down
65 changes: 58 additions & 7 deletions app/views/wash_out/rpc/response.builder
Original file line number Diff line number Diff line change
@@ -1,11 +1,62 @@
# <s:Envelope
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you should leave comments like this

# xmlns:a="http://www.w3.org/2005/08/addressing"
# xmlns:s="http://www.w3.org/2003/05/soap-envelope">
# <s:Header>
# <a:Action s:mustUnderstand="1">urn:epic-com:Edi.WebPortal.2012.Services:LookupPatientIDResponse</a:Action>
# <a:RelatesTo>urn:uuid:cfd0a296-f4e0-4e48-a200-cea056a55a6b</a:RelatesTo>
# </s:Header>
# <s:Body>
# <LookupPatientIDResponse
# xmlns="urn:epic-com:Edi.WebPortal.2012.Services">
# <LookupPatientIDResult>
# <UniqueMatchFound>true</UniqueMatchFound>
# <PatientID> red-briar-atrius </PatientID>
# </LookupPatientIDResult>
# </LookupPatientIDResponse>
# </s:Body>
# </s:Envelope>

# <?xml version="1.0" encoding="utf-8"?>
# <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
# <soap:Body>
# <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
# <s:Header>
# <a:Action s:mustUnderstand="1">urn:epic-com:Edi.WebPortal.2012.Services/IAtriusProxyService/LookupPatientIDResponse</a:Action>
# <a:RelatesTo>urn:uuid:d664dc7a-1784-411c-9aa3-945ad4d43799</a:RelatesTo>
# </s:Header>
# <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
# <LookupPatientIDResponse xmlns="urn:epic-com:Edi.WebPortal.2012.Services">
# <LookupPatientIDResult>
# <UniqueMatchFound>false</UniqueMatchFound>
# <Error>EMPI ID not found.</Error>
# </LookupPatientIDResult>
# </LookupPatientIDResponse>
# </s:Body>
# </s:Envelope>
# </soap:Body>
# </soap:Envelope>

xml.instruct!
xml.tag! "soap:Envelope", "xmlns:soap" => 'http://schemas.xmlsoap.org/soap/envelope/',
"xmlns:xsd" => 'http://www.w3.org/2001/XMLSchema',
"xmlns:xsi" => 'http://www.w3.org/2001/XMLSchema-instance',
"xmlns:tns" => @namespace do
xml.tag! "soap:Envelope",
"xmlns:soap" => "http://www.w3.org/2003/05/soap-envelope",
"xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance" do
xml.tag! "soap:Body" do
xml.tag! "tns:#{@action_spec[:response_tag]}" do
wsdl_data xml, result
xml.tag! "s:Envelope", "xmlns:a" => "http://www.w3.org/2005/08/addressing",
"xmlns:s" => "http://www.w3.org/2003/05/soap-envelope" do
xml.tag! "s:Header" do
xml.tag! "a:Action", "s:mustUnderstand" => "1" do |t|
t.text! "urn:epic-com:Edi.WebPortal.2012.Services:LookupPatientIDResponse"
end
xml.tag! "a:RelatesTo" do |t|
t.text! request_id
end
end

xml.tag! "s:Body" do
xml.tag! "#{@action_spec[:response_tag]}", "xmlns" =>'urn:epic-com:Edi.WebPortal.2012.Services' do
wsdl_data xml, result
end
end
end
end
end
end
20 changes: 15 additions & 5 deletions app/views/wash_out/rpc/wsdl.builder
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ xml.definitions 'xmlns' => 'http://schemas.xmlsoap.org/wsdl/',
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
'xmlns:soap-enc' => 'http://schemas.xmlsoap.org/soap/encoding/',
'xmlns:wsdl' => 'http://schemas.xmlsoap.org/wsdl/',
'xmlns:wsam' => 'http://www.w3.org/2007/05/addressing/metadata',
'xmlns:wsx' => 'http://schemas.xmlsoap.org/ws/2004/09/mex',
'xmlns:wsap' => 'http://schemas.xmlsoap.org/ws/2004/08/addressing/policy',
'xmlns:msc' => 'http://schemas.microsoft.com/ws/2005/12/wsdl/contract',
'xmlns:wsp' => 'http://schemas.xmlsoap.org/ws/2004/09/policy',
'xmlns:wsu' => 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd',
'xmlns:soap12' => 'http://schemas.xmlsoap.org/wsdl/soap12/',
'xmlns:wsa10' => 'http://www.w3.org/2005/08/addressing',
'xmlns:wsaw' => 'http://www.w3.org/2006/05/addressing/wsdl',
'xmlns:wsa' => 'http://schemas.xmlsoap.org/ws/2004/08/addressing',
'name' => @name,
'targetNamespace' => @namespace do
xml.types do
Expand All @@ -19,7 +29,7 @@ xml.definitions 'xmlns' => 'http://schemas.xmlsoap.org/wsdl/',
end
end

xml.portType :name => "#{@name}_port" do
xml.portType :name => "IWebPortal", :type => "tns:IWebPortal" do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is IWebPortal?

@map.each do |operation, formats|
xml.operation :name => operation do
xml.input :message => "tns:#{operation}"
Expand All @@ -28,7 +38,7 @@ xml.definitions 'xmlns' => 'http://schemas.xmlsoap.org/wsdl/',
end
end

xml.binding :name => "#{@name}_binding", :type => "tns:#{@name}_port" do
xml.binding :name => "IWebPortal", :type => "tns:IWebPortal" do
xml.tag! "soap:binding", :style => 'rpc', :transport => 'http://schemas.xmlsoap.org/soap/http'
@map.keys.each do |operation|
xml.operation :name => operation do
Expand All @@ -47,8 +57,8 @@ xml.definitions 'xmlns' => 'http://schemas.xmlsoap.org/wsdl/',
end
end

xml.service :name => "service" do
xml.port :name => "#{@name}_port", :binding => "tns:#{@name}_binding" do
xml.service :name => "WebPortal" do
xml.port :name => "IWebPortal", :binding => "tns:IWebPortal" do
xml.tag! "soap:address", :location => send("#{@name}_action_url")
end
end
Expand All @@ -65,4 +75,4 @@ xml.definitions 'xmlns' => 'http://schemas.xmlsoap.org/wsdl/',
end
end
end
end
end
9 changes: 7 additions & 2 deletions lib/wash_out/dispatcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,15 @@ def _render_soap(result, options)
return result_spec
}

envelope = env['wash_out.soap_data'].values_at(:envelope, :Envelope).compact.first
header = envelope.values_at(:header, :Header).compact.first
action = header.values_at(:action, :Action).compact.first
request_id = header.values_at(:message_id, :MessageID).compact.first

render :template => "wash_out/#{soap_config.wsdl_style}/response",
:layout => false,
:locals => { :result => inject.call(result, @action_spec[:out]) },
:content_type => 'text/xml'
:locals => { :result => inject.call(result, @action_spec[:out]), :request_id => request_id },
:content_type => 'application/soap+xml' #text/xml
end

# This action is a fallback for all undefined SOAP actions.
Expand Down
2 changes: 1 addition & 1 deletion lib/wash_out/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module WashOut
VERSION = "0.9.2"
VERSION = "1.1.1"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why 1.1.1 ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved to 1.0.0 first but then made a few more changes hence internally changed that version to 1.1.1. But can pick a different version based your convention for major minor.

end