I have a webservice operation where I get SAML Assertion as part of the request body. I have an XSD:
<xsd:element name="CreateRequest">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="info" type="SomeRequestObj"/>
<xsd:element ref="saml:Assertion" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
Sam: The statement applies to:
<xsd:import namespace="urn:oasis:names:tc:SAML:2.0:assertion"schemaLocation="../samlv2_0/saml-schema-assertion-2.0.xsd"/>
This saml schema is copied from SAML 2.0 . This generates classes called * Type.java. And it's hard for me to create a unit test for this (this is a separate application with a user interface).
My request requires a SAML AssertionType element in the request element. Thus, I cannot use OpneSaml to generate, as it gives me a SAML Assertion object, not an AssertionType.
I tried to create the AssertionType object manually, but it's hard for me to do this.
Is there a way to use OpenSaml to create it?
Since I see that xml will be the same as if I just use OpenSaml to create an Assertion object. Is there any way to simplify this?
EDIT: Added fragment of XSD statement
<element name="Assertion" type="saml:AssertionType"/>
<complexType name="AssertionType">
<sequence>
<element ref="saml:Issuer"/>
<element ref="ds:Signature" minOccurs="0"/>
<element ref="saml:Subject" minOccurs="0"/>
<element ref="saml:Conditions" minOccurs="0"/>
<element ref="saml:Advice" minOccurs="0"/>
<choice minOccurs="0" maxOccurs="unbounded">
<element ref="saml:Statement"/>
<element ref="saml:AuthnStatement"/>
<element ref="saml:AuthzDecisionStatement"/>
<element ref="saml:AttributeStatement"/>
</choice>
</sequence>
<attribute name="Version" type="string" use="required"/>
<attribute name="ID" type="ID" use="required"/>
<attribute name="IssueInstant" type="dateTime" use="required"/>
</complexType>
This creates an AssertionType object.