You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by David Illsley <da...@gmail.com> on 2007/03/16 09:14:31 UTC
Re: svn commit: r518824 - in /webservices/commons/trunk/modules/axiom/modules: axiom-api/src/main/java/org/apache/axiom/soap/ axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/ axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/ axiom-test
Glen,
Given what you've just mentioned about header order, can you take a
look at org.apache.axis2.context.MessageContext.isHeaderPresent() [1]
and it's associated comments. That and your changes here don't quite
tally in my mind.
Thanks,
David
[1] http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/MessageContext.java?view=markup
On 16/03/07, gdaniels@apache.org <gd...@apache.org> wrote:
> Author: gdaniels
> Date: Thu Mar 15 18:29:03 2007
> New Revision: 518824
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=518824
> Log:
> * Fix DOOM bug in SOAPEnvelopeImpl where it would allow a SOAPHeader to come after a SOAPBody. This was being masked by getHeader(), which used to call getFirstChildWithName() - so of course the header would show up even though it was after the body. Once I fixed getHeader() to only check the first element, a SAAJ test started breaking because getHeader() was returning null.
>
> * Add a test to make sure we don't regress the above.
>
> * More work on versioning, move static QName constants up to SOAP*Constants interface, and provide a way to get MU faultcode QName from SOAPVersion.
>
> * Make sure a null RolePlayer means doing the default search (ultimate receiver and next, but nothing else) for targeted headers.
>
> Modified:
> webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAP11Constants.java
> webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAP11Version.java
> webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAP12Constants.java
> webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAP12Version.java
> webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPVersion.java
> webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java
> webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPHeaderImpl.java
> webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPEnvelopeTest.java
>
> Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAP11Constants.java
> URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAP11Constants.java?view=diff&rev=518824&r1=518823&r2=518824
> ==============================================================================
> --- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAP11Constants.java (original)
> +++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAP11Constants.java Thu Mar 15 18:29:03 2007
> @@ -16,32 +16,38 @@
>
> package org.apache.axiom.soap;
>
> +import javax.xml.namespace.QName;
> +
>
> public interface SOAP11Constants extends SOAPConstants {
> /** Eran Chinthaka (chinthaka@apache.org) */
> - public static final String SOAP_ENVELOPE_NAMESPACE_URI =
> + static final String SOAP_ENVELOPE_NAMESPACE_URI =
> "http://schemas.xmlsoap.org/soap/envelope/";
> - public static final String SOAP_ENCODING_NAMESPACE_URI =
> + static final String SOAP_ENCODING_NAMESPACE_URI =
> "http://schemas.xmlsoap.org/soap/encoding/";
>
> /** Field ATTR_ACTOR */
> - public static final String ATTR_ACTOR = "actor";
> + static final String ATTR_ACTOR = "actor";
>
> /** Field SOAP_FAULT_CODE_LOCAL_NAME */
> - public static final String SOAP_FAULT_CODE_LOCAL_NAME = "faultcode";
> + static final String SOAP_FAULT_CODE_LOCAL_NAME = "faultcode";
> /** Field SOAP_FAULT_STRING_LOCAL_NAME */
> - public static final String SOAP_FAULT_STRING_LOCAL_NAME = "faultstring";
> + static final String SOAP_FAULT_STRING_LOCAL_NAME = "faultstring";
> /** Field SOAP_FAULT_ACTOR_LOCAL_NAME */
> - public static final String SOAP_FAULT_ACTOR_LOCAL_NAME = "faultactor";
> + static final String SOAP_FAULT_ACTOR_LOCAL_NAME = "faultactor";
>
> - public static final String SOAP_FAULT_DETAIL_LOCAL_NAME = "detail";
> + static final String SOAP_FAULT_DETAIL_LOCAL_NAME = "detail";
>
> //SOAP 1.2 Content Type
> - public static final String SOAP_11_CONTENT_TYPE = "text/xml";
> + static final String SOAP_11_CONTENT_TYPE = "text/xml";
> +
> + static final QName QNAME_ACTOR = new QName(SOAP_ENVELOPE_NAMESPACE_URI, ATTR_ACTOR);
> + static final QName QNAME_MU_FAULTCODE = new QName(SOAP_ENVELOPE_NAMESPACE_URI,
> + FAULT_CODE_MUST_UNDERSTAND);
>
> // -------- SOAP Fault Codes ------------------------------
> - public static final String FAULT_CODE_SENDER = "Client";
> - public static final String FAULT_CODE_RECEIVER = "Server";
> + static final String FAULT_CODE_SENDER = "Client";
> + static final String FAULT_CODE_RECEIVER = "Server";
>
> - public static final String SOAP_ACTOR_NEXT = "http://schemas.xmlsoap.org/soap/actor/next";
> + static final String SOAP_ACTOR_NEXT = "http://schemas.xmlsoap.org/soap/actor/next";
> }
>
> Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAP11Version.java
> URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAP11Version.java?view=diff&rev=518824&r1=518823&r2=518824
> ==============================================================================
> --- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAP11Version.java (original)
> +++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAP11Version.java Thu Mar 15 18:29:03 2007
> @@ -24,8 +24,6 @@
> private static final SOAP11Version singleton = new SOAP11Version();
> public static SOAP11Version getSingleton() { return singleton; }
>
> - QName actorQName = new QName(SOAP_ENVELOPE_NAMESPACE_URI, ATTR_ACTOR);
> -
> private SOAP11Version() {
> }
>
> @@ -41,11 +39,16 @@
>
> /** Obtain the QName for the role attribute (actor/role) */
> public QName getRoleAttributeQName() {
> - return actorQName;
> + return QNAME_ACTOR;
> }
>
> /** Obtain the "next" role/actor URI */
> public String getNextRoleURI() {
> return SOAP_ACTOR_NEXT;
> + }
> +
> + /** Obtain the QName for the MustUnderstand fault code */
> + public QName getMustUnderstandFaultCode() {
> + return QNAME_MU_FAULTCODE;
> }
> }
>
> Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAP12Constants.java
> URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAP12Constants.java?view=diff&rev=518824&r1=518823&r2=518824
> ==============================================================================
> --- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAP12Constants.java (original)
> +++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAP12Constants.java Thu Mar 15 18:29:03 2007
> @@ -16,6 +16,8 @@
>
> package org.apache.axiom.soap;
>
> +import javax.xml.namespace.QName;
> +
>
> public interface SOAP12Constants extends SOAPConstants {
> /** Eran Chinthaka (chinthaka@apache.org) */
> @@ -59,6 +61,11 @@
>
> //SOAP 1.2 Content Type
> public static final String SOAP_12_CONTENT_TYPE = "application/soap+xml";
> +
> + // QNames
> + static final QName QNAME_ROLE = new QName(SOAP_ENVELOPE_NAMESPACE_URI, SOAP_ROLE);
> + static final QName QNAME_MU_FAULTCODE = new QName(SOAP_ENVELOPE_NAMESPACE_URI,
> + FAULT_CODE_MUST_UNDERSTAND);
>
> // -------- SOAP Fault Codes ------------------------------
> public static final String FAULT_CODE_SENDER = "Sender";
>
> Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAP12Version.java
> URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAP12Version.java?view=diff&rev=518824&r1=518823&r2=518824
> ==============================================================================
> --- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAP12Version.java (original)
> +++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAP12Version.java Thu Mar 15 18:29:03 2007
> @@ -24,8 +24,6 @@
> private static final SOAP12Version singleton = new SOAP12Version();
> public static SOAP12Version getSingleton() { return singleton; }
>
> - QName actorQName = new QName(SOAP_ENVELOPE_NAMESPACE_URI, SOAP_ROLE);
> -
> private SOAP12Version() {
> }
>
> @@ -41,11 +39,16 @@
>
> /** Obtain the QName for the role attribute (actor/role) */
> public QName getRoleAttributeQName() {
> - return actorQName;
> + return QNAME_ROLE;
> }
>
> /** Obtain the "next" role/actor URI */
> public String getNextRoleURI() {
> return SOAP_ROLE_NEXT;
> + }
> +
> + /** Obtain the QName for the MustUnderstand fault code */
> + public QName getMustUnderstandFaultCode() {
> + return QNAME_MU_FAULTCODE;
> }
> }
>
> Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPVersion.java
> URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPVersion.java?view=diff&rev=518824&r1=518823&r2=518824
> ==============================================================================
> --- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPVersion.java (original)
> +++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPVersion.java Thu Mar 15 18:29:03 2007
> @@ -41,4 +41,9 @@
> * Obtain the "next" role/actor URI
> */
> String getNextRoleURI();
> +
> + /**
> + * Obtain the QName for the MustUnderstand fault code
> + */
> + QName getMustUnderstandFaultCode();
> }
>
> Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java
> URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java?view=diff&rev=518824&r1=518823&r2=518824
> ==============================================================================
> --- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java (original)
> +++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java Thu Mar 15 18:29:03 2007
> @@ -92,6 +92,13 @@
> "SOAP Envelope can not have children other than SOAP Header and Body",
> SOAP12Constants.FAULT_CODE_SENDER);
> } else {
> + if (this.done && (child instanceof SOAPHeader)) {
> + SOAPBody body = getBody();
> + if (body != null) {
> + body.insertSiblingBefore(child);
> + return;
> + }
> + }
> super.addChild(child);
> }
> }
>
> Modified: webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPHeaderImpl.java
> URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPHeaderImpl.java?view=diff&rev=518824&r1=518823&r2=518824
> ==============================================================================
> --- webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPHeaderImpl.java (original)
> +++ webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPHeaderImpl.java Thu Mar 15 18:29:03 2007
> @@ -85,6 +85,12 @@
> class RolePlayerChecker implements Checker {
> RolePlayer rolePlayer;
>
> + /**
> + * Constructor.
> + *
> + * @param rolePlayer the RolePlayer to check against. This can be null, in which
> + * case we assume we're the ultimate destination.
> + */
> public RolePlayerChecker(RolePlayer rolePlayer) {
> this.rolePlayer = rolePlayer;
> }
> @@ -97,7 +103,7 @@
> if (role == null || role.equals("") ||
> (version instanceof SOAP12Version &&
> role.equals(SOAP12Constants.SOAP_ROLE_ULTIMATE_RECEIVER))) {
> - return rolePlayer.isUltimateDestination();
> + return (rolePlayer == null || rolePlayer.isUltimateDestination());
> }
>
> // 2. If role is next, always return true
> @@ -110,7 +116,7 @@
> }
>
> // 4. Return t/f depending on match
> - List roles = rolePlayer.getRoles();
> + List roles = (rolePlayer == null) ? null : rolePlayer.getRoles();
> if (roles != null) {
> for (Iterator i = roles.iterator(); i.hasNext();) {
> String thisRole = (String) i.next();
>
> Modified: webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPEnvelopeTest.java
> URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPEnvelopeTest.java?view=diff&rev=518824&r1=518823&r2=518824
> ==============================================================================
> --- webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPEnvelopeTest.java (original)
> +++ webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/SOAPEnvelopeTest.java Thu Mar 15 18:29:03 2007
> @@ -114,4 +114,14 @@
> soapFac.createSOAPHeader(defaultEnvelope);
>
> }
> +
> + // Make sure order of header/body creation doesn't matter
> + public void testBodyHeaderOrder() throws Exception {
> +// SOAPFactory soapFac = new org.apache.axiom.soap.impl.llom.soap11.SOAP11Factory();
> + SOAPFactory soapFac = new org.apache.axiom.soap.impl.dom.soap11.SOAP11Factory();
> + SOAPEnvelope env = soapFac.createSOAPEnvelope();
> + SOAPBody body = soapFac.createSOAPBody(env);
> + SOAPHeader header = soapFac.createSOAPHeader(env);
> + assertTrue("Header isn't the first child!", env.getFirstElement() instanceof SOAPHeader);
> + }
> }
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: commons-dev-help@ws.apache.org
>
>
--
David Illsley - IBM Web Services Development
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org
[axis2] Re: svn commit: r518824 - in
/webservices/commons/trunk/modules/axiom/modules:
axiom-api/src/main/java/org/apache/axiom/soap/
axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/
axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/ axiom-test
Posted by Glen Daniels <gl...@thoughtcraft.com>.
Hi David:
David Illsley wrote:
> Given what you've just mentioned about header order, can you take a
> look at org.apache.axis2.context.MessageContext.isHeaderPresent() [1]
> and it's associated comments. That and your changes here don't quite
> tally in my mind.
Right - a side-effect of the recent changes is to enable getting rid of
that method entirely because we get the same performance guard in OM
itself. There is currently only one usage I can find of
isHeaderPresent() (in InstanceDispatcher), and I'm about to remove that
and deprecate the method itself.
Also note that until the DOOM fix I made last night, isHeaderPresent()
could have returned false in this situation:
1. Create envelope
2. Add body
3. Add header (header is now the *second* element)
4. Call isHeaderPresent()
Both copies [ insert rant here about maintainability of
llom/doom/soap11/soap12 and how the runtime memory footprint gain maybe
isn't worth it ] of SOAPHeaderImpl now give you exactly the same
benefits isHeaderPresent() used to, with the bonus that you get them
anywhere you use OM, not just in Axis.
--Glen
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org
[axis2] Re: svn commit: r518824 - in
/webservices/commons/trunk/modules/axiom/modules:
axiom-api/src/main/java/org/apache/axiom/soap/
axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/
axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/ axiom-test
Posted by Glen Daniels <gl...@thoughtcraft.com>.
Hi David:
David Illsley wrote:
> Given what you've just mentioned about header order, can you take a
> look at org.apache.axis2.context.MessageContext.isHeaderPresent() [1]
> and it's associated comments. That and your changes here don't quite
> tally in my mind.
Right - a side-effect of the recent changes is to enable getting rid of
that method entirely because we get the same performance guard in OM
itself. There is currently only one usage I can find of
isHeaderPresent() (in InstanceDispatcher), and I'm about to remove that
and deprecate the method itself.
Also note that until the DOOM fix I made last night, isHeaderPresent()
could have returned false in this situation:
1. Create envelope
2. Add body
3. Add header (header is now the *second* element)
4. Call isHeaderPresent()
Both copies [ insert rant here about maintainability of
llom/doom/soap11/soap12 and how the runtime memory footprint gain maybe
isn't worth it ] of SOAPHeaderImpl now give you exactly the same
benefits isHeaderPresent() used to, with the bonus that you get them
anywhere you use OM, not just in Axis.
--Glen
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org