Welcome to the "trac"-ing site of soap4r!
[soap4r] [httpclient] [openpgp4u] [pkcs1] [logger] [csv] [vtr]

Ticket #382 (closed defect: fixed)

Opened 10 months ago

Last modified 10 months ago

Choice definition in XSD

Reported by: user Assigned to: user
Priority: high Milestone: 1.5.8
Component: wsdl4r Version: 1.5
Keywords: xsd choice Cc:

Description (Last modified by nahi)

If there is choice element in complex type, soap4r doesn't process all elements if the first element is an empty array. See listing below, element RespondWith? is generated as an array with wsd2ruby.

<complexType name="RequestAbstractType" abstract="true">
		<sequence>
			<element ref="samlp:RespondWith" minOccurs="0" maxOccurs="unbounded"/>
			<element ref="ds:Signature" minOccurs="0"/>
		</sequence>
		<attribute name="RequestID" type="ID" use="required"/>
		<attribute name="MajorVersion" type="integer" use="required"/>
		<attribute name="MinorVersion" type="integer" use="required"/>
		<attribute name="IssueInstant" type="dateTime" use="required"/>
	</complexType>
	<element name="RespondWith" type="QName"/>
	<element name="Request" type="samlp:RequestType"/>
	<complexType name="RequestType">
		<complexContent>
			<extension base="samlp:RequestAbstractType">
				<choice>
					<element ref="samlp:Query"/>
					<element ref="samlp:SubjectQuery"/>
					<element ref="samlp:AuthenticationQuery"/>
					<element ref="samlp:AttributeQuery"/>
					<element ref="samlp:AuthorizationDecisionQuery"/>
					<element ref="saml:AssertionIDReference" maxOccurs="unbounded"/>
					<element ref="samlp:AssertionArtifact" maxOccurs="unbounded"/>
				</choice>
			</extension>
		</complexContent>
	</complexType>

---

Now if you do not set it manually nil, generated default constructor will define it as an empty array and processing will stop there.

Modification to literalregistry.rb solves this issue, literalregistry.rb:176

was

            child.each do |item|
              ele.add(definedobj2soap(item, definition))
            end

modified to:

            visited = false
            child.each do |item|
              ele.add(definedobj2soap(item, definition))
              visited = true
            end
            if visited
            added = true
            else
            added = false
            end

... other way to fix this would be a change in to wsdl2ruby. Generated constructor for RequestType? (see listing) is now:

def initialize(respondWith = [], signature = nil, query = nil, subjectQuery = nil, authenticationQuery = nil, attributeQuery = nil, authorizationDecisionQuery = nil, assertionIDReference = [], assertionArtifact = [])

Should be:

def initialize(respondWith = nil, signature = nil, query = nil, subjectQuery = nil, authenticationQuery = nil, attributeQuery = nil, authorizationDecisionQuery = nil, assertionIDReference = nil, assertionArtifact = nil)

KR, Vesa Varimo varimo@iki.fi

...

Change History

07/19/07 14:57:33 changed by user

  • status changed from new to assigned.
  • severity changed from normal to critical.
  • component changed from soap4r to wsdl4r.
  • priority changed from normal to high.
  • milestone changed from undefined to 1.5.8.
  • owner changed from nahi to user.

Thanks! The patch should be applied.

07/21/07 13:06:27 changed by nahi

  • description changed.

07/21/07 13:36:05 changed by nahi

  • status changed from assigned to closed.
  • resolution set to fixed.

(In [1897]) * choice handling bug fixed according to a patch from KR, Vesa Varimo. If there was choice element in complex type, soap4r didn't process all elements if the first element was an empty array. closes #382.