1

I have a simple string as input and after calling a web service which adds the string to an array.Now i have to assign the array to the output(which i have set as a string array in the schema).The enterprise manager gives a fault and says the result contains multiple nodes for the XPath expression given.The Assign activity is shown as pending.So basically how do i assign an array or a list to the output variable which is also set as an array.The wsdl file used is:

<?xml version = '1.0' encoding = 'UTF-8'?>

<definitions
     name="ReturnTypeService"
     targetNamespace="http://examples2/"
     xmlns="http://schemas.xmlsoap.org/wsdl/"
     xmlns:tns="http://examples2/"
     xmlns:xsd="http://www.w3.org/2001/XMLSchema"
     xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    >
    <types>
        <xsd:schema>
            <xsd:import namespace="http://examples2/" schemaLocation="http://localhost:7101/Examples2-Examples2-context-root/ReturnTypePort?xsd=1"/>
        </xsd:schema>
    </types>
    <message name="display">
        <part name="parameters" element="tns:display"/>
    </message>
    <message name="displayResponse">
        <part name="parameters" element="tns:displayResponse"/>
    </message>
    <portType name="ReturnType">
        <operation name="display">
            <input message="tns:display"/>
            <output name="displayResponse"
            message="tns:displayResponse"/>
        </operation>
    </portType>
    <binding name="ReturnTypePortBinding" type="tns:ReturnType">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
        <operation name="display">
            <soap:operation soapAction=""/>
            <input>
                <soap:body use="literal"/>
            </input>
            <output>
                <soap:body use="literal"/>
            </output>
        </operation>
    </binding>
    <service name="ReturnTypeService">
        <port name="ReturnTypePort" binding="tns:ReturnTypePortBinding">
            <soap:address location="http://localhost:7101/Examples2-Examples2-context-root/ReturnTypePort"/>
        </port>
    </service>
</definitions>

@vanto Is there a way to assign an array from input variable to invoke_input variable?The problem is there are multiple inputs in my web service so i am not able to copy the wrapping element in input variable to wrapping variable in invoke variable.Will copy the snippet of the code here :

<assign name="Assign1">
            <copy>
                <from variable="inputVariable" part="payload"
                      query="/ns2:process/ns2:dsaName"/>
                <to variable="Invoke1_processList_InputVariable"
                    part="parameters" query="/ns1:processList/dsaName"/>
            </copy>
            <copy>
                <from variable="inputVariable" part="payload"
                      query="/ns2:process/ns2:linesOfData"/>
                <to variable="Invoke1_processList_InputVariable"
                    part="parameters" query="/ns1:processList/linesOfData"/>
            </copy>
            <copy>
                <from variable="inputVariable" part="payload"
                      query="/ns2:process/ns2:description"/>
                <to variable="Invoke1_processList_InputVariable"
                    part="parameters" query="/ns1:processList/description"/>
            </copy>
            <copy>
                <from variable="inputVariable" part="payload"
                      query="/ns2:process/ns2:application"/>
                <to variable="Invoke1_processList_InputVariable"
                    part="parameters" query="/ns1:processList/application"/>
            </copy>
        </assign>

The problem is only one is of list type all others are of string type.The XML for this is:

<element name="process">
            <complexType>
                <sequence>
                     <element name="dsaName" type="string" minOccurs="0"/>
                    <element name="linesOfData" type="string" minOccurs="0" maxOccurs="unbounded"/>

                    <element name="description" type="string" minOccurs="0"/>
            </sequence>
    </complexType>
        </element>
    <element name="processResponse">
        <complexType>
            <sequence>
                <element name="result" type="string" minOccurs="0" maxOccurs="unbounded"/>
            </sequence>
        </complexType>
    </element>
</schema>
Tim Post
  • 33,371
  • 15
  • 110
  • 174
user1004779
  • 147
  • 1
  • 3
  • 13

1 Answers1

1

A from-spec and to-spec must not select more than one element or attribute. In your case it appears to select all <return> elements in your variable's part (i.e. the items of the array). Try to copy the element that wraps the items (i.e. the ns1:displayResponse element) and copy this element to ns2:processResponse (the wrapping element in the to-variable).

Since both source and target elements seem to be in different namespaces and are of different types, you probably need to run it through an XSLT script (using doXSLTransform) to translate it from the source schema to the target schema.

vanto
  • 3,134
  • 18
  • 28