Lance,
Allow me to clarify: this is about inconsistent interpretation of SOAP
1.2 requirements in the CTS, not enhancing test coverage.
http://jira.jboss.com/jira/browse/JBCTS-553
According to the SOAP 1.2 specification:
-Body allows whitespace text only. Text is considered significant
-Header allows whitespace text only. Text is NOT considered significant
The CTS and the RI interpret SOAP 1.2 requirements inconsistently:
-SOAPBody always accepts text, whitespace or otherwise. This is LESS
restrictive than SOAP 1.2
-SOAPHeader never accepts text, whitespace or otherwise. This is MORE
restrictive than SOAP 1.2
I propose the CTS be made JUST AS restrictive as SOAP 1.2:
-SOAPBody accepts whitespace text only. The text is preserved in a
javax.xml.soap.Text node.
-SOAPHeader accepts whitespace text only. The text is discarded.
Regards,
Alejandro
Lance J. Andersen wrote:
Hi Alejandro,
Thanks for the note.
Alejandro Guízar wrote:
> Lance,
>
> In the first place, thanks for the time you have spent following up
> this issue.
>
> > What is the specific issue in either of these tests below that are in
> > question (it would help if you could include the code in question in
> > your reply)
>
> CTS validates SOAPHeader more strictly than SOAPBody with no apparent
> reason.
>
> Consider class SOAPElementTestServlet (in
> com.sun.ts.tests.saaj.api.javax_xml_soap.SOAPElement).
>
> The code below adds non-whitespace text to a SOAPBody instance and
> expects the invocation to succeed. addTextNodeTest1 gets called two
> times, one for SOAP 1.1 and one for SOAP 1.2.
>
> void addTextNodeTest1(HttpServletRequest req, HttpServletResponse res)
> {
> ...
> Iterator iStart = body.getChildElements();
> int countStart = SOAP_Util.getIteratorCount(iStart);
> SOAPElement se = body.addTextNode("<txt>This is
text</txt>");
> if(se == null) {
> pass = false;
> } else if(!body.getValue().equals("<txt>This is
text</txt>")) {
> String s = body.getValue();
> pass = false;
> }
> ...
> }
>
> The code below adds non-whitespace text to a SOAPHeader instance and
> expects the invocation to fail for SOAP 1.2.
>
> void addTextNodeSOAP12Test2(HttpServletRequest req,
> HttpServletResponse res)
> {
> ...
> try {
> Iterator iStart = hdr.getChildElements();
> int countStart = SOAP_Util.getIteratorCount(iStart);
> SOAPElement se = hdr.addTextNode("<txt>This is
text</txt>");
>
> TestUtil.logErr("Did not throw expected SOAPException");
> pass = false;
> } catch (SOAPException e) {
> TestUtil.logMsg("Did throw expected SOAPException");
> }
> ...
> }
>
> Apparently, the intent of addTextNodeSOAP12Test2 is to verify only
> whitespace text can be added to Header elements, as required by SOAP
> 1.2. A similar requirement exists for other SOAP elements, including
> Body. However, addTextNodeTest1 does not verify it.
>
> The CTS should verify this requirement consistently. Either both
> SOAPHeader and SOAPBody validate text addition or none does.
The test above is valid as you point out and yes, the coverage
could/should be expanded going forward.
>
> > WRT, coverage issues, it is possible that not every assertion is
> > tested and i take that is one of the issues that you are referring to
> > below?
>
> If the SAAJ team considers text validation desirable, then the CTS
> should be extended to validate not only Header and Body, but all SOAP
> elements that disallow non-whitespace text content.
As i mentioned in my earlier note, not every assertion is covered and
there is always room for improved coverage as you point out.
We will look at enhancing coverage going forward for additional SOAP
elements.
Regards
Lance
>
> Best,
>
> -Alejandro
>
>
> Lance J. Andersen wrote:
>> Alejandro,
>>
>>
>> I need a bit more info here to move forward.
>>
>> - What is the specific issue in either of these tests below that are
>> in question (it would help if you could include the code in question
>> in your reply)
>> - WRT, coverage issues, it is possible that not every assertion is
>> tested and i take that is one of the issues that you are referring to
>> below?
>> Regards
>> Lance
>>
>> Alejandro Guízar wrote:
>>> Lance,
>>>
>>> I am a member of the JBoss Web Services team. The project lead,
>>> Thomas Diesler, indicated you as the person to go to when
>>> questions/issues about the CTS emerge.
>>>
>>> I have one such question with regard to SAAJ tests. I was hoping you
>>> could help me, either directly or by forwarding my question to the
>>> SAAJ team at Sun.
>>>
>>> -----------
>>>
>>> The test case saaj/api/javax_xml_soap/SOAPElement contains two
>>> tests, addTextNodeTest1 and addTextNodeTest2, that verify the
>>> addition of non-whitespace text to SOAPBody and SOAPHeader under
>>> SOAP 1.1 and SOAP 1.2. Of the four assertions, only adding Text to a
>>> SOAPHeader under SOAP 1.2 is expected to throw an exception.
>>>
>>> No explicit requirement on Text children of Elements appears in the
>>> SOAP 1.1 specification. This is consistent with the CTS assertions:
>>> text nodes are always accepted.
>>>
>>> The table below summarizes explicit requirements on 'character
>>> information item' children of 'element information items' defined
by
>>> the SOAP 1.2 specification.
>>>
>>> EII CII content Significant?
>>> --- --- ---
>>> Envelope white space no
>>> Header white space no
>>> HeaderElement any character yes
>>> Body white space yes
>>> BodyElement any character yes
>>> Fault white space no
>>> Detail white space yes
>>> DetailEntry any character yes
>>>
>>> Given the table above, adding non-whitespace text to SOAPHeader or
>>> SOAPBody under SOAP 1.2 is invalid. This applies to SOAPEnvelope,
>>> SOAPFault and Detail as well. The CTS expects SOAPHeader to throw an
>>> exception but not SOAPBody. Other elements are not even tested.
>>>
>>> What is the rationale behind requiring SOAPHeader to throw an
>>> exception, but not other elements?
>>>
>>> ----------
>>>
>>> Thanks,
>>>
>>> Alejandro Guizar
>>> Senior Software Engineer
>>> JBoss, a division of Red Hat
>>> E: aguizar(a)redhat.com
>>> M: 512-905-0841