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

Only set port_message_ns_id and port_message_type if a port_type_input is found. #12

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/wasabi/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def input_for(operation)
binding_type = at_xpath(operation, "../@type").to_s.split(':').last
port_type_input = at_xpath(operation, "../../wsdl:portType[@name='#{binding_type}']/wsdl:operation[@name='#{operation_name}']/wsdl:input")

port_message_ns_id, port_message_type = port_type_input.attribute("message").to_s.split(':')
port_message_ns_id, port_message_type = port_type_input.attribute("message").to_s.split(':') if port_type_input

message_ns_id, message_type = nil

Expand Down
54 changes: 54 additions & 0 deletions spec/fixtures/no_port_type.wsdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<definitions
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:article="http://example.com/article"
xmlns:actions="http://example.com/actions"
targetNamespace="http://example.com/actions">
<types>
<s:schema elementFormDefault="qualified" targetNamespace="http://example.com/actions">
<s:element name="Save">
<s:complexType>
<s:sequence>
<s:element name="article" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="Get">
<s:complexType>
<s:sequence>
<s:element name="articleId" type="s:long"/>
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</types>
<message name="SaveSoapIn">
<part name="parameters" element="actions:Save"/>
</message>
<message name="SaveSoapOut">
<part name="parameters" element="actions:SaveResponse"/>
</message>
<binding name="ArticleSoap" type="actions:ArticleSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="Save">
<soap:operation soapAction="http://example.com/actions.Save" style="document"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="StudyMDL">
<port name="StudyMDLSoap" binding="actions:StudyMDLSoap">
<soap:address location="http://example.com:1234/soap"/>
</port>
</service>
</definitions>
11 changes: 11 additions & 0 deletions spec/wasabi/parser/no_port_type_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
require "spec_helper"

describe Wasabi::Parser do
context "with: no_port_type.wsdl" do

subject { Wasabi::Document.new fixture(:no_port_type).read }

its(:operations) { should == { :save => { :action=>"http://example.com/actions.Save", :input => "Save", :namespace_identifier => nil } } }

end
end