Axis2
  1. Axis2
  2. AXIS2-2811

Assumption that message label and message direction are synonymous

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: codegen
    • Labels:
      None

      Description

      It looks like there's an assumption that message label and message direction will always be synonymous.

      I've been trying to create an Axis2 code generation template that would use the value of a message's "messageLabel" attribute in a WSDL2 document. Unfortunately, that value doesn't appear in the Document created by the AxisServiceBasedMultiLanguageEmitter. I looked into this a bit and found that the actual value of the message label is lost in sub-class implementations of the abstract AxisOperation method
      addMessage(AxisMessage, String)
      called by WSDL20ToAxisServiceBuilder.createAxisMessage(). WSDL20ToAxisServiceBuilder.populateOperations exhibits the assumption in the for loop that iterates over the InterfaceMessageReferences.

      If I'm reading the WSDL2 spec right, the message exchange pattern defines the label constraints for its messages. So, it seems like the classification should be based on the message reference's getDirection(). While what's there now may work, it won't if a new MEP is defined. I think getDirection() should work regardless.

      WSDL2's ability to accommodate new MEPs also calls into question Axis2's practice of mapping MEP strings to constant integer values throughout the code. Why not just stick with the MEP strings to support extensibility now?

      1. AxisMessage.patch.txt
        0.8 kB
        Peter Danielsen
      2. AxisServiceBasedMultiLanguageEmitter.patch.txt
        1 kB
        Peter Danielsen
      3. WSDL20ToAxisServiceBuilder.patch.txt
        2 kB
        Peter Danielsen

        Activity

        Peter Danielsen created issue -
        Hide
        Peter Danielsen added a comment -

        Attached are patches that will allow the message label to make it all the way through the codegen process to the Emitter templates.

        AxisMessage - adds a new field "label" with a setter and getter.

        WSDL20ToAxisServiceBuilder - sets the AxisMessage's label and uses
        messageReference.getDirection() to classify a message as input or output, rather than trying to infer it from its label. Relying on the label won't work if a new MEP is introduced that doesn't follow the existing pattern.

        AxisServiceBasedMultiLanguageEmitter - adds "label" attribute to "input" and "output" elements in the Documents provided to the emitter templates.

        Show
        Peter Danielsen added a comment - Attached are patches that will allow the message label to make it all the way through the codegen process to the Emitter templates. AxisMessage - adds a new field "label" with a setter and getter. WSDL20ToAxisServiceBuilder - sets the AxisMessage's label and uses messageReference.getDirection() to classify a message as input or output, rather than trying to infer it from its label. Relying on the label won't work if a new MEP is introduced that doesn't follow the existing pattern. AxisServiceBasedMultiLanguageEmitter - adds "label" attribute to "input" and "output" elements in the Documents provided to the emitter templates.
        Peter Danielsen made changes -
        Field Original Value New Value
        Attachment AxisMessage.patch.txt [ 12359971 ]
        Attachment WSDL20ToAxisServiceBuilder.patch.txt [ 12359972 ]
        Attachment AxisServiceBasedMultiLanguageEmitter.patch.txt [ 12359973 ]
        Davanum Srinivas made changes -
        Assignee Amila Chinthaka Suriarachchi [ amilachinthaka ]
        Hide
        Amila Chinthaka Suriarachchi added a comment -

        is the direction attribute is a manadatory one? can you attach a sample wsdl?
        I am not much familier with the wsdl 2.0 why there are two attributes messageLable and direction if they mean same?

        Show
        Amila Chinthaka Suriarachchi added a comment - is the direction attribute is a manadatory one? can you attach a sample wsdl? I am not much familier with the wsdl 2.0 why there are two attributes messageLable and direction if they mean same?
        Hide
        Amila Chinthaka Suriarachchi added a comment -

        I checked with some wsdl 2.0 documents they contain the messageLabel but not the direction.

        Show
        Amila Chinthaka Suriarachchi added a comment - I checked with some wsdl 2.0 documents they contain the messageLabel but not the direction.
        Hide
        Peter Danielsen added a comment -

        Amila,

        The Interface Message Reference component's "message direction" element information item is set from the element name, rather than an attribute. See
        http://www.w3.org/TR/2007/PR-wsdl20-20070523/#InterfaceMessageReference_Mapping

        "Define the message direction of the element information item to be 'in'
        if its local name is 'input', and 'out' if its local name is 'output'.

        Note that the messageLabel attribute information item of an interface
        message reference element information item must be present if the
        message exchange pattern has more than one placeholder message
        with

        {direction}

        equal to the message direction."

        By having both WSDL2 supports the possibility of a future MEP that has more than one message in either direction.

        In Woden, a message reference's "direction" is set from the name of the
        element: an <input> element has direction = "in", an <output> element has
        direction="out". See org.apache.woden.internal.BaseWSDLReader#parseInterfaceMessageReference

        Hope this helps.

        Peter

        Show
        Peter Danielsen added a comment - Amila, The Interface Message Reference component's "message direction" element information item is set from the element name, rather than an attribute. See http://www.w3.org/TR/2007/PR-wsdl20-20070523/#InterfaceMessageReference_Mapping "Define the message direction of the element information item to be 'in' if its local name is 'input', and 'out' if its local name is 'output'. Note that the messageLabel attribute information item of an interface message reference element information item must be present if the message exchange pattern has more than one placeholder message with {direction} equal to the message direction." By having both WSDL2 supports the possibility of a future MEP that has more than one message in either direction. In Woden, a message reference's "direction" is set from the name of the element: an <input> element has direction = "in", an <output> element has direction="out". See org.apache.woden.internal.BaseWSDLReader#parseInterfaceMessageReference Hope this helps. Peter
        Hide
        Amila Chinthaka Suriarachchi added a comment -

        Keith can you please evaluate this patch and commit it.

        Show
        Amila Chinthaka Suriarachchi added a comment - Keith can you please evaluate this patch and commit it.
        Amila Chinthaka Suriarachchi made changes -
        Assignee Amila Chinthaka Suriarachchi [ amilachinthaka ] Keith Godwin Chapman [ keithgchapman ]
        Davanum Srinivas made changes -
        Fix Version/s 1.3 [ 12312476 ]
        Davanum Srinivas made changes -
        Fix Version/s 1.3 [ 12312476 ]
        Hide
        Ping Liu added a comment -

        Could you provide a sample WSDL? To verify this patch, I guess we have to see how the code generator fails on the sample WSDL first without the patch and then is able to successfully generate code after the patch is applied.

        Show
        Ping Liu added a comment - Could you provide a sample WSDL? To verify this patch, I guess we have to see how the code generator fails on the sample WSDL first without the patch and then is able to successfully generate code after the patch is applied.

          People

          • Assignee:
            Keith Godwin Chapman
            Reporter:
            Peter Danielsen
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development