title: Sending the same type multiple times in a SOAP request using suds
body: <p>I am writing a SOAP client using the <code>suds</code> python library. The service that I am using does not provide a WSDL file, so I have to write one by hand. I am trying to make a request which accepts a variable number of  types as parameters. </p>
  
  <p>Currently, I have the following for the method in the WSDL:</p>
  
  <pre><code>  &lt;wsdl:message name="get_usertagRequest"&gt;
      &lt;wsdl:part name="email" type="xsd:string"
                 minOccurs="1" maxOccurs="1"/&gt;
      &lt;wsdl:part name="tag" type="xsd:string"
                 minOccurs="0" maxOccurs="unbounded"/&gt;
    &lt;/wsdl:message&gt;
  </code></pre>
  
  <p>I am able to call this with a single tag parameter with the following code:</p>
  
  <pre><code>client = Client(url)
  service = client.service['debian.org']
  foo = service.get_usertag('someone@debian.org', tag='malloc')
  </code></pre>
  
  <p>This produces a request that looks like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;SOAP-ENV:Envelope xmlns:ns3="urn:Debbugs/SOAP" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.w3.org/2001/XMLSchema" xmlns:ns2="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns4="urn:Debbugs/SOAP/TYPES" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"&gt;
     &lt;SOAP-ENV:Header/&gt;
     &lt;ns0:Body&gt;
        &lt;ns3:get_usertag&gt;
           &lt;email xsi:type="ns1:string"&gt;someone@debian.org&lt;/email&gt;
           &lt;tag xsi:type="ns4:string"&gt;malloc&lt;/tag&gt;
        &lt;/ns3:get_usertag&gt;
     &lt;/ns0:Body&gt;
  &lt;/SOAP-ENV:Envelope&gt;
  </code></pre>
  
  <p>How can I modify my code or WSDL to produce a request that looks like the following?</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;SOAP-ENV:Envelope xmlns:ns3="urn:Debbugs/SOAP" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.w3.org/2001/XMLSchema" xmlns:ns2="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns4="urn:Debbugs/SOAP/TYPES" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"&gt;
     &lt;SOAP-ENV:Header/&gt;
     &lt;ns0:Body&gt;
        &lt;ns3:get_usertag&gt;
           &lt;email xsi:type="ns1:string"&gt;someone@debian.org&lt;/email&gt;
           &lt;tag xsi:type="ns4:string"&gt;malloc&lt;/tag&gt;
           &lt;tag xsi:type="ns4:string"&gt;anothertag&lt;/tag&gt;
        &lt;/ns3:get_usertag&gt;
     &lt;/ns0:Body&gt;
  &lt;/SOAP-ENV:Envelope&gt;
  </code></pre>
  
  <p><strong>Updated Attempts</strong></p>
  
  <p>I tried new approaches based on herry's answer below. Inserting his suggestion directly into the <code>wsdl</code> results in a failure to parse the wsdl:</p>
  
  <pre><code>&lt;xsd:schema targetNamespace="ns6:your_namespace" attributeFormDefault="qualified" elementFormDefault="qualified"&gt;
      &lt;xsd:element name="tag_list"&gt;
          &lt;xsd:complexType&gt;
              &lt;xsd:sequence&gt;
                  &lt;xsd:element maxOccurs="unbounded" minOccurs="0" name="tag" nillable="true" type="ns4:string" /&gt;
              &lt;/xsd:sequence&gt;
          &lt;/xsd:complexType&gt;
      &lt;/xsd:element&gt;
  &lt;/xsd:schema&gt;
  </code></pre>
  
  <p>Suds throws the exception: <code>Exception: prefix (ns6) not resolved</code></p>
  
  <p>I tried adding the <code>element</code> and <code>complexType</code> definition to my existing types namespace:</p>
  
  <pre><code>  &lt;wsdl:types&gt;
      &lt;schema targetNamespace="urn:Debbugs/SOAP/TYPES"
          xmlns="http://www.w3.org/2001/XMLSchema"&gt;
        &lt;import namespace="http://schemas.xmlsoap.org/soap/encoding/"/&gt;
         &lt;element name="tag_list"&gt;
           &lt;complexType&gt;
             &lt;sequence&gt;
               &lt;element maxOccurs="unbounded" minOccurs="0" name="tag" nillable="true" type="xsd:string" /&gt;
             &lt;/sequence&gt;
           &lt;/complexType&gt;
         &lt;/element&gt;
  </code></pre>
  
  <p>--snip--</p>
  
  <pre><code>  &lt;wsdl:message name="get_usertagRequest"&gt;
      &lt;wsdl:part name="email" type="xsd:string"
                 minOccurs="1" maxOccurs="1"/&gt;
      &lt;wsdl:part name="tag" element="types:tag_list"
                 minOccurs="0" maxOccurs="unbounded"/&gt;
  </code></pre>
  
  <p>This resulted in the following request:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;SOAP-ENV:Envelope xmlns:ns3="urn:Debbugs/SOAP" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.w3.org/2001/XMLSchema" xmlns:ns2="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns4="urn:Debbugs/SOAP/TYPES" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"&gt;
     &lt;SOAP-ENV:Header/&gt;
     &lt;ns0:Body&gt;
        &lt;ns3:get_usertag&gt;
           &lt;email xsi:type="ns1:string"&gt;someone@debian.org&lt;/email&gt;
           &lt;tag_list xsi:type="ns4:tag_list"&gt;malloc&lt;/tag_list&gt;
        &lt;/ns3:get_usertag&gt;
     &lt;/ns0:Body&gt;
  &lt;/SOAP-ENV:Envelope&gt;
  </code></pre>
  
  <p>Since it changed the type, a fault was returned from the server:</p>
  
  <pre><code>suds.WebFault: Server raised fault: 'Application failed during request deserialization: Unrecognized type '{urn:Debbugs/SOAP/TYPES}tag_list'
  </code></pre>
  
  <p>Even without the fault, I am unable to get <code>suds</code> to send the same tag twice. With the updated <code>wsdl</code>:</p>
  
  <pre><code># only malloc is sent in the request
  foo = service.get_usertag('someone@debian.org', 'malloc', 'foo')
  
  # results in suds.TypeNotFound: Type not found: 'tag_list'
  foo = service.get_usertag('someone@debian.org', ['malloc', 'foo'])
  </code></pre>
  
  <p>The full wsdl that I am currently working with can be found <a href="http://paste.debian.net/76084/" rel="nofollow">here</a>.</p>