Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I pass a list parameter as multiple link-named elements instead of as an array in SOAPpy?
    text
    copied!<p>I am trying to pass multiple instances of an element to a web servile that has the following wsdl</p> <pre><code> &lt;complexType name="OAMCommand"&gt; &lt;sequence&gt; &lt;element name="m-strName" type="xsd:string" minOccurs="1" maxOccurs="1"/&gt; &lt;element name="m-argVector" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/&gt; &lt;/sequence&gt; &lt;/complexType&gt; </code></pre> <p>This is my code in python for the client</p> <pre><code> oamCmdStruct = SOAPpy.structType() oamCmdStruct._addItem('m-strName','set-log-level') oamCmdStruct._addItem('m-argVector', logLevel) oamCmdStruct._addItem('m-argVector', loggerName) self.serverConnection.executeCommand({'in-cmd':oamCmdStruct} </code></pre> <p>Here is the output I get from SOAPpy that gets rejected by the web service, it creates an array for the 2 m-argVector elements.</p> <pre><code>&lt;xsd:in-cmd&gt; &lt;m-strName xsi:type="xsd:string"&gt;set-log-level&lt;/m-strName&gt; &lt;m-argVector SOAP-ENC:arrayType="xsd:string[2]" xsi:type="SOAP-ENC:Array"&gt; &lt;item&gt;WARN_LOG_LEVEL&lt;/item&gt; &lt;item&gt;netborder&lt;/item&gt; &lt;/m-argVector&gt; &lt;/xsd:in-cmd&gt; </code></pre> <p>Here is the output that another client sends that works. No array, just two elements that have the same name.</p> <pre><code> &lt;SoapOAM:executeCommand&gt; &lt;in-cmd&gt; &lt;m-strName&gt;set-log-level&lt;/m-strName&gt; &lt;m-argVector&gt;ERROR_LOG_LEVEL&lt;/m-argVector&gt; &lt;m-argVector&gt;netborder.media&lt;/m-argVector&gt; &lt;/in-cmd&gt; &lt;/SoapOAM:executeCommand&gt; </code></pre> <p>How can I modify my SOAPpy code to generate the xml output like the one above ?</p> <p>EDIT: I tried the following code in python</p> <pre><code> oamCmdStruct = SOAPpy.structType( data = {"m-strName":"set-log-level", "m-argVector": logLevel, "m-argVector": loggerName}) </code></pre> <p>But this is what the XML output from SOAPpy looked like</p> <pre><code>&lt;xsd:in-cmd&gt; &lt;m-strName xsi:type="xsd:string"&gt;set-log-level&lt;/m-strName&gt; &lt;m-argVector xsi:type="xsd:string"&gt;loggerName&lt;/m-argVector&gt; &lt;/xsd:in-cmd&gt; </code></pre> <p>The value for logLevel gets overwritten by loggerName instead of creating 2 entries...</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload