Skip to content

Commit

Permalink
quickfix to prevent import recursion
Browse files Browse the repository at this point in the history
  • Loading branch information
rubiii committed Jun 5, 2013
1 parent 2af4d2b commit 007f77d
Show file tree
Hide file tree
Showing 8 changed files with 504 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/savon/importer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ def initialize(resolver, wsdl)
end

def import(location)
@import_locations = []

documents = WSDL::DocumentCollection.new
schemas = XS::SchemaCollection.new

Expand All @@ -38,9 +40,15 @@ def import(location)
private

def import_document(location, &block)
if @import_locations.include? location
@logger.info("Skipping already imported location #{location.inspect}.")
return
end

xml = @resolver.resolve(location)
document = WSDL::Document.new Nokogiri.XML(xml), @wsdl
@import_locations << location

document = WSDL::Document.new Nokogiri.XML(xml), @wsdl
block.call(document)

# resolve wsdl imports
Expand Down
74 changes: 74 additions & 0 deletions spec/fixtures/wsdl/rio2/rio2.wsdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<wsdl:definitions name="SecurityService" targetNamespace="http://www.adactus.co.uk/UISupportServices/ISecurityService/v1.0.0.0" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:tns="http://www.adactus.co.uk/UISupportServices/ISecurityService/v1.0.0.0" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:i0="http://tempuri.org/" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata">
<wsdl:import namespace="http://tempuri.org/" location="http://193.155.1.72/MyCentral-RioII-Services/SecurityService.svc?wsdl=wsdl0"/>
<wsdl:types>
<xsd:schema targetNamespace="http://www.adactus.co.uk/UISupportServices/ISecurityService/v1.0.0.0/Imports">
<xsd:import schemaLocation="http://193.155.1.72/MyCentral-RioII-Services/SecurityService.svc?xsd=xsd0" namespace="http://www.adactus.co.uk/UISupportServices/ISecurityService/v1.0.0.0"/>
<xsd:import schemaLocation="http://193.155.1.72/MyCentral-RioII-Services/SecurityService.svc?xsd=xsd2" namespace="http://www.adactus.co.uk/UISupportServices/ServiceData/v1.0.0.0"/>
<xsd:import schemaLocation="http://193.155.1.72/MyCentral-RioII-Services/SecurityService.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
<xsd:import schemaLocation="http://193.155.1.72/MyCentral-RioII-Services/SecurityService.svc?xsd=xsd3" namespace="http://schemas.datacontract.org/2004/07/Adactus.RICO.UISupportServices.Contract.ServiceData.Enumerations"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="ISecurityService_StartSession_InputMessage">
<wsdl:part name="parameters" element="tns:StartSession"/>
</wsdl:message>
<wsdl:message name="ISecurityService_StartSession_OutputMessage">
<wsdl:part name="parameters" element="tns:StartSessionResponse"/>
</wsdl:message>
<wsdl:message name="ISecurityService_StartSession_ServiceFaultFault_FaultMessage">
<wsdl:part name="detail" element="q1:ServiceFault" xmlns:q1="http://www.adactus.co.uk/UISupportServices/ServiceData/v1.0.0.0"/>
</wsdl:message>
<wsdl:message name="ISecurityService_EndSession_InputMessage">
<wsdl:part name="parameters" element="tns:EndSession"/>
</wsdl:message>
<wsdl:message name="ISecurityService_EndSession_OutputMessage">
<wsdl:part name="parameters" element="tns:EndSessionResponse"/>
</wsdl:message>
<wsdl:message name="ISecurityService_EndSession_ServiceFaultFault_FaultMessage">
<wsdl:part name="detail" element="q2:ServiceFault" xmlns:q2="http://www.adactus.co.uk/UISupportServices/ServiceData/v1.0.0.0"/>
</wsdl:message>
<wsdl:message name="ISecurityService_GetSessionState_InputMessage">
<wsdl:part name="parameters" element="tns:GetSessionState"/>
</wsdl:message>
<wsdl:message name="ISecurityService_GetSessionState_OutputMessage">
<wsdl:part name="parameters" element="tns:GetSessionStateResponse"/>
</wsdl:message>
<wsdl:message name="ISecurityService_GetSessionState_ServiceFaultFault_FaultMessage">
<wsdl:part name="detail" element="q3:ServiceFault" xmlns:q3="http://www.adactus.co.uk/UISupportServices/ServiceData/v1.0.0.0"/>
</wsdl:message>
<wsdl:message name="ISecurityService_GetSessionFromToken_InputMessage">
<wsdl:part name="parameters" element="tns:GetSessionFromToken"/>
</wsdl:message>
<wsdl:message name="ISecurityService_GetSessionFromToken_OutputMessage">
<wsdl:part name="parameters" element="tns:GetSessionFromTokenResponse"/>
</wsdl:message>
<wsdl:message name="ISecurityService_GetSessionFromToken_ServiceFaultFault_FaultMessage">
<wsdl:part name="detail" element="q4:ServiceFault" xmlns:q4="http://www.adactus.co.uk/UISupportServices/ServiceData/v1.0.0.0"/>
</wsdl:message>
<wsdl:portType name="ISecurityService">
<wsdl:operation name="StartSession">
<wsdl:input wsaw:Action="http://www.adactus.co.uk/UISupportServices/ISecurityService/v1.0.0.0/ISecurityService/StartSession" message="tns:ISecurityService_StartSession_InputMessage"/>
<wsdl:output wsaw:Action="http://www.adactus.co.uk/UISupportServices/ISecurityService/v1.0.0.0/ISecurityService/StartSessionResponse" message="tns:ISecurityService_StartSession_OutputMessage"/>
<wsdl:fault wsaw:Action="http://www.adactus.co.uk/UISupportServices/ISecurityService/v1.0.0.0/ISecurityService/StartSessionServiceFaultFault" name="ServiceFaultFault" message="tns:ISecurityService_StartSession_ServiceFaultFault_FaultMessage"/>
</wsdl:operation>
<wsdl:operation name="EndSession">
<wsdl:input wsaw:Action="http://www.adactus.co.uk/UISupportServices/ISecurityService/v1.0.0.0/ISecurityService/EndSession" message="tns:ISecurityService_EndSession_InputMessage"/>
<wsdl:output wsaw:Action="http://www.adactus.co.uk/UISupportServices/ISecurityService/v1.0.0.0/ISecurityService/EndSessionResponse" message="tns:ISecurityService_EndSession_OutputMessage"/>
<wsdl:fault wsaw:Action="http://www.adactus.co.uk/UISupportServices/ISecurityService/v1.0.0.0/ISecurityService/EndSessionServiceFaultFault" name="ServiceFaultFault" message="tns:ISecurityService_EndSession_ServiceFaultFault_FaultMessage"/>
</wsdl:operation>
<wsdl:operation name="GetSessionState">
<wsdl:input wsaw:Action="http://www.adactus.co.uk/UISupportServices/ISecurityService/v1.0.0.0/ISecurityService/GetSessionState" message="tns:ISecurityService_GetSessionState_InputMessage"/>
<wsdl:output wsaw:Action="http://www.adactus.co.uk/UISupportServices/ISecurityService/v1.0.0.0/ISecurityService/GetSessionStateResponse" message="tns:ISecurityService_GetSessionState_OutputMessage"/>
<wsdl:fault wsaw:Action="http://www.adactus.co.uk/UISupportServices/ISecurityService/v1.0.0.0/ISecurityService/GetSessionStateServiceFaultFault" name="ServiceFaultFault" message="tns:ISecurityService_GetSessionState_ServiceFaultFault_FaultMessage"/>
</wsdl:operation>
<wsdl:operation name="GetSessionFromToken">
<wsdl:input wsaw:Action="http://www.adactus.co.uk/UISupportServices/ISecurityService/v1.0.0.0/ISecurityService/GetSessionFromToken" message="tns:ISecurityService_GetSessionFromToken_InputMessage"/>
<wsdl:output wsaw:Action="http://www.adactus.co.uk/UISupportServices/ISecurityService/v1.0.0.0/ISecurityService/GetSessionFromTokenResponse" message="tns:ISecurityService_GetSessionFromToken_OutputMessage"/>
<wsdl:fault wsaw:Action="http://www.adactus.co.uk/UISupportServices/ISecurityService/v1.0.0.0/ISecurityService/GetSessionFromTokenServiceFaultFault" name="ServiceFaultFault" message="tns:ISecurityService_GetSessionFromToken_ServiceFaultFault_FaultMessage"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:service name="SecurityService">
<wsdl:port name="BasicHttpBinding_ISecurityService" binding="i0:BasicHttpBinding_ISecurityService">
<soap:address location="http://193.155.1.72/MyCentral-RioII-Services/SecurityService.svc/soap"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
55 changes: 55 additions & 0 deletions spec/fixtures/wsdl/rio2/rio2_0.wsdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<wsdl:definitions targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:tns="http://tempuri.org/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:i0="http://www.adactus.co.uk/UISupportServices/ISecurityService/v1.0.0.0" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata">
<wsdl:import namespace="http://www.adactus.co.uk/UISupportServices/ISecurityService/v1.0.0.0" location="http://193.155.1.72/MyCentral-RioII-Services/SecurityService.svc?wsdl"/>
<wsdl:types/>
<wsdl:binding name="BasicHttpBinding_ISecurityService" type="i0:ISecurityService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="StartSession">
<soap:operation soapAction="http://www.adactus.co.uk/UISupportServices/ISecurityService/v1.0.0.0/ISecurityService/StartSession" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
<wsdl:fault name="ServiceFaultFault">
<soap:fault name="ServiceFaultFault" use="literal"/>
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="EndSession">
<soap:operation soapAction="http://www.adactus.co.uk/UISupportServices/ISecurityService/v1.0.0.0/ISecurityService/EndSession" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
<wsdl:fault name="ServiceFaultFault">
<soap:fault name="ServiceFaultFault" use="literal"/>
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="GetSessionState">
<soap:operation soapAction="http://www.adactus.co.uk/UISupportServices/ISecurityService/v1.0.0.0/ISecurityService/GetSessionState" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
<wsdl:fault name="ServiceFaultFault">
<soap:fault name="ServiceFaultFault" use="literal"/>
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="GetSessionFromToken">
<soap:operation soapAction="http://www.adactus.co.uk/UISupportServices/ISecurityService/v1.0.0.0/ISecurityService/GetSessionFromToken" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
<wsdl:fault name="ServiceFaultFault">
<soap:fault name="ServiceFaultFault" use="literal"/>
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
</wsdl:definitions>
58 changes: 58 additions & 0 deletions spec/fixtures/wsdl/rio2/rio2_0.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<xs:schema elementFormDefault="qualified" targetNamespace="http://www.adactus.co.uk/UISupportServices/ISecurityService/v1.0.0.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.adactus.co.uk/UISupportServices/ISecurityService/v1.0.0.0">
<xs:import schemaLocation="http://193.155.1.72/MyCentral-RioII-Services/SecurityService.svc?xsd=xsd2" namespace="http://www.adactus.co.uk/UISupportServices/ServiceData/v1.0.0.0"/>
<xs:element name="StartSession">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="request" nillable="true" type="q1:StartSessionRequest" xmlns:q1="http://www.adactus.co.uk/UISupportServices/ServiceData/v1.0.0.0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="StartSessionResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="StartSessionResult" nillable="true" type="q2:StartSessionResponse" xmlns:q2="http://www.adactus.co.uk/UISupportServices/ServiceData/v1.0.0.0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="EndSession">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="session" nillable="true" type="q3:SessionDTO" xmlns:q3="http://www.adactus.co.uk/UISupportServices/ServiceData/v1.0.0.0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="EndSessionResponse">
<xs:complexType>
<xs:sequence/>
</xs:complexType>
</xs:element>
<xs:element name="GetSessionState">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="session" nillable="true" type="q4:SessionDTO" xmlns:q4="http://www.adactus.co.uk/UISupportServices/ServiceData/v1.0.0.0"/>
<xs:element minOccurs="0" name="request" nillable="true" type="q5:GetSessionStateRequest" xmlns:q5="http://www.adactus.co.uk/UISupportServices/ServiceData/v1.0.0.0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="GetSessionStateResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="GetSessionStateResult" nillable="true" type="q6:GetSessionStateResponse" xmlns:q6="http://www.adactus.co.uk/UISupportServices/ServiceData/v1.0.0.0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="GetSessionFromToken">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="request" nillable="true" type="q7:GetSessionFromTokenRequest" xmlns:q7="http://www.adactus.co.uk/UISupportServices/ServiceData/v1.0.0.0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="GetSessionFromTokenResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="GetSessionFromTokenResult" nillable="true" type="q8:GetSessionFromTokenResponse" xmlns:q8="http://www.adactus.co.uk/UISupportServices/ServiceData/v1.0.0.0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
41 changes: 41 additions & 0 deletions spec/fixtures/wsdl/rio2/rio2_1.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://schemas.microsoft.com/2003/10/Serialization/">
<xs:element name="anyType" nillable="true" type="xs:anyType"/>
<xs:element name="anyURI" nillable="true" type="xs:anyURI"/>
<xs:element name="base64Binary" nillable="true" type="xs:base64Binary"/>
<xs:element name="boolean" nillable="true" type="xs:boolean"/>
<xs:element name="byte" nillable="true" type="xs:byte"/>
<xs:element name="dateTime" nillable="true" type="xs:dateTime"/>
<xs:element name="decimal" nillable="true" type="xs:decimal"/>
<xs:element name="double" nillable="true" type="xs:double"/>
<xs:element name="float" nillable="true" type="xs:float"/>
<xs:element name="int" nillable="true" type="xs:int"/>
<xs:element name="long" nillable="true" type="xs:long"/>
<xs:element name="QName" nillable="true" type="xs:QName"/>
<xs:element name="short" nillable="true" type="xs:short"/>
<xs:element name="string" nillable="true" type="xs:string"/>
<xs:element name="unsignedByte" nillable="true" type="xs:unsignedByte"/>
<xs:element name="unsignedInt" nillable="true" type="xs:unsignedInt"/>
<xs:element name="unsignedLong" nillable="true" type="xs:unsignedLong"/>
<xs:element name="unsignedShort" nillable="true" type="xs:unsignedShort"/>
<xs:element name="char" nillable="true" type="tns:char"/>
<xs:simpleType name="char">
<xs:restriction base="xs:int"/>
</xs:simpleType>
<xs:element name="duration" nillable="true" type="tns:duration"/>
<xs:simpleType name="duration">
<xs:restriction base="xs:duration">
<xs:pattern value="\-?P(\d*D)?(T(\d*H)?(\d*M)?(\d*(\.\d*)?S)?)?"/>
<xs:minInclusive value="-P10675199DT2H48M5.4775808S"/>
<xs:maxInclusive value="P10675199DT2H48M5.4775807S"/>
</xs:restriction>
</xs:simpleType>
<xs:element name="guid" nillable="true" type="tns:guid"/>
<xs:simpleType name="guid">
<xs:restriction base="xs:string">
<xs:pattern value="[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}"/>
</xs:restriction>
</xs:simpleType>
<xs:attribute name="FactoryType" type="xs:QName"/>
<xs:attribute name="Id" type="xs:ID"/>
<xs:attribute name="Ref" type="xs:IDREF"/>
</xs:schema>
Loading

0 comments on commit 007f77d

Please sign in to comment.