[Soap-Python] Exception in soap call

贾晓磊 jiaxiaolei19871112 at gmail.com
Tue Nov 29 04:25:29 CET 2011


2011/11/26 贾晓磊 <jiaxiaolei19871112 at gmail.com>

> thanks, i will try it later.
> thanks!
>
>
Hi, Veres:

Sorry to interrupt you. do you still member the question last Friday.

In fact , I tried webservice client in WSDL, SOAPpy, and Suds, while, all
is failed.

Now, I descript the question in detail, and if possible and time is rich,
wish you can give me some extra points about the question:



First of all, I will admire I am a novice to web service.

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"
Traceback (most recent call last):
  File "suds_client.py", line 124, in <module>
    test_sms2()
  File "suds_client.py", line 99, in test_sms2
    output = client.service.sendMt(a)
  File
"/usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.py",
line 535,

in __call__
    return client.invoke(args, kwargs)
  File
"/usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.py",
line 595,

in invoke
    result = self.send(msg)
  File
"/usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.py",
line 630,

in send
    result = self.failed(binding, e)
  File
"/usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.py",
line 681,

in failed
    r, p = binding.get_fault(reply)
  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''


#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).
3: the problem has puzzled me for nearly a week, please someone can give me
some points.


# besides the suds, i try other methods as follows, whlie, still failed.

method 2:

from SOAPpy import SOAPProxy
def test_sms():
    """test for ln sms java webservice
    """
    #TODO:invoke sms is stil failed
    url = "
http://211.137.45.104:9006/LnXxtCpInterface/services/LNXxtSyncService"
    server = SOAPProxy(url)
    args = ['jia','xiao']
    print server.sendMt(args)


# output:
w_jiaxiaolei at drone-009:~/tornadows-0.9.1/demos$ python  soappy_client.py
Traceback (most recent call last):
  File "soappy_client.py", line 59, in <module>
    test_sms()
  File "soappy_client.py", line 31, in test_sms
    print server.sendMt(args)
  File "/usr/lib/pymodules/python2.6/SOAPpy/Client.py", line 470, in
__call__
    return self.__r_call(*args, **kw)
  File "/usr/lib/pymodules/python2.6/SOAPpy/Client.py", line 492, in
__r_call
    self.__hd, self.__ma)
  File "/usr/lib/pymodules/python2.6/SOAPpy/Client.py", line 406, in __call
    raise p
SOAPpy.Types.faultType: <Fault soapenv:Server.generalException: :
<SOAPpy.Types.structType

detail at 26709888>: {'fault': <SOAPpy.Types.structType multiRef at
26707800>: {'text':

'SoapHeader is null', 'messageId': 'SEV_0003'}, 'exceptionName':

'xxt.protocol.obj.v1_0.common.ServiceException', 'hostname': 'ln_xxt_mh01'}>


method 3:

from SOAPpy import WSDL

def test_sms():
    """for sms
    """
     url = "
http://211.137.45.104:9006/LnXxtCpInterface/services/LNXxtSyncService?wsdl"
    server = WSDL.Proxy(url)
    #print 'methods:',server.methods.keys()
    #print 'input type:',server.methods['sendMt'].inparams[0].type
    #print 'input name:',server.methods['sendMt'].inparams[0].name
    #print 'output type:',server.methods['sendMt'].outparams[0].type
    #print 'output name:',server.methods['sendMt'].outparams[0].name
    a = ['jia','xiao']
    results=server.sendMt(a)
    print results

# output:
w_jiaxiaolei at drone-009:~/tornadows-0.9.1/demos$ python  wsdl_client.py
/usr/lib/pymodules/python2.6/SOAPpy/wstools/XMLSchema.py:2871:
DeprecationWarning:

object.__init__() takes no parameters
  tuple.__init__(self, args)
Traceback (most recent call last):
  File "wsdl_client.py", line 48, in <module>
    test_sms()
  File "wsdl_client.py", line 41, in test_sms
    results=server.sendMt(a)
  File "/usr/lib/pymodules/python2.6/SOAPpy/Client.py", line 470, in
__call__
    return self.__r_call(*args, **kw)
  File "/usr/lib/pymodules/python2.6/SOAPpy/Client.py", line 492, in
__r_call
    self.__hd, self.__ma)
  File "/usr/lib/pymodules/python2.6/SOAPpy/Client.py", line 406, in __call
    raise p
SOAPpy.Types.faultType: <Fault soapenv:Server.generalException: :
<SOAPpy.Types.structType

detail at 31753352>: {'fault': <SOAPpy.Types.structType multiRef at
31753280>: {'text':

'SoapHeader is null', 'messageId': 'SEV_0003'}, 'exceptionName':

'xxt.protocol.obj.v1_0.common.ServiceException', 'hostname': 'ln_xxt_mh01'}>


-- Jia Xiaolei
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/soap/attachments/20111129/ea3c058c/attachment-0001.html>


More information about the Soap mailing list