[Soap-Python] Soap Newbie GlobalSign SOAP using Suds

Dieter Maurer dieter at handshake.de
Sat Dec 27 22:01:27 CET 2014


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).

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 <Request> and I get a login error, in debug
>mode I get this
>
><?xml version="1.0" encoding="UTF-8"?>
><SOAP-ENV:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/"
>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/">
>   <SOAP-ENV:Header/>
>   <ns0:Body>
>      <ns1:GetOrderByOrderId>
>*         <Request>*
>*            <Request>*
>               <QueryRequestHeader>
>                  <AuthToken>
>                     <UserName>login </UserName>
>                     <Password>password</Password>
>                  </AuthToken>
>               </QueryRequestHeader>
>               <OrderNo>order6</OrderNo>
>*            </Request>*
>*         </Request>*
>      </ns1:GetOrderByOrderId>
>   </ns0:Body>
></SOAP-ENV:Envelope>
>
>When I manually remove the extra <Request> 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 <https://mail.google.com/mail/?view=cm&fs=1&tf=1&to=Jerry@rocteur.com>
>erry.rocteur at gmail.com

--
Dieter


More information about the Soap mailing list