From: Joshua B. <JRB...@lb...> - 2006-06-25 19:26:49
|
First, use ZSI-2.0.0rc2 or svn. We haven't finished the zsi wsdl2py guide yet, but it's coming. Here is an example how to use your WSDL with ZSI. I'm not sure what the service is choking on, the error message is purposely uninformative. It's possible that SOAPpy is a better solution for your problem, it certainly is a lot simpler, and for many uses it provides all the functionality that is needed. -josh $ wsdl2py.py -bu http://gitapi.golf.se/Member/Member1.asmx?WSDL $ ls Member1_services.py Member1_services_types.py $ python Python 2.4.1 (#2, Mar 31 2005, 00:05:10) [GCC 3.3 20030304 (Apple Computer, Inc. build 1666)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> from Member1_services import * >>> locator = Member1Locator() >>> import sys >>> service = locator.getMember1Soap(tracefile=sys.stdout) >>> params = GetMemberMatrikelDataSoapIn() >>> help(params) Help on GetMemberMatrikelDataSoapIn in module Member1_services object: class GetMemberMatrikelDataSoapIn(__builtin__.object) | Methods defined here: | | __init__(self) | | get_element__golfID(self) | | get_element__memberType(self) | | get_element__organizationalUnitID(self) | | new_memberType(self, value) | value -- initialize value | returns an immutable type | | new_organizationalUnitID(self, value) | value -- initialize value | returns an immutable type | | set_element__golfID(self, value) | | set_element__memberType(self, value) | | set_element__organizationalUnitID(self, value) | | ---------------------------------------------------------------------- | Properties defined here: | | GolfID | property for element (None,golfID), minOccurs="1" maxOccurs="1" nillable="True" | | <get> = get_element__golfID(self) | | <set> = set_element__golfID(self, value) | | MemberType | property for element (None,memberType), minOccurs="1" maxOccurs="1" nillable="True" | | <get> = get_element__memberType(self) | | <set> = set_element__memberType(self, value) | | OrganizationalUnitID | property for element (None,organizationalUnitID), minOccurs="1" maxOccurs="1" nillable="True" | | <get> = get_element__organizationalUnitID(self) | | <set> = set_element__organizationalUnitID(self, value) | | ---------------------------------------------------------------------- >>> params.OrganizationalUnitID = params.new_organizationalUnitID ("045d699c-4713-49cc-b36a-4a23418012de") >>> params.MemberType = params.new_memberType("ALL") >>> response = service.GetMemberMatrikelData(params) _________________________________ Sun Jun 25 12:07:32 2006 REQUEST: <SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/ encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ZSI="http://www.zolera.com/schemas/ZSI/" xmlns:xsd="http:// www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/ XMLSchema-instance" SOAP-ENV:encodingStyle="http:// schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Header></SOAP- ENV:Header><SOAP-ENV:Body xmlns:ns1="http://gitapi.golf.se/Member/ Member1"><ns1:GetMemberMatrikelData><organizationalUnitID xmlns:ns2="http://microsoft.com/wsdl/types/" xsi:type="ns2:guid">045d699c-4713-49cc-b36a-4a23418012de</ organizationalUnitID><golfID xsi:nil="1"></golfID><memberType xsi:type="ns1:MemberTypes">ALL</memberType></ ns1:GetMemberMatrikelData></SOAP-ENV:Body></SOAP-ENV:Envelope> _________________________________ Sun Jun 25 12:07:32 2006 RESPONSE: 500 Internal Server Error ------- Date: Sun, 25 Jun 2006 19:07:32 GMT Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET X-AspNet-Version: 1.1.4322 Cache-Control: private Content-Type: text/html; charset=utf-8 Content-Length: 3026 <html> <head> <title>Runtime Error</title> <style> body {font-family:"Verdana";font-weight:normal;font- size: .7em;color:black;} p {font-family:"Verdana";font- weight:normal;color:black;margin-top: -5px} b {font-family:"Verdana";font- weight:bold;color:black;margin-top: -5px} H1 { font-family:"Verdana";font-weight:normal;font- size:18pt;color:red } H2 { font-family:"Verdana";font-weight:normal;font- size:14pt;color:maroon } pre {font-family:"Lucida Console";font-size: .9em} .marker {font-weight: bold; color: black;text- decoration: none;} .version {color: gray;} .error {margin-bottom: 10px;} .expandable { text-decoration:underline; font- weight:bold; color:navy; cursor:hand; } </style> </head> <body bgcolor="white"> <span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1> <h2> <i>Runtime Error</i> </h2></span> <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif "> <b> Description: </b>An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine. <br><br> <b>Details:</b> To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".<br><br> <table width=100% bgcolor="#ffffcc"> <tr> <td> <code><pre> <!-- Web.Config Configuration File --> <configuration> <system.web> <customErrors mode="Off"/> </system.web> </configuration></pre></code> </td> </tr> </table> <br> <b>Notes:</b> The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.<br><br> <table width=100% bgcolor="#ffffcc"> <tr> <td> <code><pre> <!-- Web.Config Configuration File --> <configuration> <system.web> <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/> </system.web> </configuration></pre></code> </td> </tr> </table> <br> </body> </html> Traceback (most recent call last): File "<stdin>", line 1, in ? File "Member1_services.py", line 39, in GetMemberMatrikelData response = self.binding.Receive(typecode) File "/Users/boverhof/Desktop/Workspace/Python/zsi/ZSI/client.py", line 415, in Receive self.ReceiveSOAP(**kw) File "/Users/boverhof/Desktop/Workspace/Python/zsi/ZSI/client.py", line 378, in ReceiveSOAP raise TypeError( TypeError: Response is "text/html", not "text/xml" >>> On Jun 25, 2006, at 5:33 AM, Zacharias Enochsson wrote: > Reposting, as I forgot to set a subject last time (thought it might > have been rejected as spam). > > Hello! > > I'm a total noob to the Webservices-scene, but I'm trying to > quickly get a basic hang of it -- so please bear with me for a > moment :) > > Now: > I'm using ZSI 1.7.0, and in particular the wsdl2py script that came > with it, to get commected to a SOAP server that seems pretty > complicated. > > Anyhow, the WSDL is here: > http://gitapi.golf.se/Member/Member1.asmx?WSDL > > And here is (the relevant parts of) my script for retrieving a > certain blob of data (after having apparently successfully run > wsdl2py to build Member1_services and Member1_services_types): > > ####### > locator = Member1Locator() > service = locator.getMember1Soap() > > params = GetMemberMatrikelDataSoapInWrapper() > params._organizationalUnitID = ns2.guid_Def("045d699c-4713-49cc- > b36a-4a23418012de") > params._memberType = ns1.MemberTypes_Def("ALL") > > response = service.GetMemberMatrikelData(params) > ####### > > This produces the following error: > > ----------------- > > Exception: ('Serializing GetMemberMatrikelData xmlns="http:// > gitapi.golf.se/Member/Member1"._organizationalUnitID, > AttributeError guid_Def instance has no attribute \'replace\'',) > Traceback: > function module body > in golfsoap.py at line 22 > function GetMemberMatrikelData > in Member1_services.py at line 153 > function Send ⎋ > in client.py at line 186 > function serialize ⎋ > in writer.py at line 74 > function serialize ⎋ > in TCcompound.py at line 153 > function cb ⎋ > in TCcompound.py at line 189 > > ----------------- > > ...now, since it seems like the cb-function is trying to run the > "replace" method on the guid_Def() instance, rather than on a > string, I imagine this could be a bug somewhere. But also very > likely is that I am not using the generated code correctly, as I > feel very bewildered by it. > > Would anyone help me out please? (Prefferably sooner rather than > later, of course :P) I'd be happy to provide more information if > necessary. > > Thanks! > > /Zach > > PS.. I have a PHP-script that I'm trying to mimic for this, and it > seems very straightforward, but doing it in python seems a lot more > complicated. This turns my perceptions completely upside-down, > having long despised PHP for it's complexity and bloat. Since I > don't really know what I'm doing here, would anyone care to > elaborate on the differences between working with SOAP in PHP > versus Python? > > > Using Tomcat but need to do more? Need to support web services, > security? > Get stuff done quickly with pre-integrated technology to make your > job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache > Geronimo > http://sel.as-us.falkag.net/sel? > cmd=lnk&kid=120709&bid=263057&dat=121642______________________________ > _________________ > Pywebsvcs-talk mailing list > Pyw...@li... > https://lists.sourceforge.net/lists/listinfo/pywebsvcs-talk |