VMware Cloud Community
ChristianWehner
VMware Employee
VMware Employee
Jump to solution

Unable to setInParameter multiple times on SOAP:Request

Hi there,

we have a problem, sending a SOAP:Request to one of our applications. The application requires one parameter multiple times:

<clit:executeCommandByParamList>

     <clit:nameSpace>NSHScriptJob</clit:nameSpace>

     <clit:commandName>addNSHScriptParameterValueByGroupAndName</clit:commandName>

     <clit:commandArguments>/Test_AZ</clit:commandArguments>

     <clit:commandArguments>proptest</clit:commandArguments>

     <clit:commandArguments>0</clit:commandArguments>

     <clit:commandArguments>testvalue</clit:commandArguments>

</clit:executeCommandByParamList>

If I set the input parameter with function setInParameter, only the last commandArguments parameter will be used. It seems, if I set the parameter multiple times, the parameter will be over written.

for each(var commandArgument in commandArguments)

{

     request.setInParameter("commandArguments", commandArgument);

}

Does anyone have an idea about to fix this?

Regards,

Chris

0 Kudos
1 Solution

Accepted Solutions
ChristianWehner
VMware Employee
VMware Employee
Jump to solution

OK got it.

To set the parameter multiple times we have to:

for(var i in commandArguments) 

     request.setInParameter("commandArguments[" + i + "]", commandArguments[i]); 

}

which is working.

View solution in original post

0 Kudos
3 Replies
iiliev
VMware Employee
VMware Employee
Jump to solution

Hi Chris,

Could you show the WSDL file? What is the type of 'commandArguments' parameter? If it is an array, could you try to pass it as a whole single value instead of iterating over its elements?

request.setInParameter("commandArguments", commandArguments);

-Ilian

ChristianWehner
VMware Employee
VMware Employee
Jump to solution

Hi Ilian,

yes it is an array. But if I use an array, it is not working. This is, what the request is looking on presenting an Array/string:

<clit:commandArguments>[Ljava.lang.Object;@5fef6b0d</clit:commandArguments>

It looks like he is using the array object as string.. :smileyconfused:

This is what the SOAP adapter requests:

commandArguments.PNG

And the WSDL part:

<xs:element name="executeCommandByParamListAndAttachment">

            <xs:complexType>

               <xs:sequence>

                  <xs:element minOccurs="0" name="nameSpace" nillable="true" type="xs:string"/>

                  <xs:element minOccurs="0" name="commandName" nillable="true" type="xs:string"/>

                  <xs:element maxOccurs="unbounded" minOccurs="0" name="commandArguments" nillable="true" type="xs:string"/>

                  <xs:element minOccurs="0" name="dh" nillable="true" type="xs:base64Binary"/>

               </xs:sequence>

            </xs:complexType>

         </xs:element>

Regards,

Chris

0 Kudos
ChristianWehner
VMware Employee
VMware Employee
Jump to solution

OK got it.

To set the parameter multiple times we have to:

for(var i in commandArguments) 

     request.setInParameter("commandArguments[" + i + "]", commandArguments[i]); 

}

which is working.

0 Kudos