<div dir="ltr"><div>Hello, <br></div><div><br></div><div>Everything is handled using XMLTooling and DOM. In my marshaller, I have</div><div><br></div><div><p style="margin:0px;font-size:11px;font-family:Monaco"><span style="color:rgb(147,26,104)">public</span> <span style="color:rgb(147,26,104)">class</span> <span style="text-decoration:underline">ClaimTypeMarshaller</span> <span style="color:rgb(147,26,104)">extends</span> AbstractWSTrustObjectMarshaller {</p>
</div><div><p style="margin:0px;font-size:11px;font-family:Monaco;color:rgb(119,119,119)">@Override</p>
<p style="margin:0px;font-size:11px;font-family:Monaco"><span class="" style="white-space:pre">        </span><span style="color:rgb(147,26,104)">protected</span> <span style="color:rgb(147,26,104)">void</span> marshallAttributes(XMLObject xmlObject, Element domElement) <span style="color:rgb(147,26,104)">throws</span> MarshallingException {</p>
<p style="margin:0px;font-size:11px;font-family:Monaco;min-height:15px"><br></p>
<p style="margin:0px;font-size:11px;font-family:Monaco"><span class="" style="white-space:pre">                </span>String out1 = XMLHelper.prettyPrintXML(domElement);</p>
<p style="margin:0px;font-size:11px;font-family:Monaco"><span class="" style="white-space:pre">                </span>System.<span style="color:rgb(3,38,204)">out</span>.println(out1);</p>
<p style="margin:0px;font-size:11px;font-family:Monaco"><span class="" style="white-space:pre">                </span>ClaimTypeImpl cvi = (ClaimTypeImpl)xmlObject;</p>
<p style="margin:0px;font-size:11px;font-family:Monaco;color:rgb(78,144,114)">//<span class="" style="white-space:pre">                </span>XMLHelper.marshallAttributeMap(cvi.getUnknownAttributes(), domElement);</p>
<p style="margin:0px;font-size:11px;font-family:Monaco"><span class="" style="white-space:pre">                </span>AttributeMap attributeMap = cvi.getUnknownAttributes();</p>
<p style="margin:0px;font-size:11px;font-family:Monaco"><span class="" style="white-space:pre">                </span>Document document = domElement.getOwnerDocument();</p>
<p style="margin:0px;font-size:11px;font-family:Monaco"><span class="" style="white-space:pre">                </span>Attr attribute = <span style="color:rgb(147,26,104)">null</span>;</p>
<p style="margin:0px;font-size:11px;font-family:Monaco"><span class="" style="white-space:pre">                </span><span style="color:rgb(147,26,104)">for</span> (Entry<QName, String> entry : attributeMap.entrySet()) {</p>
<p style="margin:0px;font-size:11px;font-family:Monaco"><span class="" style="white-space:pre">                        </span>attribute = XMLHelper.constructAttribute(document, entry.getKey());</p>
<p style="margin:0px;font-size:11px;font-family:Monaco"><span class="" style="white-space:pre">                        </span>attribute.setValue(entry.getValue());</p>
<p style="margin:0px;font-size:11px;font-family:Monaco"><span class="" style="white-space:pre">                        </span>domElement.setAttributeNodeNS(attribute);</p>
<p style="margin:0px;font-size:11px;font-family:Monaco"><span class="" style="white-space:pre">                        </span><span style="color:rgb(147,26,104)">if</span> (Configuration.isIDAttribute(entry.getKey()) || attributeMap.isIDAttribute(entry.getKey())) {</p>
<p style="margin:0px;font-size:11px;font-family:Monaco"><span class="" style="white-space:pre">                                </span>domElement.setIdAttributeNode(attribute, <span style="color:rgb(147,26,104)">true</span>);</p>
<p style="margin:0px;font-size:11px;font-family:Monaco"><span class="" style="white-space:pre">                        </span>}</p>
<p style="margin:0px;font-size:11px;font-family:Monaco"><span class="" style="white-space:pre">                </span>}</p>
<p style="margin:0px;font-size:11px;font-family:Monaco"><span class="" style="white-space:pre">                </span>String out = XMLHelper.prettyPrintXML(domElement);</p>
<p style="margin:0px;font-size:11px;font-family:Monaco"><span class="" style="white-space:pre">                </span>System.<span style="color:rgb(3,38,204)">out</span>.println(out);</p><p style="margin:0px;font-size:11px;font-family:Monaco">
<br></p></div><div hspace="streak-pt-mark" style="max-height:1px"><img style="width:0px; max-height:0px;" src="https://mailfoogae.appspot.com/t?sender=abWFzc2ltaWxpYW5vLm1hc2lAZ21haWwuY29t&type=zerocontent&guid=7779681a-afb3-4694-88d7-1cd68f6f4880"><font color="#ffffff" size="1">ᐧ</font></div>
<div class="gmail_extra">The first System.out gives the following: </div><div class="gmail_extra"><br></div><div class="gmail_extra"><p style="margin:0px;font-size:11px;font-family:Monaco"><?xml version="1.0" encoding="UTF-8"?><ts:ClaimType xmlns:ts="urn:tiani-spirit:ts" xmlns="urn:tiani-spirit:ts"/></p>
<p style="margin:0px;font-size:11px;font-family:Monaco;min-height:15px"><br></p><div class="gmail_extra" style>The second gives the following (correct):</div><div class="gmail_extra" style><br></div>
<p style="margin:0px;font-size:11px;font-family:Monaco"><?xml version="1.0" encoding="UTF-8"?><ts:ClaimType xmlns:ts="urn:tiani-spirit:ts" ts:DataType="<a href="http://www.w3.org/2001/XMLSchema#dateTime">http://www.w3.org/2001/XMLSchema#dateTime</a>" ts:name="urn:tiani-spirit:bes:2013:claims:tr-date" xmlns="urn:tiani-spirit:ts"/></p>
<div><br></div><div class="gmail_quote">Unfortuntaly, the resulted XML is as follows:</div><div class="gmail_quote"><br></div><div class="gmail_quote"><p style="margin:0px;font-size:11px;font-family:Monaco"> <ts:ClaimType xmlns:ts="urn:tiani-spirit:ts" xmlns="urn:tiani-spirit:ts" DataType="<a href="http://www.w3.org/2001/XMLSchema#dateTime">http://www.w3.org/2001/XMLSchema#dateTime</a>" name="urn:tiani-spirit:bes:2013:claims:tr-date"></p>
<p style="margin:0px;font-size:11px;font-family:Monaco"> <ts:ClaimValue>2014-02-26T09:45:58.430Z</ts:ClaimValue></p>
<p style="margin:0px;font-size:11px;font-family:Monaco"> </ts:ClaimType></p><p style="margin:0px;font-size:11px;font-family:Monaco"><br></p><p style="margin:0px;font-size:11px;font-family:Monaco"><br></p></div>
<div class="gmail_quote">So, something must happen during marshalling of the ancestors, perhaps in the marshallInto of AbstractWSTrustObjectMarshaller?</div><div class="gmail_quote">Moreover, who is qualifying such attributes? I created the schema with qualified attributes because of the result of the marhsalling.</div>
<div class="gmail_quote"><br></div><div class="gmail_quote">I can't access the source code now, the whole <a href="http://shibboleth.net">shibboleth.net</a> is down.</div><div class="gmail_quote"><br></div><div class="gmail_quote">
Any other ideas?</div><div class="gmail_quote"><br></div><div class="gmail_quote"><br></div><div class="gmail_quote"><br></div><div class="gmail_quote">On Tue, Feb 25, 2014 at 6:55 PM, Brent Putman <span dir="ltr"><<a href="mailto:putmanb@georgetown.edu" target="_blank">putmanb@georgetown.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
<br>
<div>On 2/25/14 9:13 AM, Massimiliano Masi
wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">Hi All,
<div class=""><div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>In project A, my XMLObject is unmarshalled as: <br>
</div>
</div></div>
</blockquote>
<br>
My question would be: Unmarshalled from where? Coming in over the
wire from a WS service or WS client of some kind (e.g. see below re:
Apache Axis). OpenSAML doesn't change a DOM when it unmarshalls an
XMLObject tree around it, so my guess would be that the XML already
looks that way before it gets to your OpenSAML. Or else, it's being
mutated in some way by whatever DOM serialization you are applying.
But either way I don't think OpenSAML is directly involved.<br>
<br>
If you're pulling this off the wire, I'd try serializing and logging
it before you hand it to OpenSAML for unmarshalling, just to confirm
exactly what you are receiving.<div class=""><br>
<br>
<blockquote type="cite">
<div dir="ltr">
<div>
<p style="margin:0px;font-size:11px;font-family:Monaco"><br>
</p>
<div><br>
</div>
<div>Project A is good, since it declares a namespace for the
attributes DataType and Name, while in project B such
attribtues are not set. This violates this schema
definition: </div>
<div><br>
</div>
<div>
<p style="margin:0px;font-size:11px;font-family:Monaco;color:rgb(57,51,255)"><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(0,145,147)"><</span><span style="color:rgb(78,145,146)">xs:element</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(147,33,146)">name</span><span style="color:rgb(0,0,0)">=</span>"ClaimType"<span style="color:rgb(0,0,0)"> </span><span style="color:rgb(147,33,146)">type</span><span style="color:rgb(0,0,0)">=</span>"ts:ClaimTypeType"<span style="color:rgb(0,145,147)">/></span></p>
<p style="margin:0px;font-size:11px;font-family:Monaco;color:rgb(57,51,255)"><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(0,145,147)"><</span><span style="color:rgb(78,145,146)">xs:complexType</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(147,33,146)">name</span><span style="color:rgb(0,0,0)">=</span>"ClaimTypeType"<span style="color:rgb(0,145,147)">></span></p>
<p style="margin:0px;font-size:11px;font-family:Monaco;color:rgb(57,51,255)"><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(0,145,147)"><</span><span style="color:rgb(78,145,146)">xs:attribute</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(147,33,146)">name</span><span style="color:rgb(0,0,0)">=</span>"DataType"<span style="color:rgb(0,0,0)"> </span><span style="color:rgb(147,33,146)">type</span><span style="color:rgb(0,0,0)">=</span>"xs:anyURI"<span style="color:rgb(0,0,0)"> </span><span style="color:rgb(147,33,146)">use</span><span style="color:rgb(0,0,0)">=</span>"required"<span style="color:rgb(0,0,0)"> </span><span style="color:rgb(0,145,147)">/></span></p>
<p style="margin:0px;font-size:11px;font-family:Monaco;color:rgb(57,51,255)"><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(0,145,147)"><</span><span style="color:rgb(78,145,146)">xs:attribute</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(147,33,146)">name</span><span style="color:rgb(0,0,0)">=</span>"name"<span style="color:rgb(0,0,0)"> </span><span style="color:rgb(147,33,146)">type</span><span style="color:rgb(0,0,0)">=</span>"xs:anyURI"<span style="color:rgb(0,0,0)"> </span><span style="color:rgb(147,33,146)">use</span><span style="color:rgb(0,0,0)">=</span>"required"<span style="color:rgb(0,0,0)"> </span><span style="color:rgb(0,145,147)">/></span></p>
<p style="margin:0px;font-size:11px;font-family:Monaco;color:rgb(78,145,146)"><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(0,145,147)"></</span>xs:complexType<span style="color:rgb(0,145,147)">></span></p>
</div>
<div><br>
</div>
</div>
</div>
</blockquote>
<br>
<br></div>
Actually, that's not really clear just from that schema snippet.
Whether the attributes in an instance document are
namespace-qualified or not depends (in part) on the
<xs:schema> element's '
attributeFormDefault' attribute. If it's absent, it defaults to
'unqualified'. Unless the schema is explicitly setting
'attributeFormDefault=qualified', then based on that schema snippet,
I believe the unqualified forms in your B example would be the
correct schema-valid ones. See also '
elementFormDefault' , which does the same for elements.<br>
<br>
Note that a lot of schemas, including SAML and WS-Trust, set (and/or
effectively default)
'elementFormDefault=qualified' and
'attributeFormDefault=unqualified', meaning elements will be
namespace-qualified, but attributes are not.<br>
<br>
(That doesn't really have anything to do with why you're seeing 2
different outputs, though).<div class=""><br>
<br>
<br>
<br>
<blockquote type="cite">
<div dir="ltr">
<div>
<div><br>
</div>
<div>Since the code (from project A) is the same, it must be a
problem of libraries. Do you have suggestions?</div>
</div>
</div>
</blockquote>
<br></div>
Not specifically, but that ns0, ns1, etc stuff looks suspiciously
like what Apache Axis does when it generates Java code to handle a
particular schema (the "contract driven" way). So perhaps that is
relevant somewhere in what you are doing, or at least you are
somehow using some of the same libraries that they do.<span class=""><font color="#888888"><br>
<br>
<br>
--Brent<br>
<br>
<br>
</font></span></div>
<br>--<br>
To unsubscribe from this list send an email to <a href="mailto:dev-unsubscribe@shibboleth.net">dev-unsubscribe@shibboleth.net</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Massimiliano Masi<br><br><a href="http://www.mascanc.net/~max">http://www.mascanc.net/~max</a>
</div></div>