complex sequence SOAP service parameter

xiaofeng xiong xiaofengsmile at gmail.com
Thu Mar 26 07:51:47 EDT 2009


Hi there,
Please help me out.
I want to use a SOAP web service. According to the wsdl, I need to pass a
parameter of complex type, which contains a sequence.
The parameter part of the wsdl is :
{{{
  <xsd:element name="getReport">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element maxOccurs="1" minOccurs="1" nillable="true"
type="xsd:string" name="username"/>
        <xsd:element maxOccurs="1" minOccurs="1" nillable="true"
type="xsd:string" name="password"/>
        <xsd:element maxOccurs="1" minOccurs="1" nillable="true"
type="tns:ArrayOfReportParameter" name="report_parameter_list"/>
     </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
  <xsd:complexType name="ArrayOfReportParameter">
    <xsd:sequence>
      <xsd:element maxOccurs="unbounded" minOccurs="0" nillable="true"
type="tns:Parameter" name="Parameter"/>
    </xsd:sequence>
  </xsd:complexType>
  <xsd:complexType name="Parameter">
    <xsd:sequence>
      <xsd:element type="xsd:string" name="name"/>
      <xsd:element type="xsd:string" name="value"/>
    </xsd:sequence>
  </xsd:complexType>
}}}
This is part of a sample request:
{{{
<getReport>
  <username>cinderella</rep:username>
  <password>123456</rep:password>
  <report_parameter_list>
 <Parameter>
   <name>start_date<name>
   <value>2009-01-01 00:00:00.000<value>
 <Parameter>
 <Parameter>
   <name>end_date<name>
   <value>2009-02-10 00:00:02.999<value>
 <Parameter>
</report_parameter_list>
</getReport>
}}}

I already know I can pass in username and password in this way :
{{{
remoteService.getReport(username='hello', passowrd='123')
}}}
I really don't know how to pass in the parameter 'report_parameter_list'
with python. If there is only ONE  'Parameter', then It's ok that I use it
in this way
{{{
parameter_list = {'Parameter': {'name': 'start_date', 'value': '2009-01-01
00:00:00.000'}}
remoteService.getReport(username='hello', password='123',
report_parameter_list=parameter_list)
}}}
If The 'Parameter' are more than one, then I don't know how to do :(
I tried to put them in a list like this:
{{{
parameter_list = [{'Parameter': {'name': 'start_date', 'value': '2009-01-01
00:00:00.000'}}, {'Parameter': {'name': 'end_date', 'value': '2009-01-11
00:00:00.000'}}]
remoteService.getReport(username='hello', password='123',
report_parameter_list=parameter_list)
}}}
(I use SOAPpy.buildSOAP to build the soap request)
then there will be a <item> around the <Paramter> in the request, like this:
{{{
<getReport>
  <username>cinderella</rep:username>
  <password>123456</rep:password>
  <report_parameter_list>
 <item>
 <Parameter>
   <name>start_date<name>
   <value>2009-01-01 00:00:00.000<value>
 <Parameter>
 </item>
 <item>
 <Parameter>
   <name>end_date<name>
   <value>2009-02-10 00:00:02.999<value>
 <Parameter>
 </item>
</report_parameter_list>
</getReport>
}}}
then, my question is : what parameter should I pass in? Is there any way to
use this SOAP service properly?
Thanks for your time!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090326/3e1a1d9d/attachment.html>


More information about the Python-list mailing list