The Artima Developer Community
Sponsored Link

Python Answers Forum
problem in calling web service

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
abc def

Posts: 2
Nickname: mareeinaa
Registered: Jul, 2006

problem in calling web service Posted: Jul 19, 2006 5:30 AM
Reply to this message Reply
Advertisement
I have written this simple web service in java

public class MyService {
public String myMethod(String val){
return val;
}

public String myName(String val){
return "ABC" ;
}
}

i have written Python client to access this web service as follows

-----------------------------------------------------------
WebService Try.py
-----------------------------------------------------------

from ZSI import ServiceProxy
import sys
import ZSI
from ZSI.wstools import WSDLTools

fname = 'C:/myWebService.wsdl'
reader = WSDLTools.WSDLReader()
wsdl = reader.loadFromFile(fname)
print wsdl

url = wsdl

service = ServiceProxy(url)
print "Service is : ",service
print service.__dict__

print 'Before Value'
value = service.myMethod('Aditi')
print 'After Value'

print value
-----------------------------------------------------------

After running command

>python webServiceTry.py

I am getting following output/error

-----------------------------------------------------------
<Z SI.wstools.WSDLTools.WSDL instance at 0x009D7C38>

Service is : <ZSI.ServiceProxy.ServiceProxy instance at 0x00CBC6C0>

{'_wsdl': <ZSI.wstools.WSDLTools.WSDL instance at 0x009D7C38>,
'_tracefile': None,
'myName': <ZSI.ServiceProxy.MethodProxy instance at 0x00CBC828>,
'_port': <ZSI.wstools.WSDLTools.Port instance at 0x0 0CBC5F8>,
'_nsdict': {},
'_transdict': None,
'_name': u'MyServiceService',
'_service': <ZSI.wstools.WSDLTools.Service instance at 0x00CBC580>,
'__doc__': '',
'myMethod': <ZSI.ServiceProxy.MethodProxy instance at 0x00CBC760>}


Traceback (most recent call last):
File "webServiceTry.py", line 18, in ?
value = service.myMethod('Aditi')
File "C:\Python24\lib\site-packages\ZSI\ServiceProxy.py", line 292, in __call__
return self.parent()._call(self.__name__, *args, **kwargs)
File "C:\Python24\lib\site-packages\ZSI\ServiceProxy.py", line 85, in _call
request, response = self._getTypeCodes(callinfo)
File "C:\Python24\lib\site-packages\ZSI\ServiceProxy.py", line 127, in _getTypeCodes
request.oname = '%(prefix)s:%(name)s xmlns:%(prefix)s="%(namespaceURI)s"' \
AttributeError: Struct instance has no attribute 'oname'

-----------------------------------------------------------

So what is the problem here. Can anybody tell me the solution?

Thanks & Regards,

Topic: Multithreaded Service Previous Topic   Next Topic Topic: to call class function from command line

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use