Thanks very much for your reply.
With your help, the code is okay now. Thanks
def test_sms10():
#NOTE: method 2:
#1: import a encode
from suds.xsd.doctor import ImportDoctor, Import
d = ImportDoctor(imp)
#1: set the logging
import logging
logging.basicConfig(level=logging.ERROR)
# 3: construt client
client = suds.client.Client(url,doctor=d,cache=None,xstq=False,faults=False)
# step 4: create the header
from suds.sax.element import Element
from suds.sax.attribute import Attribute
code = Element('serviceCode').setText('PABB4BEIJING')
pwd = Element('servicePwd').setText('QWERTPABB')
header_list = [code, pwd]
# 1
# use insert: it's okay
#reqsoapheader = Element('ReqSOAPHeader').insert(code)
#reqsoapheader.insert(code)
# use child:¡¡okay
reqsoapheader = Element('ReqSOAPHeader')
reqsoapheader.children=[code,pwd]
reqsoap_attribute3 = Attribute('mustUnderstand', "0")
reqsoapheader.append(reqsoap_attribute)
reqsoapheader.append(reqsoap_attribute2)
reqsoapheader.append(reqsoap_attribute3)
client.set_options(soapheaders=reqsoapheader)
# setp 5: provide the parameters
item1 = "{'msgid':'1234567890','bizcode':'15140237310','serviceId':'1234567','recomobile':'15110791945','sendtime':'1322573860','content':'hi, this is just a test. you can ignore it. --jiaxiaolei'}"
item2 = "{'msgid':'1234567891','bizcode':'15140237310','serviceId':'1234567','recomobile':'15110791946','sendtime':'1322573870','content':'hi, this is just a test. you can ignore it. --jiaxiaolei'}"
req = [item1, item2]
aoss = client.factory.create('ArrayOf_soapenc_string')
aoss.item = req
print 'client', client
output = client.service.sendMt(aoss)
print 'SOAP Request:\n', client.last_sent(), '\n'
print 'SOAP Response:\n', client.last_received(), '\n'
print 'the return: \n', output, '\n'
SOAP Request:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Header>
<serviceCode>PABB4BEIJING</serviceCode>
<servicePwd>QWERTPABB</servicePwd>
</ReqSOAPHeader>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<ns0:sendMt>
<mtInfo xsi:type="ArrayOf_soapenc_string">
<item xsi:type="ns1:string">{'msgid':'1234567890','bizcode':'15140237310','serviceId':'1234567','recomobile':'15110791945','sendtime':'1322573860','content':'hi, this is just a test. you can ignore it. --jiaxiaolei'}</item>
<item xsi:type="ns1:string">{'msgid':'1234567891','bizcode':'15140237310','serviceId':'1234567','recomobile':'15110791946','sendtime':'1322573870','content':'hi, this is just a test. you can ignore it. --jiaxiaolei'}</item>
</mtInfo>
</ns0:sendMt>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
In actual fact, "you just forgot to add the servicePwd element to the ReqSOAPHeader element."
, i had try to add pwd in the code as follows, but failed.