diff --git a/README.md b/README.md index dd53e3af..0cf27227 100644 --- a/README.md +++ b/README.md @@ -249,7 +249,7 @@ To override the values on a specific controller just add an override as part of Available properties are: * **parser**: XML parser to use – `:rexml` or `:nokogiri`. The first one is default but the latter is much faster. Be sure to add `gem nokogiri` if you want to use it. -* **wsdl_style**: sets WSDL style. Supported values are: 'document' and 'rpc'. +* **wsdl_style**: sets WSDL style. Supported values are: 'rpc', 'document' or 'document_without_tns_prefix'. * **catch_xml_errors**: intercept Rails parsing exceptions to return correct XML response for corrupt XML input. Default is `false`. * **namespace**: SOAP namespace to use. Default is `urn:WashOut`. * **snakecase_input**: Determines if WashOut should modify parameters keys to snakecase. Default is `false`. diff --git a/app/views/wash_out/document_without_tns_prefix/error.builder b/app/views/wash_out/document_without_tns_prefix/error.builder new file mode 100644 index 00000000..529a4cfd --- /dev/null +++ b/app/views/wash_out/document_without_tns_prefix/error.builder @@ -0,0 +1,9 @@ +xml.instruct! +xml.tag! "soap:Envelope", "xmlns:soap" => 'http://schemas.xmlsoap.org/soap/envelope/' do + xml.tag! "soap:Body" do + xml.tag! "soap:Fault" do + xml.faultcode error_code + xml.faultstring error_message + end + end +end diff --git a/app/views/wash_out/document_without_tns_prefix/response.builder b/app/views/wash_out/document_without_tns_prefix/response.builder new file mode 100644 index 00000000..476f173c --- /dev/null +++ b/app/views/wash_out/document_without_tns_prefix/response.builder @@ -0,0 +1,17 @@ +xml.instruct! +xml.tag! "soap:Envelope", + "xmlns:soap" => 'http://schemas.xmlsoap.org/soap/envelope/', + "xmlns:xsd" => 'http://www.w3.org/2001/XMLSchema' do + if !header.nil? + xml.tag! "soap:Header" do + xml.tag! "#{@action_spec[:response_tag]}" do + wsdl_data xml, header + end + end + end + xml.tag! "soap:Body" do + xml.tag! "#{@action_spec[:response_tag]}" do + wsdl_data xml, result + end + end +end diff --git a/app/views/wash_out/document_without_tns_prefix/wsdl.builder b/app/views/wash_out/document_without_tns_prefix/wsdl.builder new file mode 100644 index 00000000..261e986e --- /dev/null +++ b/app/views/wash_out/document_without_tns_prefix/wsdl.builder @@ -0,0 +1,67 @@ +xml.instruct! +xml.definitions 'xmlns' => 'http://schemas.xmlsoap.org/wsdl/', + 'xmlns:soap' => 'http://schemas.xmlsoap.org/wsdl/soap/', + 'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema', + 'xmlns:soap-enc' => 'http://schemas.xmlsoap.org/soap/encoding/', + 'xmlns:wsdl' => 'http://schemas.xmlsoap.org/wsdl/', + 'name' => @name, + 'targetNamespace' => @namespace do + + xml.types do + xml.tag! "schema", :targetNamespace => @namespace, :xmlns => 'http://www.w3.org/2001/XMLSchema' do + defined = [] + @map.each do |operation, formats| + (formats[:in] + formats[:out]).each do |p| + wsdl_type xml, p, defined + end + end + end + end + + @map.each do |operation, formats| + xml.message :name => "#{operation}" do + formats[:in].each do |p| + xml.part wsdl_occurence(p, false, :name => p.name, :type => p.namespaced_type) + end + end + xml.message :name => formats[:response_tag] do + formats[:out].each do |p| + xml.part wsdl_occurence(p, false, :name => p.name, :type => p.namespaced_type) + end + end + end + + xml.portType :name => "#{@name}_port" do + @map.each do |operation, formats| + xml.operation :name => operation do + xml.input :message => "#{operation}" + xml.output :message => "#{formats[:response_tag]}" + end + end + end + + xml.binding :name => "#{@name}_binding", :type => "#{@name}_port" do + xml.tag! "soap:binding", :style => 'document', :transport => 'http://schemas.xmlsoap.org/soap/http' + @map.keys.each do |operation| + xml.operation :name => operation do + xml.tag! "soap:operation", :soapAction => operation + xml.input do + xml.tag! "soap:body", + :use => "literal", + :namespace => @namespace + end + xml.output do + xml.tag! "soap:body", + :use => "literal", + :namespace => @namespace + end + end + end + end + + xml.service :name => @service_name do + xml.port :name => "#{@name}_port", :binding => "#{@name}_binding" do + xml.tag! "soap:address", :location => WashOut::Router.url(request, @name) + end + end +end