<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&lt;QName, String&gt; 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&amp;type=zerocontent&amp;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">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&lt;ts:ClaimType xmlns:ts=&quot;urn:tiani-spirit:ts&quot; xmlns=&quot;urn:tiani-spirit:ts&quot;/&gt;</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">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&lt;ts:ClaimType xmlns:ts=&quot;urn:tiani-spirit:ts&quot; ts:DataType=&quot;<a href="http://www.w3.org/2001/XMLSchema#dateTime">http://www.w3.org/2001/XMLSchema#dateTime</a>&quot; ts:name=&quot;urn:tiani-spirit:bes:2013:claims:tr-date&quot; xmlns=&quot;urn:tiani-spirit:ts&quot;/&gt;</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">   &lt;ts:ClaimType xmlns:ts=&quot;urn:tiani-spirit:ts&quot; xmlns=&quot;urn:tiani-spirit:ts&quot; DataType=&quot;<a href="http://www.w3.org/2001/XMLSchema#dateTime">http://www.w3.org/2001/XMLSchema#dateTime</a>&quot; name=&quot;urn:tiani-spirit:bes:2013:claims:tr-date&quot;&gt;</p>

<p style="margin:0px;font-size:11px;font-family:Monaco">            &lt;ts:ClaimValue&gt;2014-02-26T09:45:58.430Z&lt;/ts:ClaimValue&gt;</p>
<p style="margin:0px;font-size:11px;font-family:Monaco">        &lt;/ts:ClaimType&gt;</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&#39;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">&lt;<a href="mailto:putmanb@georgetown.edu" target="_blank">putmanb@georgetown.edu</a>&gt;</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&#39;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&#39;s being
    mutated in some way by whatever DOM serialization you are applying. 
    But either way I don&#39;t think OpenSAML is directly involved.<br>
    <br>
    If you&#39;re pulling this off the wire, I&#39;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)">&lt;</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>&quot;ClaimType&quot;<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>&quot;ts:ClaimTypeType&quot;<span style="color:rgb(0,145,147)">/&gt;</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)">&lt;</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>&quot;ClaimTypeType&quot;<span style="color:rgb(0,145,147)">&gt;</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)">&lt;</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>&quot;DataType&quot;<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>&quot;xs:anyURI&quot;<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>&quot;required&quot;<span style="color:rgb(0,0,0)">  </span><span style="color:rgb(0,145,147)">/&gt;</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)">&lt;</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>&quot;name&quot;<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>&quot;xs:anyURI&quot;<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>&quot;required&quot;<span style="color:rgb(0,0,0)"> </span><span style="color:rgb(0,145,147)">/&gt;</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)">&lt;/</span>xs:complexType<span style="color:rgb(0,145,147)">&gt;</span></p>

          </div>
          <div><br>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    <br></div>
    Actually, that&#39;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
    &lt;xs:schema&gt; element&#39;s  &#39;
    
    attributeFormDefault&#39; attribute. If it&#39;s absent, it defaults to
    &#39;unqualified&#39;.  Unless the schema is explicitly setting
    &#39;attributeFormDefault=qualified&#39;, then based on that schema snippet,
    I believe the unqualified forms in your B example would be the
    correct schema-valid ones.   See also &#39;
    
    elementFormDefault&#39; , which does the same for elements.<br>
    <br>
    Note that a lot of schemas, including SAML and WS-Trust, set (and/or
    effectively default)
    
    &#39;elementFormDefault=qualified&#39; and
    &#39;attributeFormDefault=unqualified&#39;, meaning elements will be
    namespace-qualified, but attributes are not.<br>
    <br>
    (That doesn&#39;t really have anything to do with why you&#39;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 &quot;contract driven&quot; 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>