very appreciate for your advices. maybe the kernel problem is the
complexType ArrayOf_soapenc_string.

part 1: how do you think the xml in the url:

<complexType name="ArrayOf_soapenc_string">
<complexContent>
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]"/>
</restriction>
</complexContent>
</complexType>

part 2: in fact, the server is made by Axis, which is a web service
framework in Java.
Before i develop the client, there already have a java client for the
server.
the code  are below:

if (temp.length % MTINFO_LENGTH != 0) {
String[] remainBlock = new String[temp.length - jMark];
for (int i = 0; i < remainBlock.length; i++) {
remainBlock[i] = temp[jMark];
jMark++;
}

mark = lnxss.sendMt(remainBlock);

After read the code,  we know that the the inparams of sendMt is String[].
In fact, the purpose of senMt() is to send some shotmessage to a mobile
phone. you can find remobile in the parameters.

part 3: Besides, the server has some check, which i have add it in the
newest code.

servicecode: PABB4BEIJING
passwd: QWERTPABB
namespace: service.global.v1_0.wsdl.protocol.xxt (you can see it in the url)

I have tried  to add the service code and passwd in the code.
 while,  what  still puzzled me is that in suds, how to add the namespace
to the client.
how to use the ArrayOf_soapen_string is a problem. in my code, i provide a
list which contains some string. in my view, i should provide a object like
your code,
aoss = client.factory.create('ArrayOf_soapen_string')
then, what should i do next?  how to assign a value for the parameter of
aoss?

part 4:

# the newest code :
import suds
def test_sms4():
    import logging
    logging.basicConfig(level=logging.ERROR)
    url = "
http://211.137.45.104:9006/LnXxtCpInterface/services/LNXxtSyncService?wsdl";
    from suds.transport.https import HttpAuthenticated
    credentials = dict(username='PABB4BEIJING', password='QWERTPABB')
    t = HttpAuthenticated(**credentials)
    client =
suds.client.Client(url,transport=t,cache=None,xstq=False,faults=False)
    #client = suds.client.Client(url,cache=None,xstq=False)
    aoss = client.factory.create('ArrayOf_soapenc_string')
    #client.set_options(namespace='service.global.v1_0.wsdl.protocol.xxt')
    print 'client', client
    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]

    #client.service.sendMt(aoss)
    output = client.service.sendMt(mtinfo=req)
    print 'output', output



# output:

