From jerry.rocteur at gmail.com Mon Nov 17 11:54:10 2014 From: jerry.rocteur at gmail.com (Jerry Rocteur) Date: Mon, 17 Nov 2014 11:54:10 +0100 Subject: [Soap-Python] Soap Newbie GlobalSign SOAP using Suds Message-ID: Hi, I'm new to SOAP on Python. I need to write some webservice scripts to access Globalsign but I've come with a silly annoying problem.. I chose suds because I thought it was simple and I was able to get going really quickly.. But.. I searched the web for some examples but couldn't really see anything that helped me. I go about it like this; Python 2.7.3 (default, Feb 21 2013, 16:14:37) [GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2 - >>> from suds.client import Client url = 'https://system.globalsign.com/cr/ws/GasOrderService?wsdl' proxy = {'https': 'bla bla '} client = Client(url, proxy=proxy) >>> tik = client.factory.create('GetOrderByOrderId') tik.Request.Q>>> tik.Request.QueryRequestHeader.AuthToken.UserName = "login" >>> tik.Request.QueryRequestHeader.AuthToken.Password = "password!" >>> tik.Request.OrderNo = "order" >>> tik (GetOrderByOrderId){ Request = (GetCrOrderByOrderIdRequest){ QueryRequestHeader = (QueryRequestHeader){ AuthToken = (AuthToken){ UserName = "login" Password = "password" } } OrderNo = "order" OrderQueryOption = (OrderQueryOption){ ReturnCertificateInfo = None ReturnFulfillment = None ReturnP7 = None ReturnModEvents = None } } } - m = client.service.GetOrderByOrderId(tik) - What it does is create a double and I get a login error, in debug mode I get this * * * * login password order6 * * * * When I manually remove the extra and paste into SOAPUI it works correctly. Does anyone know of a better what to go about this ? Can anyone see what I'm doing wrong above that it creates the two Requests ? Thanks in advance. -- Jerry Rocteur j erry.rocteur at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From jerry.rocteur at gmail.com Tue Nov 18 12:49:05 2014 From: jerry.rocteur at gmail.com (Jerry Rocteur) Date: Tue, 18 Nov 2014 12:49:05 +0100 Subject: [Soap-Python] Soap Newbie GlobalSign SOAP using Suds In-Reply-To: <21611.11562.274691.130177@localhost.localdomain> References: <21611.11562.274691.130177@localhost.localdomain> Message-ID: Hi Dieter, On Tue, Nov 18, 2014 at 12:27 PM, Dieter Maurer wrote: > Hallo Jerry, > > what does "print client" (after client is defined) tells you > about the signature of the "GetOrderByOrderId" method? > > My guess is that the method expects something else as you "tik" > and the serialization gets confused as a consequence (but this is > a guess only). > Thanks, I know it is somethign I missed but can't put my finger on it as I have no experience with this in general.. Here it is. - >>> print client Suds ( https://fedorahosted.org/suds/ ) version: 0.4 GA build: R699-20100913 Service ( GasOrderService ) tns="https://system.globalsign.com/cr/ws/" Prefixes (1) ns0 = "https://system.globalsign.com/cr/ws/" Ports (1): (GasOrderServicePort) Methods (9): Cancel(CancelOrderRequest Request, ) GetOrderByOrderId(GetCrOrderByOrderIdRequest Request, ) GetOrders(GetCrOrdersRequest Request, ) GetProfiles(GetCrProfileRequest Request, ) OrderAndIssueCertificate(OrderAndIssueRequest Request, ) OrderCertificate(OrderRequest Request, ) OrderPkcs12(Pkcs12OrderRequest Request, ) Reissue(ReissueOrderRequest Request, ) Revoke(RevokeOrderRequest Request, ) Types (64): AuthToken Cancel CancelOrderRequest CancelOrderResponse CancelResponse CertificateInfo CertificateTemplate CrCertificate DnAttributes Error Errors Fulfillment GetCrOrderByOrderIdRequest GetCrOrderByOrderIdResponse GetCrOrdersRequest GetCrOrdersResponse GetCrProfileRequest GetCrProfileResponse GetOrderByOrderId GetOrderByOrderIdResponse GetOrders GetOrdersResponse GetProfiles GetProfilesResponse ModificationEvent ModificationEvents OrderAndIssueCertificate OrderAndIssueCertificateResponse OrderAndIssueRequest OrderAndIssueResponse OrderAndIssueResponse OrderCertificate OrderCertificateResponse OrderDetail OrderDetails OrderInfo OrderPkcs12 OrderPkcs12Response OrderQueryOption OrderQueryParam OrderRequest OrderRequestHeader OrderResponse OrderResponseHeader OrdersQueryOption OrganizationUnits Pkcs12OrderRequest Pkcs12OrderResponse ProfileAttributes ProfileDetail ProfileDetails ProfileDnAttributes ProfileInfo ProfileQueryParam QueryRequestHeader QueryResponseHeader Reissue ReissueOrderRequest ReissueOrderResponse ReissueResponse Revoke RevokeOrderRequest RevokeOrderResponse RevokeResponse ValidityPeriod > > Jerry Rocteur wrote at 2014-11-17 11:54 +0100: > >I'm new to SOAP on Python. > > > >I need to write some webservice scripts to access Globalsign but I've come > >with a silly annoying problem.. > > > >I chose suds because I thought it was simple and I was able to get going > >really quickly.. But.. > > > >I searched the web for some examples but couldn't really see anything that > >helped me. > > > >I go about it like this; > >Python 2.7.3 (default, Feb 21 2013, 16:14:37) > >[GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2 > > > > - >>> from suds.client import Client > > url = 'https://system.globalsign.com/cr/ws/GasOrderService?wsdl' > > proxy = {'https': 'bla bla '} > > client = Client(url, proxy=proxy) > > >>> tik = client.factory.create('GetOrderByOrderId') > > tik.Request.Q>>> tik.Request.QueryRequestHeader.AuthToken.UserName = > > "login" > > >>> tik.Request.QueryRequestHeader.AuthToken.Password = "password!" > > >>> tik.Request.OrderNo = "order" > > >>> tik > > (GetOrderByOrderId){ > > Request = > > (GetCrOrderByOrderIdRequest){ > > QueryRequestHeader = > > (QueryRequestHeader){ > > AuthToken = > > (AuthToken){ > > UserName = "login" > > Password = "password" > > } > > } > > OrderNo = "order" > > OrderQueryOption = > > (OrderQueryOption){ > > ReturnCertificateInfo = None > > ReturnFulfillment = None > > ReturnP7 = None > > ReturnModEvents = None > > } > > } > > } > > - m = client.service.GetOrderByOrderId(tik) > > - > > > >What it does is create a double and I get a login error, in > debug > >mode I get this > > > > > > >xmlns:ns1="https://system.globalsign.com/cr/ws/" xmlns:xsi=" > >http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV=" > >http://schemas.xmlsoap.org/soap/envelope/"> > > > > > > > >* * > >* * > > > > > > login > > password > > > > > > order6 > >* * > >* * > > > > > > > > > >When I manually remove the extra and paste into SOAPUI it works > >correctly. > > > >Does anyone know of a better what to go about this ? > > > >Can anyone see what I'm doing wrong above that it creates the two > Requests ? > > > >Thanks in advance. > > > > > >-- > >Jerry Rocteur > > > >j > >erry.rocteur at gmail.com > > -- > Dieter > -- Jerry Rocteur Jerry at rocteur.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From dieter at handshake.de Tue Nov 18 13:49:22 2014 From: dieter at handshake.de (Dieter Maurer) Date: Tue, 18 Nov 2014 13:49:22 +0100 Subject: [Soap-Python] Soap Newbie GlobalSign SOAP using Suds In-Reply-To: References: <21611.11562.274691.130177@localhost.localdomain> Message-ID: <21611.16466.783470.255097@localhost.localdomain> Jerry Rocteur wrote at 2014-11-18 12:49 +0100: >Hi Dieter, > ... >Thanks, I know it is somethign I missed but can't put my finger on it as I >have no experience with this in general.. > >Here it is. > > > - >>> print client > > Suds ( https://fedorahosted.org/suds/ ) version: 0.4 GA build: > R699-20100913 > > Service ( GasOrderService ) tns="https://system.globalsign.com/cr/ws/" > Prefixes (1) > ns0 = "https://system.globalsign.com/cr/ws/" > Ports (1): > (GasOrderServicePort) > Methods (9): > GetOrderByOrderId(GetCrOrderByOrderIdRequest Request, ) This means, it expects an "GetOrderByOrderIdRequest" parameter. You should use "client.factory.create" to create an object of this type, fill it and then pass the result to "client.service.GetOrderByOrderId". -- Dieter From jerry.rocteur at gmail.com Tue Nov 18 14:58:18 2014 From: jerry.rocteur at gmail.com (Jerry Rocteur) Date: Tue, 18 Nov 2014 14:58:18 +0100 Subject: [Soap-Python] Soap Newbie GlobalSign SOAP using Suds In-Reply-To: <21611.19343.113076.739183@localhost.localdomain> References: <21611.11562.274691.130177@localhost.localdomain> <21611.16466.783470.255097@localhost.localdomain> <21611.19343.113076.739183@localhost.localdomain> Message-ID: HI PROBLEM SOLVED! On Tue, Nov 18, 2014 at 2:37 PM, Dieter Maurer wrote: > Jerry Rocteur wrote at 2014-11-18 14:23 +0100: > >On Tue, Nov 18, 2014 at 1:49 PM, Dieter Maurer > wrote: > > > >> Jerry Rocteur wrote at 2014-11-18 12:49 +0100: > >> >Hi Dieter, > >> > ... > >> >Thanks, I know it is somethign I missed but can't put my finger on it > as I > >> >have no experience with this in general.. > >> > > >> >Here it is. > >> > > >> > > >> > - >>> print client > >> > > >> > Suds ( https://fedorahosted.org/suds/ ) version: 0.4 GA build: > >> > R699-20100913 > >> > > >> > Service ( GasOrderService ) tns=" > https://system.globalsign.com/cr/ws/" > >> > Prefixes (1) > >> > ns0 = "https://system.globalsign.com/cr/ws/" > >> > Ports (1): > >> > (GasOrderServicePort) > >> > Methods (9): > >> > GetOrderByOrderId(GetCrOrderByOrderIdRequest Request, ) > >> > >> This means, it expects an "GetOrderByOrderIdRequest" parameter. > >> You should use "client.factory.create" to create an object > >> of this type, fill it and then pass the result to > >> "client.service.GetOrderByOrderId". > >> > >> -- > >> Dieter > >> > > > >Thanks Dieter, am I doing it wrong ?: > > > >>>> from suds.client import Client > ... > >suds.TypeNotFound: Type not found: 'GetOrderByOrderIdRequest' > > The type is strangely spelled: "GetCrOrderByOrderIdRequest" > rather than "GetOrderByOrderIdRequest". I, too, did not get it right > the first time. > -- > Dieter > Dieter, At this stage of the game, in my frustration with this, I was doing what you were saying word for word without thinking ;-) I'd like to thank you very much Dieter. This did the trick: In [45]: m.OrderDetail.OrderInfo. m.OrderDetail.OrderInfo.IssueDate m.OrderDetail.OrderInfo.ProductCode m.OrderDetail.OrderInfo.LicenseNo m.OrderDetail.OrderInfo.ProfileNo m.OrderDetail.OrderInfo.OrderDate m.OrderDetail.OrderInfo.RequestAfterDate m.OrderDetail.OrderInfo.OrderNo m.OrderDetail.OrderInfo.RequestBeforeDate m.OrderDetail.OrderInfo.OrderStatus m.OrderDetail.OrderInfo.RequestDate m.OrderDetail.OrderInfo.OriginalOrderIDForReIssue m.OrderDetail.OrderInfo.ValidityPeriod In [45]: m.OrderDetail.OrderInfo.OrderStatus Out[45]: ISSUED Most grateful. Regards, -- Jerry Rocteur Jerry at rocteur.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From jerry.rocteur at gmail.com Fri Nov 28 15:45:50 2014 From: jerry.rocteur at gmail.com (Jerry Rocteur) Date: Fri, 28 Nov 2014 15:45:50 +0100 Subject: [Soap-Python] Suds on Python 2.43 Message-ID: Hi, I got my SOAP script working to GlobalSign, thanks to the help from Dieter and I can now download certificates with the script. I was running on Python 2.7 and it works great there but now I have to deploy the script on some Redhat workstations running python 2.4.3 (which I am not allowed to upgrade) When I create my client in my script I do it like this: url = 'https://system.globalsign.com/cr/ws/GasOrderService?wsdl' proxy = {'https': proxylog + ":" + proxypass + '@proxyhost.int:9999'} globalClient = Client(url, proxy=proxy) This works GREAT on 2.7 but when I run it on 2.4 I get: File "/usr/lib64/python2.4/urllib2.py", line 580, in proxy_open if '@' in host: TypeError: iterable argument required I'm Googling it and I can see there are other ways to connect but can't seem to get the syntax. Can anyone help. Thanks in advance, -- Jerry Rocteur Jerry at rocteur.com From jerry.rocteur at gmail.com Sun Nov 30 17:00:05 2014 From: jerry.rocteur at gmail.com (Jerry Rocteur) Date: Sun, 30 Nov 2014 17:00:05 +0100 Subject: [Soap-Python] Suds on Python 2.43 In-Reply-To: <21626.6929.311211.811672@localhost.localdomain> References: <21626.6929.311211.811672@localhost.localdomain> Message-ID: <9C435E50-E0C4-415E-8717-0E278231DDCA@gmail.com> Thanks Dieter for your wise words. On the workstations where they will not upgrade the Redhat verion, I will rewrite the script in Perl, I know Perl better than Python but I prefer Python by a mile. When these old workstations are updated, they can use my super dooper Python script. Thanks again for your answer. Jerry Rocteur jerry.rocteur at gmail.com > On 29 Nov 2014, at 20:14, Dieter Maurer wrote: > > Jerry Rocteur wrote at 2014-11-28 15:45 +0100: >> ... >> I was running on Python 2.7 and it works great there but now I have to >> deploy the script on some Redhat workstations running python 2.4.3 >> (which I am not allowed to upgrade) >> >> When I create my client in my script I do it like this: >> >> url = 'https://system.globalsign.com/cr/ws/GasOrderService?wsdl' >> proxy = {'https': proxylog + ":" + proxypass + '@proxyhost.int:9999'} >> globalClient = Client(url, proxy=proxy) >> >> >> This works GREAT on 2.7 but when I run it on 2.4 I get: >> >> File "/usr/lib64/python2.4/urllib2.py", line 580, in proxy_open >> if '@' in host: >> TypeError: iterable argument required > > Looks like your "urllib2" is too old for "suds". > >> I'm Googling it and I can see there are other ways to connect but >> can't seem to get the syntax. > > I do think that a different syntax will help you. > > > Usually, the easiest thing in such situations is to use a sufficiently modern > Python version. > > While you are not allowed to upgrade the system Python, > you might be allowed to install a separate modern Python for this > task. Likely, you need some so called development packages installed > into your Redhat to be able to compile such a private Python version > yourself. It might not work, as "https" requires a working "_ssl" > which in turn may want a sufficiently modern "OpenSSL" library > and if you are unlucky your Redhat might have a too old one > - but it is likely worth to try. > > > Perhaps, you are able to convince your administrators to upgrade > their Redhat version (and then, maybe, get a modern Python version > as a byproduct) - especially, in case the "OpenSSL" library > turns out to be too old. This library has seen quite some serious > security issues - that's why there are quite frequent important > new versions. Sticking to old "OpenSSL" versions can present > a significant risk. Upgrading the library regularly is highly advicable. > > > If these approaches are impossible for you, then you likely > will need debugging to find out what precisely went wrong where > and fix it. > > Debugging is very powerful but complex, too. Expect that you will > need considerable time to learn it. However, once you have done so, > it may help you in the future in many occasions. > > There are IDEs (Integrated Development Environments) which support > Python debugging through a GUI (Graphical User Interface). You > still need to learn the elementary tools in the debugging toolbox > but the GUI assists you with the details. Colleagues of mine have > used the commercial (!) WingIDE, there is also a Python plugin for > the "Eclipse" IDE (originally for Java/C/C++ development) and "Komodo" > (and likely others). > > If you cannot get an IDE with Python debugging support, you > might use Python's "pdb" ("Python DeBugger") module. Its part > of the standard Python runtime library. You are not guided by a > graphical user interface but must remember the details about the > various debugging commands. It might be enough... > > With a debugger, you will be able to find out what "host" is > in the above error situation (I suspect it to be "None" rather than > a string). Moving "up" from the error place to the callers (one of the > standard debugging commands), you can find out where the wrong "hosts" > comes from. Looking at the code, you might be able to find out why > it got wrong and how to change things to get it correct. > Likely, the place for this change is somewhere in "suds" or "urllib2". > > If you are unlucky, your administrators will not let you change the code > directly where it needs fixing. You might need tricks to get > your fix incorporated into your program context. > There are essentially two approaches: module shadowing and monkey patches - > both potentially dangerous. With "module shadowing", you substitute > some (not fully functional) module with one of your own -- in the > easiest case via a special "PYTHONPATH" envvar or by inserting > your own code directories at the beginning of "sys.path" during > startup. With a monkey patch, you modify/replace (not fully functional) > functions, methods or classes at runtime (usually during startup) by > your own. > > > Let me stress it again. With high likelyhood, the by far most efficient > way to get your problem solved it to use a modern Python version - > ideally by upgrading the OS version (and get a modern Python as a byproduct) > or by a separate modern Python installation specially for your > own task. These approaches likely will cost some hours of work > (for your administrators and/or you) > Analysing in detail what went wrong and how to get it right > may have costs in the order of days (rather than hours) -- however, > you might get along without support from sometimes reluctant administrators. > > Ask for help from your project leader to get a decision which approach > should be followed. This way, he will at least not be surprised > when you take a long time to finish your task. > > > > > -- > Dieter