Announcement Announcement Module
Collapse
No announcement yet.
DynamicWsdl11Definition doesn't recognize shared response output Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • DynamicWsdl11Definition doesn't recognize shared response output

    I have a statically defined WSDL that I was trying to move to DynamicWsdl11Definition. There is a problem doing this however. The current WSDL defines several operations with unique input messages that share the same output message. Does DynamicWsdl11Definition only work for XSD that follow the convention of having a 1-to-1 matching between ...Input and ...Output definitions?

    For example, the schema has:
    Code:
        <xs:element name="GetWidgetsByDepartmentRequest">
            <xs:complexType>
                <xs:sequence>
                    <xs:element name="departmentId" type="xs:long"/>
                </xs:sequence>
            </xs:complexType>
        </xs:element>
        <!-- *** Get widgets by Id *** -->
        <xs:element name="GetWidgetsByIdRequest">
            <xs:complexType>
                <xs:sequence>
                    <xs:element name="widgetId" type="xs:long" maxOccurs="unbounded"/>
                </xs:sequence>
            </xs:complexType>
        </xs:element>
        <!-- *** Get widgets by Keyword *** -->
        <xs:element name="GetWidgetsByKeywordRequest">
            <xs:complexType>
                <xs:sequence>
                    <xs:element name="departmentId" type="xs:long"/>
                    <xs:element name="keyword" type="xs:string" maxOccurs="unbounded"/>
                </xs:sequence>
            </xs:complexType>
        </xs:element>
        <xs:element name="GetWidgetsResponse">
            <xs:complexType>
                <xs:sequence>
                    <xs:element name="widgets" type="zt:Widgets"/>
                </xs:sequence>
            </xs:complexType>
        </xs:element>
    In the statically-defined WSDL, the corresponding operations are:
    Code:
        <portType name="AnyOldPortType">
            <operation name="GetWidgetsByDepartment">
                <input message="tns:GetWidgetsByDepartmentInput"/>
                <output message="tns:GetWidgetsOutput"/>
            </operation>
            <operation name="GetWidgetsById">
                <input message="tns:GetWidgetsByIdInput"/>
                <output message="tns:GetWidgetsOutput"/>
            </operation>
            <operation name="GetWidgetsByKeyword">
                <input message="tns:GetWidgetsByKeywordInput"/>
                <output message="tns:GetWidgetsOutput"/>
            </operation>
        </portType>
    But the WSDL generated by the DynamicWsdl11Definition class looks like:
    Code:
      <wsdl:portType name="AnyOldService">
        <wsdl:operation name="GetWidgetsByKeyword">
          <wsdl:input message="tns:GetWidgetsByKeywordRequest" name="GetWidgetsByKeywordRequest">
        </wsdl:input>
        </wsdl:operation>
        <wsdl:operation name="GetWidgetsById">
          <wsdl:input message="tns:GetWidgetsByIdRequest" name="GetWidgetsByIdRequest">
        </wsdl:input>
        </wsdl:operation>
        <wsdl:operation name="GetWidgetsByDepartment">
          <wsdl:input message="tns:GetWidgetsByDepartmentRequest" name="GetWidgetsByDepartmentRequest">
        </wsdl:input>
        </wsdl:operation>
      </wsdl:portType>
    The same pattern presents itself in the binding section of the dynamic WSDL as well.

    To sum up:
    The static WSDL works for the case above as well as for operations that I've defined having matching Input and Output operations.
    The dynamically-generated WSDL works for the operations having matching Input and Output declarations but not for the case I've outlined above.

    Actually, the Flex application I'm working on does read the dynamic WSDL and formulate a good request. It receives the SOAP response, but since there is no Output declaration in its WSDL, it doesn't know what to do with the response. Sadly I can see the full SOAP response in the Flex debugger, but Flex does not know how to demarshall it into AS3 objects.

    Changing the webservice to have multiple, specific Output definitions would lead to a lot of code changes. Is there any way around this so that I can maintain one response layout while triggering it from multiple request types?
    Last edited by psconnolly; Feb 27th, 2008, 06:47 PM.

  • #2
    Solved: DynamicWsdl11Definition doesn't recognize shared response output

    After the ... ahem ... overwhelming response to this query, I dug a little deeper into the SWS source. The class--DynamicWsdl11Definition--uses a builder/helper class called XsdBasedSoap11Wsdl4jDefinitionBuilder:
    Code:
    public class XsdBasedSoap11Wsdl4jDefinitionBuilder
    extends AbstractSoap11Wsdl4jDefinitionBuilder
    implements InitializingBean
    
    Builds a WsdlDefinition with a SOAP 1.1 binding based on an XSD schema. 
    This builder iterates over all elements found in the schema, and creates a 
    message for those elements that end with the request or response suffix. It 
    combines these messages into operations, and builds a portType based on the 
    operations.
    So, yes, the DynamicWsdl11Definition class expects matching pairs of ...Request and ...Response elements
    to build the message portion of the WSDL. And, no, unless I'm willing to extend that class, I can't share one
    response layout between multiple request layouts.

    Comment

    Working...
    X