w_jiaxiaolei@drone-009:~/tornadows-0.9.1/demos$ python suds_client.py
client
Suds ( https://fedorahosted.org/suds/ )  version: 0.3.7 GA  build:
R580-20091016

Service ( LNXxtSyncServiceService )
tns="service.global.v1_0.wsdl.protocol.xxt"
   Prefixes (3)
      ns0 = "http://common.v1_0.obj.protocol.xxt";
      ns1 = "http://schemas.xmlsoap.org/soap/encoding/";
      ns2 = "service.global.v1_0.wsdl.protocol.xxt"
   Ports (1):
      (LNXxtSyncService)
         Methods (5):
            sendMo(ArrayOf_soapenc_string moInfo, )
            sendMt(ArrayOf_soapenc_string mtInfo, )
            syncCorp(ArrayOf_tns2_GroupOrderInfo orderInfo, )
            syncResponseRpt(ArrayOf_soapenc_string rpt, )
            syncStaff(ArrayOf_tns2_UserOrderInfo orderInfo, )
         Types (54):
            ns1:Array
            ArrayOf_soapenc_string
            ArrayOf_tns2_GroupOrderInfo
            ArrayOf_tns2_UserOrderInfo
            ...

ERROR:suds.client:<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:ns0="service.global.v1_0.wsdl.protocol.xxt"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"; xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"; xmlns:SOAP-ENV="
http://schemas.xmlsoap.org/soap/envelope/"; SOAP-ENV:encodingStyle="
http://schemas.xmlsoap.org/soap/encoding/";>
   <SOAP-ENV:Header/>
   <SOAP-ENV:Body>
      <ns0:sendMt>
         <mtInfo xsi:type="ArrayOf_soapenc_string"/>
      </ns0:sendMt>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
output (500, (detail){
   fault =
      (fault){
         _href = "#id0"
      }
   exceptionName = "xxt.protocol.obj.v1_0.common.ServiceException"
   hostname = "ln_xxt_mh01"
 })


-- jiaxiaolei



On Tue, Nov 29, 2011 at 2:58 PM, Dieter Maurer <[email protected]> wrote:

> ??? wrote at 2011-11-29 11:04 +0800:
> > ...
> >What I need now is to invoke a method  sendMt provided by the web service
> >server(prehaps the server is made by java language using a framwork named
> >Axis).
> >
> >I try to invoke the sendMt method provided by the server, then failded.
> >There are the tests as follows:
> >
> >method 1:
> >
> >import suds
> >
> >def test_sms():
> >    #TODO: it's failed
> >    url = "
> >
> http://211.137.45.104:9006/LnXxtCpInterface/services/LNXxtSyncService?wsdl
> "
> >    #client = suds.client.Client(url,faults=False)
> >    client = suds.client.Client(url)
> >    print 'client', client
> >    a = ['jia','xiao']
> >    output = client.service.sendMt(a)
> >    print 'output', output
> >
> >
> ># the output:
> >
> >client
> >Suds ( https://fedorahosted.org/suds/ )  version: 0.3.7 GA  build:
> >R580-20091016
> >
> >Service ( LNXxtSyncServiceService )
> >tns="service.global.v1_0.wsdl.protocol.xxt"
> >   Prefixes (3)
> >      ns0 = "http://common.v1_0.obj.protocol.xxt";
> >      ns1 = "http://schemas.xmlsoap.org/soap/encoding/";
> >      ns2 = "service.global.v1_0.wsdl.protocol.xxt"
> >   Ports (1):
> >      (LNXxtSyncService)
> >         Methods (5):
> >            sendMo(ArrayOf_soapenc_string moInfo, )
> >            sendMt(ArrayOf_soapenc_string mtInfo, )
> >            syncCorp(ArrayOf_tns2_GroupOrderInfo orderInfo, )
> >            syncResponseRpt(ArrayOf_soapenc_string rpt, )
> >            syncStaff(ArrayOf_tns2_UserOrderInfo orderInfo, )
> >         Types (54):
> >            ns1:Array
> >            ArrayOf_soapenc_string
> >            ArrayOf_tns2_GroupOrderInfo
> >            ArrayOf_tns2_UserOrderInfo
> >            ns1:ENTITIES
> >            ns1:ENTITY
> >            ...
> >No handlers could be found for logger "suds.client"
>
> You could avoid this warning message by initializing Python's logging.
> This would give you in addition a log entry for the response, I think.
>
> Logging initialization could be performed, e.g., by
>
> from logging import INFO, basicConfig
> basicConfig(level=INFO)
>
> >Traceback (most recent call last):
> >  File "suds_client.py", line 124, in <module>
> > ...
> >  File
>
> >"/usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/bindings/binding.py",
> >
> >line 235, in get_fault
> >    raise WebFault(p, faultroot)
> >suds.WebFault: Server raised fault: 'No such operation 'sendMt''
>
> This looks as if something where wrong on the server side.
>
> While the WSDL apparently lists a "sendMt" method, the server seems not
> to know about it.
>
>
> At your place, I would activate "suds.client" logging (the "suds"
> documentation tells you how) and carefully check the SOAP messages
> sent and received.
>
>
> Maybe, only the server message is misleading. "sendMt" might be known
> but its parameters might be unexpected ("Java" tends to bind functions
> and their signature and may tell "I do not know this function" when
> it means "I do not know this function with this signature").
>
> With respect to the parameters, you are using "suds" slightly non standard.
> The WSDL tells you that "sendMT" expects an "ArrayOf_soapenc_string"
> parameter. However, you are passing a list. "suds" will try to
> convert but it may do something wrong.
> The "standard" way is to construct the parameters of the correct type
> using the client's "factory" and pass these.
>
> > ...
> >#Note:
> >1: the url "
> >
> http://211.137.45.104:9006/LnXxtCpInterface/services/LNXxtSyncService?wsdl
> "
> >is develped in Internet, anyone can use it.
> >2: in my view, the server is made by java Axis, and the inparams of sendmt
> >is ArrayOf_soapenc_string(In java, it means a array of String, in python,
> >it means a list whose items are string).
>
> It may be necessary to encapsulate the "list of strings" in
> an explicite "ArrayOf_soapenc_string". In fact, I expect that this is
> indeed necessary.
>
> >3: the problem has puzzled me for nearly a week, please someone can give
> me
> >some points.
>
>
>
> --
> Dieter
>



-- 
NAME: 贾晓磊/Jia Xiaolei
MOBILE: 13011292217
QQ: 281304051
MICRO-BLOG:  http://weibo.com/2183890715
GMAIL: [email protected] <gmail%[email protected]>
_______________________________________________
Soap mailing list
[email protected]
http://mail.python.org/mailman/listinfo/soap

Reply via email to