ezags-xsd 2.2 → 2.2.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,38 @@
1
+ module Ezags
2
+ module Xsd
3
+ class Middleware
4
+ def initialize(app, options = {})
5
+ @files = Dir[Ezags::Xsd.protocols_root.join('**/**/*.xsd').to_s, Ezags::Xsd.protocols_root.join('*.xsd').to_s]
6
+ #@files.concat Dir[Ezags::Xsd.protocols_root.join('**/**/*.wsdl').to_s, Ezags::Xsd.protocols_root.join('*.wsdl').to_s]
7
+
8
+ @path_cache, @render_cache = {}, {}
9
+ @app = app
10
+ end
11
+
12
+ def call(env)
13
+ if env['PATH_INFO'] =~ /\.xsd$/
14
+ file = find_file(env['PATH_INFO'])
15
+ if file
16
+ [200, {'Content-Type' => 'application/xml; charset=utf-8'}, [rewrite_xsd(file)]]
17
+ else
18
+ [404, {}, []]
19
+ end
20
+ else
21
+ @app.call(env)
22
+ end
23
+ end
24
+
25
+ def find_file(path)
26
+ @path_cache[path] ||= @files.find {|f| f =~ /#{path}$/ }
27
+ end
28
+
29
+ def rewrite_xsd(file)
30
+ @render_cache[file] ||= File.read(file).gsub(/schemaLocation="(.*?)"/) do
31
+ location = $1
32
+ new_location = location.gsub(/(\.\.\/)*/,'')
33
+ %Q{schemaLocation="/#{new_location}"}
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -1,5 +1,5 @@
1
1
  module Ezags
2
2
  module Xsd
3
- VERSION = '2.2'
3
+ VERSION = '2.2.0.1'
4
4
  end
5
5
  end
data/lib/ezags-xsd.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'ezags-xsd/version'
2
+ require 'ezags-xsd/middleware'
2
3
  require 'xml_schema_mapper'
3
4
 
4
5
  Dir[File.expand_path('../../app/mappers', __FILE__) + '/*'].each do |file|
@@ -7,6 +8,14 @@ end
7
8
 
8
9
  module Ezags
9
10
  module Xsd
10
- # Your code goes here...
11
+ def self.protocols_root
12
+ Pathname.new(File.expand_path('../../vendor/ezags-protocols', __FILE__))
13
+ end
14
+
15
+ class Protocols < Rails::Engine
16
+ initializer "ezags.xsd.protocols.add_middleware" do |app|
17
+ app.middleware.use Ezags::Xsd::Middleware
18
+ end
19
+ end
11
20
  end
12
21
  end
@@ -0,0 +1,49 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://ezags.rt.ru/fzags/LocalGetResultsService/" xmlns:t="http://ezags.rt.ru/fzags/GetResultsService/type/local/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="LocalGetResultsServiceService" targetNamespace="http://ezags.rt.ru/fzags/LocalGetResultsService/">
3
+ <types>
4
+ <xsd:schema>
5
+ <xsd:import namespace="http://ezags.rt.ru/type/common/" schemaLocation="../common.xsd"/>
6
+ </xsd:schema>
7
+ <xsd:schema>
8
+ <xsd:import namespace="http://ezags.rt.ru/type/actor/" schemaLocation="../actor.xsd"/>
9
+ </xsd:schema>
10
+ <xsd:schema>
11
+ <xsd:import namespace="http://ezags.rt.ru/type/document/" schemaLocation="../documents.xsd"/>
12
+ </xsd:schema>
13
+ <xsd:schema>
14
+ <xsd:import namespace="http://ezags.rt.ru/type/externaldocuments/" schemaLocation="../externaldocuments.xsd"/>
15
+ </xsd:schema>
16
+ <xsd:schema>
17
+ <xsd:import namespace="http://ezags.rt.ru/fzags/GetResultsService/type/local/" schemaLocation="LocalGetResultsService.xsd"/>
18
+ </xsd:schema>
19
+ </types>
20
+ <message name="GetActRecords">
21
+ <part name="parameters" element="t:getActRecordsRequestObj"/>
22
+ </message>
23
+ <message name="GetActRecordsResponse">
24
+ <part name="parameters" element="t:getActRecordsResponseObj"/>
25
+ </message>
26
+ <portType name="LocalGetResultsService">
27
+ <operation name="getActRecords">
28
+ <input message="tns:GetActRecords"/>
29
+ <output message="tns:GetActRecordsResponse"/>
30
+ </operation>
31
+ </portType>
32
+ <binding name="LocalGetResultsServicePortBinding" type="tns:LocalGetResultsService">
33
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
34
+ <operation name="getActRecords">
35
+ <soap:operation soapAction=""/>
36
+ <input>
37
+ <soap:body use="literal"/>
38
+ </input>
39
+ <output>
40
+ <soap:body use="literal"/>
41
+ </output>
42
+ </operation>
43
+ </binding>
44
+ <service name="LocalGetResultsService">
45
+ <port name="LocalGetResultsServicePort" binding="tns:LocalGetResultsServicePortBinding">
46
+ <soap:address location="REPLACE_WITH_ACTUAL_URL"/>
47
+ </port>
48
+ </service>
49
+ </definitions>
@@ -0,0 +1,32 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <xs:schema xmlns:tns="http://ezags.rt.ru/fzags/GetResultsService/type/local/"
3
+ xmlns:cm="http://ezags.rt.ru/type/common/" xmlns:ac="http://ezags.rt.ru/type/actor/"
4
+ xmlns:doc="http://ezags.rt.ru/type/document/"
5
+ xmlns:exdoc="http://ezags.rt.ru/type/externaldocuments/"
6
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
7
+ targetNamespace="http://ezags.rt.ru/fzags/GetResultsService/type/local/"
8
+ elementFormDefault="qualified" attributeFormDefault="unqualified">
9
+ <xs:import namespace="http://ezags.rt.ru/type/common/" schemaLocation="../common.xsd"/>
10
+ <xs:import namespace="http://ezags.rt.ru/type/document/" schemaLocation="../documents.xsd"/>
11
+ <xs:import namespace="http://ezags.rt.ru/type/externaldocuments/" schemaLocation="../externaldocuments.xsd"/>
12
+ <xs:import namespace="http://ezags.rt.ru/type/actor/" schemaLocation="../actor.xsd"/>
13
+ <xs:complexType name="GetActRecordsRequestObj">
14
+ <xs:sequence minOccurs="1">
15
+ <xs:element name="taskId" type="xs:string" minOccurs="1"/>
16
+ </xs:sequence>
17
+ </xs:complexType>
18
+ <xs:complexType name="GetActRecordsResponseObj">
19
+ <xs:choice minOccurs="1">
20
+ <xs:element name="signedActRecordBirth" type="doc:SignedActRecordBirth" minOccurs="0" maxOccurs="unbounded"/>
21
+ <xs:element name="signedActRecordMarriage" type="doc:SignedActRecordMarriage" minOccurs="0" maxOccurs="unbounded"/>
22
+ <xs:element name="signedActRecordDivorce" type="doc:SignedActRecordDivorce" minOccurs="0" maxOccurs="unbounded"/>
23
+ <xs:element name="signedActRecordAdoption" type="doc:SignedActRecordAdoption" minOccurs="0" maxOccurs="unbounded"/>
24
+ <xs:element name="signedActRecordFiliation" type="doc:SignedActRecordFiliation" minOccurs="0" maxOccurs="unbounded"/>
25
+ <xs:element name="signedActRecordNameChange" type="doc:SignedActRecordNameChange" minOccurs="0" maxOccurs="unbounded"/>
26
+ <xs:element name="signedActRecordDeath" type="doc:SignedActRecordDeath" minOccurs="0" maxOccurs="unbounded"/>
27
+ <xs:element name="faultMessage" type="xs:string" minOccurs="0"/>
28
+ </xs:choice>
29
+ </xs:complexType>
30
+ <xs:element name="getActRecordsRequestObj" type="tns:GetActRecordsRequestObj"/>
31
+ <xs:element name="getActRecordsResponseObj" type="tns:GetActRecordsResponseObj"/>
32
+ </xs:schema>
@@ -0,0 +1,45 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
3
+ xmlns:tns="http://ezags.rt.ru/fzags/GetResultsService/" xmlns:t="http://smev.gosuslugi.ru/rev120315"
4
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="GetResultsService"
5
+ targetNamespace="http://ezags.rt.ru/fzags/GetResultsService/">
6
+ <types>
7
+ <xsd:schema>
8
+ <xsd:import namespace="http://smev.gosuslugi.ru/rev120315" schemaLocation="GetResultsService.xsd"/>
9
+ </xsd:schema>
10
+ </types>
11
+ <message name="GetActRecords">
12
+ <part name="parameters" element="t:getActRecordsRequest"/>
13
+ </message>
14
+ <message name="GetActRecordsResponse">
15
+ <part name="parameters" element="t:getActRecordsResponse"/>
16
+ </message>
17
+
18
+ <portType name="GetResultsService">
19
+ <operation name="GetActRecords">
20
+ <input message="tns:GetActRecords"/>
21
+ <output message="tns:GetActRecordsResponse"/>
22
+ <fault name="requestFault" message="tns:requestFault"/>
23
+ </operation>
24
+ </portType>
25
+ <binding name="GetResultsServiceImplPortBinding" type="tns:GetResultsService">
26
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
27
+ <operation name="GetActRecords">
28
+ <soap:operation soapAction=""/>
29
+ <input>
30
+ <soap:body use="literal"/>
31
+ </input>
32
+ <output>
33
+ <soap:body use="literal"/>
34
+ </output>
35
+ <fault name="requestFault">
36
+ <soap:fault name="requestFault" use="literal"/>
37
+ </fault>
38
+ </operation>
39
+ </binding>
40
+ <service name="GetResultsService">
41
+ <port name="GetResultsServiceImplPort" binding="tns:GetResultsServiceImplPortBinding">
42
+ <soap:address location="http://localhost:8001/GetResultsServiceImpl/GetResultsService"/>
43
+ </port>
44
+ </service>
45
+ </definitions>
@@ -0,0 +1,51 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- edited with XMLSpy v2011 rel. 2 (http://www.altova.com) by TeaM DJiNN (TeaM DJiNN) -->
3
+ <xs:schema xmlns:t="http://ezags.rt.ru/fzags/GetResultsService/type/local/" xmlns:cm="http://ezags.rt.ru/type/common/" xmlns:pgu="http://idecs.atc.ru/privateoffice/ws/changeorderinfo" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:smev="http://smev.gosuslugi.ru/rev120315" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" targetNamespace="http://smev.gosuslugi.ru/rev120315" elementFormDefault="qualified" attributeFormDefault="qualified">
4
+ <xs:import namespace="http://ezags.rt.ru/fzags/GetResultsService/type/local/" schemaLocation="../LocalGetResultsService.xsd"/>
5
+ <xs:import namespace="http://ezags.rt.ru/type/common/" schemaLocation="../../common.xsd"/>
6
+ <xs:import namespace="http://idecs.atc.ru/privateoffice/ws/changeorderinfo" schemaLocation="../../ePGU/order-info.xsd"/>
7
+ <xs:include schemaLocation="../../smev/smev.gosuslugi.ru.rev120315.xsd"/>
8
+ <xs:import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="../../xmldsig-core-schema.xsd"/>
9
+ <xs:complexType name="GetActRecordsRequest">
10
+ <xs:sequence minOccurs="1">
11
+ <xs:element ref="smev:Message"/>
12
+ <xs:element name="MessageData">
13
+ <xs:complexType>
14
+ <xs:sequence minOccurs="1">
15
+ <xs:element name="AppData">
16
+ <xs:complexType>
17
+ <xs:sequence minOccurs="1">
18
+ <xs:element ref="t:getActRecordsRequestObj"/>
19
+ </xs:sequence>
20
+ <xs:attribute name="id" type="xs:string" fixed="AppData"/>
21
+ </xs:complexType>
22
+ </xs:element>
23
+ <xs:element ref="smev:AppDocument" minOccurs="0"/>
24
+ </xs:sequence>
25
+ </xs:complexType>
26
+ </xs:element>
27
+ </xs:sequence>
28
+ </xs:complexType>
29
+ <xs:complexType name="GetActRecordsResponse">
30
+ <xs:sequence minOccurs="1">
31
+ <xs:element ref="smev:Message"/>
32
+ <xs:element name="MessageData">
33
+ <xs:complexType>
34
+ <xs:sequence minOccurs="1">
35
+ <xs:element name="AppData">
36
+ <xs:complexType>
37
+ <xs:sequence minOccurs="1">
38
+ <xs:element ref="t:getActRecordsResponseObj"/>
39
+ </xs:sequence>
40
+ <xs:attribute name="id" type="xs:string" fixed="AppData"/>
41
+ </xs:complexType>
42
+ </xs:element>
43
+ <xs:element ref="smev:AppDocument" minOccurs="0"/>
44
+ </xs:sequence>
45
+ </xs:complexType>
46
+ </xs:element>
47
+ </xs:sequence>
48
+ </xs:complexType>
49
+ <xs:element name="getActRecordsRequest" type="smev:GetActRecordsRequest"/>
50
+ <xs:element name="getActRecordsResponse" type="smev:GetActRecordsResponse"/>
51
+ </xs:schema>
metadata CHANGED
@@ -2,14 +2,14 @@
2
2
  name: ezags-xsd
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: '2.2'
5
+ version: 2.2.0.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Anton Sozontov
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-27 00:00:00.000000000 Z
12
+ date: 2013-03-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  version_requirements: !ruby/object:Gem::Requirement
@@ -416,6 +416,7 @@ files:
416
416
  - bin/ezags-xsd
417
417
  - ezags-xsd.gemspec
418
418
  - lib/ezags-xsd.rb
419
+ - lib/ezags-xsd/middleware.rb
419
420
  - lib/ezags-xsd/version.rb
420
421
  - lib/ezags/xsd.rb
421
422
  - spec/mappers/act_rec_and_cert_birth_requisites_mapper_spec.rb
@@ -825,6 +826,10 @@ files:
825
826
  - vendor/ezags-protocols/pfr/dataService.xsd
826
827
  - vendor/ezags-protocols/pfr/xmldsig.xsd
827
828
  - vendor/ezags-protocols/pfr/xop-include.xsd
829
+ - vendor/ezags-protocols/retro/LocalGetResultsService.wsdl
830
+ - vendor/ezags-protocols/retro/LocalGetResultsService.xsd
831
+ - vendor/ezags-protocols/retro/public/GetResultsService.wsdl
832
+ - vendor/ezags-protocols/retro/public/GetResultsService.xsd
828
833
  - vendor/ezags-protocols/smev/smev.gosuslugi.ru.rev111111.xsd
829
834
  - vendor/ezags-protocols/smev/smev.gosuslugi.ru.rev120315.xsd
830
835
  - vendor/ezags-protocols/smev/xmldsig-core-schema.xsd