From kpoman at hotmail.com Thu Apr 2 20:12:25 2015 From: kpoman at hotmail.com (Patricio Stegmann Hotmail) Date: Thu, 2 Apr 2015 15:12:25 -0300 Subject: [Soap-Python] Soap Enum type problem Message-ID: Hello, I need to implement via spyne something responding to the following type: However Spyne only allows string litterals for Enum type. Is there some workaround ? Thank you ! From burak.arslan at arskom.com.tr Sun Apr 5 23:32:22 2015 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Mon, 06 Apr 2015 00:32:22 +0300 Subject: [Soap-Python] Soap Enum type problem In-Reply-To: References: Message-ID: <5521A9E6.2070206@arskom.com.tr> hi, On 04/02/15 21:12, Patricio Stegmann Hotmail wrote: > Hello, > I need to implement via spyne something responding to the following type: > > > > > > > > > > > > > > > > > > maxOccurs="1"/> > > > > However Spyne only allows string litterals for Enum type. Is there > some workaround ? > What did you already try? It seems Integer(values=[0,1,2,3]) is what you need but I can't be sure. > Thank you ! No problem! Best, Burak From keith at onecoursesource.com Tue Apr 7 04:59:44 2015 From: keith at onecoursesource.com (Keith Wright) Date: Mon, 06 Apr 2015 19:59:44 -0700 Subject: [Soap-Python] Recommended Modules for SOAP Message-ID: <55234820.8020208@onecoursesource.com> Hello, I am developing documentation for my company about how to use Python with SOAP. There is only one module available for SOAP under RHEL/CentOS 7, the SOAPpy module. I found it lacking in dealing with creating parameters based upon a WSDL file, but the suds module I installed via pip worked. Are there any other modules for SOAP that I should be considering that you might recommend? Best regards, Keith Wright From fabian at rothfuchs.net Tue Apr 7 21:32:17 2015 From: fabian at rothfuchs.net (fabian at rothfuchs.net) Date: Tue, 07 Apr 2015 12:32:17 -0700 (PDT) Subject: [Soap-Python] Recommended Modules for SOAP In-Reply-To: <55234820.8020208@onecoursesource.com> References: <55234820.8020208@onecoursesource.com> Message-ID: <1428435136904.8d54a26e@Nodemailer> Hey, you should definitely checkout Spyne: www.spyne.io from the server side.? Client side I don?t know anything better than suds.? Cheers Fabian ? Sent from Mailbox On Tue, Apr 7, 2015 at 7:45 PM, Keith Wright wrote: > Hello, > I am developing documentation for my company about how to use Python > with SOAP. > There is only one module available for SOAP under RHEL/CentOS 7, the > SOAPpy module. > I found it lacking in dealing with creating parameters based upon a WSDL > file, but the suds module I installed via pip worked. > Are there any other modules for SOAP that I should be considering that > you might recommend? > Best regards, > Keith Wright > _______________________________________________ > Soap mailing list > Soap at python.org > https://mail.python.org/mailman/listinfo/soap -------------- next part -------------- An HTML attachment was scrubbed... URL: From dsuch at zato.io Tue Apr 7 21:16:26 2015 From: dsuch at zato.io (Dariusz Suchojad) Date: Tue, 07 Apr 2015 21:16:26 +0200 Subject: [Soap-Python] Recommended Modules for SOAP In-Reply-To: <55234820.8020208@onecoursesource.com> References: <55234820.8020208@onecoursesource.com> Message-ID: <55242D0A.9040002@zato.io> On 07/04/15 04:59, Keith Wright wrote: > Are there any other modules for SOAP that I should be considering that > you might recommend? Hi Keith, I recommend that you also have a look at Zato .. https://zato.io/blog/posts/secure-scalable-and-dynamic-invocation-of-soap-services-with-zato-and-suds.html https://zato.io/docs/progguide/examples/soap.html https://zato.io/docs/ .. which is an entire integration platform in Python the SOAP support is part of which rather than a Python module. It is very easy to install it on RHEL/CentOS, either directly or under Docker: https://zato.io/docs/admin/guide/install-rhel.html https://zato.io/docs/admin/guide/install-docker.html cheers, -- Dariusz Suchojad https://zato.io ESB, SOA, REST, APIs and Cloud Integrations in Python From kpoman at gmail.com Tue Apr 14 20:03:57 2015 From: kpoman at gmail.com (Patricio Stegmann Gmail) Date: Tue, 14 Apr 2015 15:03:57 -0300 Subject: [Soap-Python] Soap Enum type problem In-Reply-To: <5521A9E6.2070206@arskom.com.tr> References: <5521A9E6.2070206@arskom.com.tr> Message-ID: <552D568D.2030700@gmail.com> Hey Burak, I did as you suggested, as it was nonsense trying to create a type Enum of ints instead of an int restriction ! On 05/04/2015 18:32, Burak Arslan wrote: > hi, > > On 04/02/15 21:12, Patricio Stegmann Hotmail wrote: >> Hello, >> I need to implement via spyne something responding to the following type: >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> > maxOccurs="1"/> >> >> >> >> However Spyne only allows string litterals for Enum type. Is there >> some workaround ? >> > What did you already try? It seems Integer(values=[0,1,2,3]) is what you > need but I can't be sure. > >> Thank you ! > > No problem! > > Best, > Burak > _______________________________________________ > Soap mailing list > Soap at python.org > https://mail.python.org/mailman/listinfo/soap From kpoman at gmail.com Tue Apr 14 20:08:40 2015 From: kpoman at gmail.com (Patricio Stegmann Gmail) Date: Tue, 14 Apr 2015 15:08:40 -0300 Subject: [Soap-Python] Spyne: ability to change default results name from FooResult to WhateverXyz ? Message-ID: <552D57A8.5010406@gmail.com> Hello, I am looking at a way to change the default behaviour on output generation with soap. Basically spyne creates the typedefs but responds with its autogenerated names: / //// // // //* *//* *//* *// // myval// // 1// //* *//* *//* *// // // /// I need to change the default name of helloResult. I could already manage it for helloResponse, by using on the srpc decorator the parameter _in_message_name etc... However, I dont know how to change the name for helloResult. I tried, on the return type, to do something like this: classMyThing(ComplexModel): param1 = Integer param2 = String __type_name__ ='MySpecificResultThing' but still got helloResult. Any idea ? Thank you ! -------------- next part -------------- An HTML attachment was scrubbed... URL: From burak.arslan at arskom.com.tr Wed Apr 15 09:58:52 2015 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Wed, 15 Apr 2015 10:58:52 +0300 Subject: [Soap-Python] Spyne: ability to change default results name from FooResult to WhateverXyz ? In-Reply-To: <552D57A8.5010406@gmail.com> References: <552D57A8.5010406@gmail.com> Message-ID: <552E1A3C.6000807@arskom.com.tr> On 04/14/15 21:08, Patricio Stegmann Gmail wrote: > Hello, > I am looking at a way to change the default behaviour on output > generation with soap. > Basically spyne creates the typedefs but responds with its > autogenerated names: > / > // xmlns:senv="http://schemas.xmlsoap.org/soap/envelope/">// > // // > //* *//* > *//* *// > // myval// > // 1// > //* *//* > *//* *// > // // > /// > > I need to change the default name of helloResult. I could already > manage it for helloResponse, by using on the srpc decorator the > parameter _in_message_name etc... However, I dont know how to change > the name for helloResult. I tried, on the return type, to do something > like this: You need to use the bare mode. This disables auto class generation and uses classes supplied by you. Bare mode supports only one input and one output argument. You need to use a ComplexModel if you need to work with more than one argument in input or output. class HelloCustomResponse(ComplexModel): #(...) @rpc( (...) ,_body_style='bare', _returns=HelloCustomResponse) hth, burak -------------- next part -------------- An HTML attachment was scrubbed... URL: From cbeck at railkey.net Fri Apr 17 20:50:35 2015 From: cbeck at railkey.net (Chris Beck) Date: Fri, 17 Apr 2015 14:50:35 -0400 Subject: [Soap-Python] Extending simple types in pysimplesoap Message-ID: Hello all, I have an OTA (open travel alliance) WSDL that I am trying to call. When trying with a Suds implementation it works but uses >1.5 gigs of RAM to initialize the client object. If anyone knows how to get an order of magnitude shrinkage in Suds clients then please let me know and we can ignore what follows. I'm trying to see how well PySimpleSoap might serve as a replacement but I seem to have hit a limitation. The relevant imported XSDs (OTA_CommonTypes, OTA_SimpleTypes) for the WSDL declares (apologies in advance if the formatting screws up plain text readers - I worked on the assumption that the added clarity outweighed the increasingly rare case): The name or code of a country (e.g. as used in an address or to specify citizenship of a traveller). ISO 3166 code for a country. and Used for Character Strings, length 0 to 64 When parsing this I get an error: File "{path}/lib/python2.7/site-packages/pysimplesoap/helpers.py", line 271, in process_element struct.refers_to = fn TypeError: can't set attributes of built-in/extension type 'str' which occurs in a recursive call to process_element after this chunk: if e is not None and e.get_local_name() == 'extension' and e.children(): # extend base element (if ComplexContent only!): if isinstance(fn, Struct) and fn.refers_to: base_struct = fn.refers_to else: # TODO: check if this actually works for SimpleContent base_struct = None So I am guessing that the answer to the TODO is "No". Has anyone encountered this kind of error before and determined a way around it? Cheers, Chris -- Christopher Beck cbeck at railkey.net +1.514.431.7759 -------------- next part -------------- An HTML attachment was scrubbed... URL: From burak.arslan at arskom.com.tr Mon Apr 20 22:59:26 2015 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Mon, 20 Apr 2015 23:59:26 +0300 Subject: [Soap-Python] Extending simple types in pysimplesoap In-Reply-To: References: Message-ID: <553568AE.8000209@arskom.com.tr> On 17/04/15 21:50, Chris Beck wrote: > I have an OTA (open travel alliance) WSDL that I am trying to call. can us mere mortals get hold of the document? burak From kpoman at gmail.com Tue Apr 21 05:52:14 2015 From: kpoman at gmail.com (Patricio Stegmann Gmail) Date: Tue, 21 Apr 2015 00:52:14 -0300 Subject: [Soap-Python] Spyne: ability to change default results name from FooResult to WhateverXyz ? In-Reply-To: <552E1A3C.6000807@arskom.com.tr> References: <552D57A8.5010406@gmail.com> <552E1A3C.6000807@arskom.com.tr> Message-ID: <5535C96E.5080102@gmail.com> Burak, The bare parameter is forcing me to have, for the decorated function, only one parameter of input, for example (given a Foo method): /@srpc(FooType, _body_style='bare', _returns=SomeReturnStructure)/ giving the following exception: /Exception: body_style='bare' can handle at most one function argument./ The request is being sent as this: some-id some-name However, the responses are being validated. These are auto-generated stubs from some java webservices lib, so I guess the consumer of the webservice won't do any change in the way he calls my rpc's. Basically he calls directly but expects bare naming in return. How do I fix this ? Thank you ! On 15/04/2015 04:58, Burak Arslan wrote: > > > On 04/14/15 21:08, Patricio Stegmann Gmail wrote: >> Hello, >> I am looking at a way to change the default behaviour on output >> generation with soap. >> Basically spyne creates the typedefs but responds with its >> autogenerated names: >> / >> //> xmlns:senv="http://schemas.xmlsoap.org/soap/envelope/">// >> // // >> //* *//* >> *//* *// >> // myval// >> // 1// >> //* *//* >> *//* *// >> // // >> /// >> >> I need to change the default name of helloResult. I could already >> manage it for helloResponse, by using on the srpc decorator the >> parameter _in_message_name etc... However, I dont know how to change >> the name for helloResult. I tried, on the return type, to do >> something like this: > > You need to use the bare mode. This disables auto class generation and > uses classes supplied by you. Bare mode supports only one input and > one output argument. You need to use a ComplexModel if you need to > work with more than one argument in input or output. > > class HelloCustomResponse(ComplexModel): > #(...) > > @rpc( (...) ,_body_style='bare', _returns=HelloCustomResponse) > > hth, > burak -------------- next part -------------- An HTML attachment was scrubbed... URL: From burak.arslan at arskom.com.tr Tue Apr 21 17:31:31 2015 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Tue, 21 Apr 2015 18:31:31 +0300 Subject: [Soap-Python] Spyne: ability to change default results name from FooResult to WhateverXyz ? In-Reply-To: <5535C96E.5080102@gmail.com> References: <552D57A8.5010406@gmail.com> <552E1A3C.6000807@arskom.com.tr> <5535C96E.5080102@gmail.com> Message-ID: <55366D53.7000301@arskom.com.tr> On 04/21/15 06:52, Patricio Stegmann Gmail wrote: > The bare parameter is forcing me to have, for the decorated function, > only one parameter of input, SOAP defines a way to map an XML document to a method call. Actually, that's like this for every serialization standard / RPC standard pair. For example JsonRPC is a standard to map an incoming json document to a method call. XmlRpc is another way of mapping xml documents to method calls, etc.. So in normal (non-bare) mode, you define your method and Spyne generates needed input and output objects for you. In bare mode, it's your job to define these objects. That's why you can only have a single input and single output object. So if your method needs to take two arguments, you have to do what Spyne does behind the scenes and define a complex model that has two attributes and use that object as type of the single argument to your method. The "one object == one method call" is the fundamental design principle behind Spyne[1]. If that's clear, let's get back to your case. You need: class InitializeRequest(ComplexModel): __type_name__ = 'Initialize' __namespace__ = 'tns' # whatever you passed to your app as tns argument _type_info = [ ('id', Unicode), ('name', Unicode), ] and class SomeService(ServiceBase): @rpc(InitializeRequest, _body_style='bare') def wicked(ctx, request): print "id:", request.id print "name:", request.name If you need to have the namespace of your incoming object different from your app's tns, you need latest code from github.com/arskom/spyne. I just found out 2.11 doesn't support that. I hope this helps. Best, Burak [1]: That doesn't mean one document can't contain more than one object, but that's not implemented because I don't see the point. -------------- next part -------------- An HTML attachment was scrubbed... URL: From kpoman at gmail.com Thu Apr 23 05:45:00 2015 From: kpoman at gmail.com (Patricio Stegmann) Date: Thu, 23 Apr 2015 00:45:00 -0300 Subject: [Soap-Python] Spyne: ability to change default results name from FooResult to WhateverXyz ? In-Reply-To: <55366D53.7000301@arskom.com.tr> References: <552D57A8.5010406@gmail.com> <552E1A3C.6000807@arskom.com.tr> <5535C96E.5080102@gmail.com> <55366D53.7000301@arskom.com.tr> Message-ID: <55386ABC.8010407@gmail.com> Burak, I was able to monkey-patch the lib allowing it to carry and treat a _out_result_name kwarg and substitute when building response / result name, and it kinda works. Unfortunately I couldn't fix totally my issue. The problem is the client that is consuming my spyne webservice is based on Java JAX WS lib. It is right now able to call the method and receive the response, but however finds null on all the returned values on that ComplexModel return thing. I have a response that works on the java app (generated by itself when in emulator mode), and one generated by the real spyne app that doesnt and provide null values to the client. This one works: SECAD/STI/TSE 2015-04-22T19:51:59.295-03:00 0.0.1 Implementa??o DEMO do "lado servidor" and this want doesnt: <*tns:*RecuperaInfoSoftwareResponse> {'product_id': 'WATSON MINI', 'software_version': '3.1.4', 'software_vendor': 'BioLogica Sistemas SA', 'device_state': '0', 'software_release_date': '02/04/2015', 'serial_number': '1236-00083', 'device': '\n ', 'infoSoftwareXml': '\n ', 'firmware_version': '1.0.2'} Biologica Sistemas 3.1.4 02/04/2015 They really seem quite similar with only namespace compatible differences. Do you have any clue what could be wrong or any experience dealing with JAX WS clients ? Thank you ! On 4/21/2015 12:31 PM, Burak Arslan wrote: > > > On 04/21/15 06:52, Patricio Stegmann Gmail wrote: >> The bare parameter is forcing me to have, for the decorated function, >> only one parameter of input, > > SOAP defines a way to map an XML document to a method call. Actually, > that's like this for every serialization standard / RPC standard pair. > For example JsonRPC is a standard to map an incoming json document to > a method call. XmlRpc is another way of mapping xml documents to > method calls, etc.. > > So in normal (non-bare) mode, you define your method and Spyne > generates needed input and output objects for you. In bare mode, it's > your job to define these objects. That's why you can only have a > single input and single output object. > > So if your method needs to take two arguments, you have to do what > Spyne does behind the scenes and define a complex model that has two > attributes and use that object as type of the single argument to your > method. > > The "one object == one method call" is the fundamental design > principle behind Spyne[1]. > > If that's clear, let's get back to your case. You need: > > class InitializeRequest(ComplexModel): > __type_name__ = 'Initialize' > __namespace__ = 'tns' # whatever you passed to your app as > tns argument > > _type_info = [ > ('id', Unicode), > ('name', Unicode), > ] > > and > > class SomeService(ServiceBase): > @rpc(InitializeRequest, _body_style='bare') > def wicked(ctx, request): > print "id:", request.id > print "name:", request.name > > If you need to have the namespace of your incoming object different > from your app's tns, you need latest code from > github.com/arskom/spyne. I just found out 2.11 doesn't support that. > > I hope this helps. > > Best, > Burak > > [1]: That doesn't mean one document can't contain more than one > object, but that's not implemented because I don't see the point. > --- This email has been checked for viruses by Avast antivirus software. http://www.avast.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From burak.arslan at arskom.com.tr Thu Apr 23 15:04:59 2015 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Thu, 23 Apr 2015 16:04:59 +0300 Subject: [Soap-Python] Spyne: ability to change default results name from FooResult to WhateverXyz ? In-Reply-To: <55386ABC.8010407@gmail.com> References: <552D57A8.5010406@gmail.com> <552E1A3C.6000807@arskom.com.tr> <5535C96E.5080102@gmail.com> <55366D53.7000301@arskom.com.tr> <55386ABC.8010407@gmail.com> Message-ID: <5538EDFB.9070405@arskom.com.tr> On 04/23/15 06:45, Patricio Stegmann wrote: > Burak, > I was able to monkey-patch the lib allowing it to carry and treat a > _out_result_name kwarg and substitute when building response / result > name, and it kinda works. Wait, _out_message_name didn't work? > > They really seem quite similar with only namespace compatible > differences. Do you have any clue what could be wrong Yes, namespaces of the spyne example are different, which is quite important in the xml world. Could you put your service somewhere I can reach (e.g. github gist) I'd like to dig deeper and find out whether it's a Spyne bug. Best, Burak -------------- next part -------------- An HTML attachment was scrubbed... URL: From burak.arslan at arskom.com.tr Fri Apr 24 14:00:39 2015 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Fri, 24 Apr 2015 15:00:39 +0300 Subject: [Soap-Python] Extending simple types in pysimplesoap In-Reply-To: References: <553568AE.8000209@arskom.com.tr> Message-ID: <553A3067.9010607@arskom.com.tr> Hello Chris, On 04/21/15 19:16, Chris Beck wrote: > Hi, > So sorry about not providing a working test case. Here is the Open > Travel xsd that is causing the parsing > issue: http://www.opentravel.org/2003A/OTA_CommonTypes.xsd > Spyne's schema parser does handle simple type extensions but not simple type unions. I created a gist that shows the issue here: https://gist.github.com/plq/c3537b4452841e28e7e7 (it's huge, so clone it rather than clicking on it) This function is missing: https://github.com/arskom/spyne/blob/8b1dfa20f6f36cd54b219c8d1a6789494f32e7dc/spyne/interface/xml_schema/parser.py#L303 Which means we need 1) a Union type (like the Array type) 2) from_string and to_string functions for union types in ProtocolBase. 3) some simple code that creates Spyne's Union type based on the information in the xs:union tag there. Preliminary exploration (egrep 'type="[^"]+"' *.xsd -o | cut -d: -f2- | sort -u | grep -v xs: | wc -l) shows 739 types defined here. I did a test with a service that uses 1000 types as input to 1000 separate methods and RSS seems to be around 73 mb. That file is in the above gist as thousand.py as well. Best Burak From cbeck at railkey.net Fri Apr 24 16:57:53 2015 From: cbeck at railkey.net (Chris Beck) Date: Fri, 24 Apr 2015 10:57:53 -0400 Subject: [Soap-Python] Extending simple types in pysimplesoap In-Reply-To: <553A3067.9010607@arskom.com.tr> References: <553568AE.8000209@arskom.com.tr> <553A3067.9010607@arskom.com.tr> Message-ID: Hi Burak, Is this work that you are doing to expnd on the implementation the wsdl parser for the 0.12 Spyne release ( http://spyne.io/docs/2.11/faq.html#how-do-i-implement-a-predefined-wsdl)? I think the problem with Suds memory usage is their overly generous deep recursion. We added a hard-coded nesting limit to the Suds schema parser (see attached patch file which works with both the 0.4 original release and the latest 0.7dev suds-jurko) and we get very similar numbers to what you are seeing. We have yet to encounter a use case that breaks it but dialling the depth up is easy if we do. So if you use the Suds methodology, which *doesn't* have the problem of extending simple types, and limit the recursion depth it might get the best of both worlds. Cheers, Chris On Fri, Apr 24, 2015 at 8:00 AM, Burak Arslan wrote: > Hello Chris, > > On 04/21/15 19:16, Chris Beck wrote: > > Hi, > > So sorry about not providing a working test case. Here is the Open > > Travel xsd that is causing the parsing > > issue: http://www.opentravel.org/2003A/OTA_CommonTypes.xsd > > > > Spyne's schema parser does handle simple type extensions but not simple > type unions. > > I created a gist that shows the issue here: > > https://gist.github.com/plq/c3537b4452841e28e7e7 > > (it's huge, so clone it rather than clicking on it) > > This function is missing: > > https://github.com/arskom/spyne/blob/8b1dfa20f6f36cd54b219c8d1a6789494f32e7dc/spyne/interface/xml_schema/parser.py#L303 > > Which means we need 1) a Union type (like the Array type) 2) from_string > and to_string functions for union types in ProtocolBase. 3) some simple > code that creates Spyne's Union type based on the information in the > xs:union tag there. > > Preliminary exploration (egrep 'type="[^"]+"' *.xsd -o | cut -d: -f2- | > sort -u | grep -v xs: | wc -l) shows 739 types defined here. I did a > test with a service that uses 1000 types as input to 1000 separate > methods and RSS seems to be around 73 mb. That file is in the above gist > as thousand.py as well. > > Best > Burak > > _______________________________________________ > Soap mailing list > Soap at python.org > https://mail.python.org/mailman/listinfo/soap > -- Christopher Beck cbeck at railkey.net +1.514.431.7759 -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 03-suds-recursion.patch Type: application/octet-stream Size: 1658 bytes Desc: not available URL: From ptomblin at xcski.com Mon Apr 27 17:06:56 2015 From: ptomblin at xcski.com (Paul Tomblin) Date: Mon, 27 Apr 2015 11:06:56 -0400 Subject: [Soap-Python] WSSE security Message-ID: I need to talk to a web service that requires wsse:BinarySecurityToken, ds:Security, wsse:UsernameToken and wsu:Timestamp headers. I see that the latest version of pysimplesoap on python.org has some sort of plugin architecture and a wsse.py for at least some of these headers, but I don't see any documentation on how to use them. The Google Code page doesn't have the wsse.py file, and so obviously nothing in their Wiki. Can somebody point me to documentation or examples? -- http://www.linkedin.com/in/paultomblin http://careers.stackoverflow.com/ptomblin -------------- next part -------------- An HTML attachment was scrubbed... URL: From ovnicraft at gmail.com Mon Apr 27 19:38:24 2015 From: ovnicraft at gmail.com (Ovnicraft) Date: Mon, 27 Apr 2015 12:38:24 -0500 Subject: [Soap-Python] WSSE security In-Reply-To: References: Message-ID: On Mon, Apr 27, 2015 at 10:06 AM, Paul Tomblin wrote: > I need to talk to a web service that requires wsse:BinarySecurityToken, > ds:Security, wsse:UsernameToken and wsu:Timestamp headers. I see that the > latest version of pysimplesoap on python.org has some sort of plugin > architecture and a wsse.py for at least some of these headers, but I don't > see any documentation on how to use them. The Google Code page doesn't have > the wsse.py file, and so obviously nothing in their Wiki. > > Can somebody point me to documentation or examples? > Hello, i have some issues around this, i did some changes[1] over suds-jurko to support [1] https://bitbucket.org/jurko/suds/pull-request/32/add-support-for-security-headers/diff This can help you. > > -- > http://www.linkedin.com/in/paultomblin > http://careers.stackoverflow.com/ptomblin > > _______________________________________________ > Soap mailing list > Soap at python.org > https://mail.python.org/mailman/listinfo/soap > > -- [image: Cristian Salamea on about.me] Cristian Salamea about.me/ovnicraft -------------- next part -------------- An HTML attachment was scrubbed... URL: From ptomblin at xcski.com Mon Apr 27 21:02:56 2015 From: ptomblin at xcski.com (Paul Tomblin) Date: Mon, 27 Apr 2015 15:02:56 -0400 Subject: [Soap-Python] WSSE security In-Reply-To: References: Message-ID: This looks really promising, but when I try it with my self-signed certificate, I get the following error: DEBUG:suds.client:sending to ( https://xxx.service-now.com/u_cart_request.do?SOAP) message: aaaa bbbb 2015-04-27T18:55:22.714722+00:00 2015-04-27T18:56:52.714722+00:00 12345 RMT12345 DEBUG:suds.client:headers = {'SOAPAction': '" http://www.service-now.com/u_cart_request/insert"', 'Content-Type': 'text/xml; charset=utf-8'} DEBUG:suds.client:HTTP failed - 500 - Internal Server Error: wsse:FailedAuthenticationThe security token could not be authenticated or authorizedWSSecurity login failed ERROR:suds.plugin:No signature node found Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/suds/plugin.py", line 254, in __call__ method(ctx) File "/usr/local/lib/python2.7/dist-packages/soap_wsse/suds_plugin.py", line 20, in received valid = verify_envelope(context.reply, self.cert_filename) File "/usr/local/lib/python2.7/dist-packages/soap_wsse/signing.py", line 130, in verify_envelope raise CertificationError("No signature node found") CertificationError: No signature node found ERROR:suds.client: e = Server raised fault: 'The security token could not be authenticated or authorized' I don't see the BinarySecurityToken in the outgoing XML in the first debug message. Shouldn't it be there? The "No signature node found" message seems to be related to incoming not outgoing messages, so I'm confused why it's happening. On Mon, Apr 27, 2015 at 1:13 PM, Iuri wrote: > I'm using suds-jurko [1] with soap_wsse [2] for this. It is simple. I > never tried pysimplesoap. > > from soap_wsse.suds_plugin import WssePlugin > from suds.client import Client > from suds.wsse import Security, UsernameToken, Timestamp > > url = "http://example.com/service?WSDL" > username = "test" > password = "p at ssw0rd!" > certificate = "/your/cert.pem" > > s = Security() > s.tokens.extend([UsernameToken(username, password), Timestamp()]) > > client = Client(url, plugins=[WssePlugin(certificate)]) > client.set_options(wsse=s) > > [1] https://pypi.python.org/pypi/suds-jurko > [2] https://pypi.python.org/pypi/soap_wsse > > Cheers! > > > On Mon, Apr 27, 2015 at 12:06 PM, Paul Tomblin wrote: > >> I need to talk to a web service that requires wsse:BinarySecurityToken, >> ds:Security, wsse:UsernameToken and wsu:Timestamp headers. I see that the >> latest version of pysimplesoap on python.org has some sort of plugin >> architecture and a wsse.py for at least some of these headers, but I don't >> see any documentation on how to use them. The Google Code page doesn't have >> the wsse.py file, and so obviously nothing in their Wiki. >> >> Can somebody point me to documentation or examples? >> >> >> -- >> http://www.linkedin.com/in/paultomblin >> http://careers.stackoverflow.com/ptomblin >> >> _______________________________________________ >> Soap mailing list >> Soap at python.org >> https://mail.python.org/mailman/listinfo/soap >> >> > -- http://www.linkedin.com/in/paultomblin http://careers.stackoverflow.com/ptomblin -------------- next part -------------- An HTML attachment was scrubbed... URL: From ptomblin at xcski.com Mon Apr 27 21:38:07 2015 From: ptomblin at xcski.com (Paul Tomblin) Date: Mon, 27 Apr 2015 15:38:07 -0400 Subject: [Soap-Python] WSSE security In-Reply-To: References: Message-ID: Thanks, that looks like it's sending the right header. The server doesn't like it for some reason, but I'll have to talk to them about it. Thanks very much for your help, Luri. On Mon, Apr 27, 2015 at 3:25 PM, Iuri wrote: > The signature is not shown in the suds.client logging. I created a small > log plugin to print the request/response. > > class LogPlugin(MessagePlugin): > def sending(self, context): > print str(context.envelope) > > def received(self, context): > print str(context.reply) > > # add the LogPlugin after the WssePlugin > client = Client(url, plugins=[WssePlugin(certificate), LogPlugin()]) > > This plugin will print the signed request (if it is really signed). I > don't remember exactly what was happening, but in some cases the WssePlugin > failed silently. No signature and no error. Maybe it is your case. > > Check if your PEM certificate is loading correctly: > > from OpenSSL import crypto > print crypto.load_certificate(crypto.FILETYPE_PEM, open(key_file).read()) > > The verify_envelope[1] is used when you receive the server response. > > [1] > https://github.com/mvantellingen/py-soap-wsse/blob/ffd25323cd05ac85d36411f67270d9801935c9e0/src/soap_wsse/suds_plugin.py > > I don't know what scenario the soap_wsse author considered, but the plugin > expects the response signed with the same key. I fixed with a little hack: > > class OutboundWssePlugin(WssePlugin): > def received(self, context): > pass > > # use OutboundWssePlugin instead of the original WssePlugin here > client = Client(url, plugins=[OutboundWssePlugin(certificate), > LogPlugin()]) > > Now, the plugin will not expect a signed answer. > > On Mon, Apr 27, 2015 at 4:02 PM, Paul Tomblin wrote: > >> This looks really promising, but when I try it with my self-signed >> certificate, I get the following error: >> >> DEBUG:suds.client:sending to ( >> https://xxx.service-now.com/u_cart_request.do?SOAP) >> message: >> >> > xmlns:wsu=" >> http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" >> xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1=" >> http://www.service-now.com/u_cart_request" xmlns:xsi=" >> http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV=" >> http://schemas.xmlsoap.org/soap/envelope/"> >> >> >> >> aaaa >> bbbb >> >> >> 2015-04-27T18:55:22.714722+00:00 >> 2015-04-27T18:56:52.714722+00:00 >> >> >> >> >> >> 12345 >> RMT12345 >> >> >> >> DEBUG:suds.client:headers = {'SOAPAction': '" >> http://www.service-now.com/u_cart_request/insert"', 'Content-Type': >> 'text/xml; charset=utf-8'} >> DEBUG:suds.client:HTTP failed - 500 - Internal Server Error: >> wsse:FailedAuthenticationThe >> security token could not be authenticated or >> authorizedWSSecurity login >> failed >> ERROR:suds.plugin:No signature node found >> Traceback (most recent call last): >> File "/usr/local/lib/python2.7/dist-packages/suds/plugin.py", line 254, >> in __call__ >> method(ctx) >> File "/usr/local/lib/python2.7/dist-packages/soap_wsse/suds_plugin.py", >> line 20, in received >> valid = verify_envelope(context.reply, self.cert_filename) >> File "/usr/local/lib/python2.7/dist-packages/soap_wsse/signing.py", >> line 130, in verify_envelope >> raise CertificationError("No signature node found") >> CertificationError: No signature node found >> ERROR:suds.client: >> e = Server raised fault: 'The security token could not be authenticated >> or authorized' >> >> >> I don't see the BinarySecurityToken in the outgoing XML in the first >> debug message. Shouldn't it be there? The "No signature node found" message >> seems to be related to incoming not outgoing messages, so I'm confused why >> it's happening. >> >> >> >> On Mon, Apr 27, 2015 at 1:13 PM, Iuri wrote: >> >>> I'm using suds-jurko [1] with soap_wsse [2] for this. It is simple. I >>> never tried pysimplesoap. >>> >>> from soap_wsse.suds_plugin import WssePlugin >>> from suds.client import Client >>> from suds.wsse import Security, UsernameToken, Timestamp >>> >>> url = "http://example.com/service?WSDL" >>> username = "test" >>> password = "p at ssw0rd!" >>> certificate = "/your/cert.pem" >>> >>> s = Security() >>> s.tokens.extend([UsernameToken(username, password), Timestamp()]) >>> >>> client = Client(url, plugins=[WssePlugin(certificate)]) >>> client.set_options(wsse=s) >>> >>> [1] https://pypi.python.org/pypi/suds-jurko >>> [2] https://pypi.python.org/pypi/soap_wsse >>> >>> Cheers! >>> >>> >>> On Mon, Apr 27, 2015 at 12:06 PM, Paul Tomblin >>> wrote: >>> >>>> I need to talk to a web service that requires wsse:BinarySecurityToken, >>>> ds:Security, wsse:UsernameToken and wsu:Timestamp headers. I see that the >>>> latest version of pysimplesoap on python.org has some sort of plugin >>>> architecture and a wsse.py for at least some of these headers, but I don't >>>> see any documentation on how to use them. The Google Code page doesn't have >>>> the wsse.py file, and so obviously nothing in their Wiki. >>>> >>>> Can somebody point me to documentation or examples? >>>> >>>> >>>> -- >>>> http://www.linkedin.com/in/paultomblin >>>> http://careers.stackoverflow.com/ptomblin >>>> >>>> _______________________________________________ >>>> Soap mailing list >>>> Soap at python.org >>>> https://mail.python.org/mailman/listinfo/soap >>>> >>>> >>> >> >> >> -- >> http://www.linkedin.com/in/paultomblin >> http://careers.stackoverflow.com/ptomblin >> > > -- http://www.linkedin.com/in/paultomblin http://careers.stackoverflow.com/ptomblin -------------- next part -------------- An HTML attachment was scrubbed... URL: From ovnicraft at gmail.com Mon Apr 27 23:12:53 2015 From: ovnicraft at gmail.com (Ovnicraft) Date: Mon, 27 Apr 2015 16:12:53 -0500 Subject: [Soap-Python] WSSE security In-Reply-To: References: Message-ID: You can test this repo, http://github.com/ovnicraft/suds Give me your feedback please. On Mon, Apr 27, 2015 at 2:02 PM, Paul Tomblin wrote: > This looks really promising, but when I try it with my self-signed > certificate, I get the following error: > > DEBUG:suds.client:sending to ( > https://xxx.service-now.com/u_cart_request.do?SOAP) > message: > > xmlns:wsu=" > http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" > xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1=" > http://www.service-now.com/u_cart_request" xmlns:xsi=" > http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV=" > http://schemas.xmlsoap.org/soap/envelope/"> > > > > aaaa > bbbb > > > 2015-04-27T18:55:22.714722+00:00 > 2015-04-27T18:56:52.714722+00:00 > > > > > > 12345 > RMT12345 > > > > DEBUG:suds.client:headers = {'SOAPAction': '" > http://www.service-now.com/u_cart_request/insert"', 'Content-Type': > 'text/xml; charset=utf-8'} > DEBUG:suds.client:HTTP failed - 500 - Internal Server Error: > wsse:FailedAuthenticationThe > security token could not be authenticated or > authorizedWSSecurity login > failed > ERROR:suds.plugin:No signature node found > Traceback (most recent call last): > File "/usr/local/lib/python2.7/dist-packages/suds/plugin.py", line 254, > in __call__ > method(ctx) > File "/usr/local/lib/python2.7/dist-packages/soap_wsse/suds_plugin.py", > line 20, in received > valid = verify_envelope(context.reply, self.cert_filename) > File "/usr/local/lib/python2.7/dist-packages/soap_wsse/signing.py", line > 130, in verify_envelope > raise CertificationError("No signature node found") > CertificationError: No signature node found > ERROR:suds.client: > e = Server raised fault: 'The security token could not be authenticated or > authorized' > > > I don't see the BinarySecurityToken in the outgoing XML in the first debug > message. Shouldn't it be there? The "No signature node found" message seems > to be related to incoming not outgoing messages, so I'm confused why it's > happening. > > > > On Mon, Apr 27, 2015 at 1:13 PM, Iuri wrote: > >> I'm using suds-jurko [1] with soap_wsse [2] for this. It is simple. I >> never tried pysimplesoap. >> >> from soap_wsse.suds_plugin import WssePlugin >> from suds.client import Client >> from suds.wsse import Security, UsernameToken, Timestamp >> >> url = "http://example.com/service?WSDL" >> username = "test" >> password = "p at ssw0rd!" >> certificate = "/your/cert.pem" >> >> s = Security() >> s.tokens.extend([UsernameToken(username, password), Timestamp()]) >> >> client = Client(url, plugins=[WssePlugin(certificate)]) >> client.set_options(wsse=s) >> >> [1] https://pypi.python.org/pypi/suds-jurko >> [2] https://pypi.python.org/pypi/soap_wsse >> >> Cheers! >> >> >> On Mon, Apr 27, 2015 at 12:06 PM, Paul Tomblin >> wrote: >> >>> I need to talk to a web service that requires wsse:BinarySecurityToken, >>> ds:Security, wsse:UsernameToken and wsu:Timestamp headers. I see that the >>> latest version of pysimplesoap on python.org has some sort of plugin >>> architecture and a wsse.py for at least some of these headers, but I don't >>> see any documentation on how to use them. The Google Code page doesn't have >>> the wsse.py file, and so obviously nothing in their Wiki. >>> >>> Can somebody point me to documentation or examples? >>> >>> >>> -- >>> http://www.linkedin.com/in/paultomblin >>> http://careers.stackoverflow.com/ptomblin >>> >>> _______________________________________________ >>> Soap mailing list >>> Soap at python.org >>> https://mail.python.org/mailman/listinfo/soap >>> >>> >> > > > -- > http://www.linkedin.com/in/paultomblin > http://careers.stackoverflow.com/ptomblin > > _______________________________________________ > Soap mailing list > Soap at python.org > https://mail.python.org/mailman/listinfo/soap > > -- [image: Cristian Salamea on about.me] Cristian Salamea about.me/ovnicraft -------------- next part -------------- An HTML attachment was scrubbed... URL: From iurisilvio at gmail.com Mon Apr 27 19:13:57 2015 From: iurisilvio at gmail.com (Iuri) Date: Mon, 27 Apr 2015 14:13:57 -0300 Subject: [Soap-Python] WSSE security In-Reply-To: References: Message-ID: I'm using suds-jurko [1] with soap_wsse [2] for this. It is simple. I never tried pysimplesoap. from soap_wsse.suds_plugin import WssePlugin from suds.client import Client from suds.wsse import Security, UsernameToken, Timestamp url = "http://example.com/service?WSDL" username = "test" password = "p at ssw0rd!" certificate = "/your/cert.pem" s = Security() s.tokens.extend([UsernameToken(username, password), Timestamp()]) client = Client(url, plugins=[WssePlugin(certificate)]) client.set_options(wsse=s) [1] https://pypi.python.org/pypi/suds-jurko [2] https://pypi.python.org/pypi/soap_wsse Cheers! On Mon, Apr 27, 2015 at 12:06 PM, Paul Tomblin wrote: > I need to talk to a web service that requires wsse:BinarySecurityToken, > ds:Security, wsse:UsernameToken and wsu:Timestamp headers. I see that the > latest version of pysimplesoap on python.org has some sort of plugin > architecture and a wsse.py for at least some of these headers, but I don't > see any documentation on how to use them. The Google Code page doesn't have > the wsse.py file, and so obviously nothing in their Wiki. > > Can somebody point me to documentation or examples? > > > -- > http://www.linkedin.com/in/paultomblin > http://careers.stackoverflow.com/ptomblin > > _______________________________________________ > Soap mailing list > Soap at python.org > https://mail.python.org/mailman/listinfo/soap > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From iurisilvio at gmail.com Mon Apr 27 21:25:24 2015 From: iurisilvio at gmail.com (Iuri) Date: Mon, 27 Apr 2015 16:25:24 -0300 Subject: [Soap-Python] WSSE security In-Reply-To: References: Message-ID: The signature is not shown in the suds.client logging. I created a small log plugin to print the request/response. class LogPlugin(MessagePlugin): def sending(self, context): print str(context.envelope) def received(self, context): print str(context.reply) # add the LogPlugin after the WssePlugin client = Client(url, plugins=[WssePlugin(certificate), LogPlugin()]) This plugin will print the signed request (if it is really signed). I don't remember exactly what was happening, but in some cases the WssePlugin failed silently. No signature and no error. Maybe it is your case. Check if your PEM certificate is loading correctly: from OpenSSL import crypto print crypto.load_certificate(crypto.FILETYPE_PEM, open(key_file).read()) The verify_envelope[1] is used when you receive the server response. [1] https://github.com/mvantellingen/py-soap-wsse/blob/ffd25323cd05ac85d36411f67270d9801935c9e0/src/soap_wsse/suds_plugin.py I don't know what scenario the soap_wsse author considered, but the plugin expects the response signed with the same key. I fixed with a little hack: class OutboundWssePlugin(WssePlugin): def received(self, context): pass # use OutboundWssePlugin instead of the original WssePlugin here client = Client(url, plugins=[OutboundWssePlugin(certificate), LogPlugin()]) Now, the plugin will not expect a signed answer. On Mon, Apr 27, 2015 at 4:02 PM, Paul Tomblin wrote: > This looks really promising, but when I try it with my self-signed > certificate, I get the following error: > > DEBUG:suds.client:sending to ( > https://xxx.service-now.com/u_cart_request.do?SOAP) > message: > > xmlns:wsu=" > http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" > xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1=" > http://www.service-now.com/u_cart_request" xmlns:xsi=" > http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV=" > http://schemas.xmlsoap.org/soap/envelope/"> > > > > aaaa > bbbb > > > 2015-04-27T18:55:22.714722+00:00 > 2015-04-27T18:56:52.714722+00:00 > > > > > > 12345 > RMT12345 > > > > DEBUG:suds.client:headers = {'SOAPAction': '" > http://www.service-now.com/u_cart_request/insert"', 'Content-Type': > 'text/xml; charset=utf-8'} > DEBUG:suds.client:HTTP failed - 500 - Internal Server Error: > wsse:FailedAuthenticationThe > security token could not be authenticated or > authorizedWSSecurity login > failed > ERROR:suds.plugin:No signature node found > Traceback (most recent call last): > File "/usr/local/lib/python2.7/dist-packages/suds/plugin.py", line 254, > in __call__ > method(ctx) > File "/usr/local/lib/python2.7/dist-packages/soap_wsse/suds_plugin.py", > line 20, in received > valid = verify_envelope(context.reply, self.cert_filename) > File "/usr/local/lib/python2.7/dist-packages/soap_wsse/signing.py", line > 130, in verify_envelope > raise CertificationError("No signature node found") > CertificationError: No signature node found > ERROR:suds.client: > e = Server raised fault: 'The security token could not be authenticated or > authorized' > > > I don't see the BinarySecurityToken in the outgoing XML in the first debug > message. Shouldn't it be there? The "No signature node found" message seems > to be related to incoming not outgoing messages, so I'm confused why it's > happening. > > > > On Mon, Apr 27, 2015 at 1:13 PM, Iuri wrote: > >> I'm using suds-jurko [1] with soap_wsse [2] for this. It is simple. I >> never tried pysimplesoap. >> >> from soap_wsse.suds_plugin import WssePlugin >> from suds.client import Client >> from suds.wsse import Security, UsernameToken, Timestamp >> >> url = "http://example.com/service?WSDL" >> username = "test" >> password = "p at ssw0rd!" >> certificate = "/your/cert.pem" >> >> s = Security() >> s.tokens.extend([UsernameToken(username, password), Timestamp()]) >> >> client = Client(url, plugins=[WssePlugin(certificate)]) >> client.set_options(wsse=s) >> >> [1] https://pypi.python.org/pypi/suds-jurko >> [2] https://pypi.python.org/pypi/soap_wsse >> >> Cheers! >> >> >> On Mon, Apr 27, 2015 at 12:06 PM, Paul Tomblin >> wrote: >> >>> I need to talk to a web service that requires wsse:BinarySecurityToken, >>> ds:Security, wsse:UsernameToken and wsu:Timestamp headers. I see that the >>> latest version of pysimplesoap on python.org has some sort of plugin >>> architecture and a wsse.py for at least some of these headers, but I don't >>> see any documentation on how to use them. The Google Code page doesn't have >>> the wsse.py file, and so obviously nothing in their Wiki. >>> >>> Can somebody point me to documentation or examples? >>> >>> >>> -- >>> http://www.linkedin.com/in/paultomblin >>> http://careers.stackoverflow.com/ptomblin >>> >>> _______________________________________________ >>> Soap mailing list >>> Soap at python.org >>> https://mail.python.org/mailman/listinfo/soap >>> >>> >> > > > -- > http://www.linkedin.com/in/paultomblin > http://careers.stackoverflow.com/ptomblin > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tmcallaghan at gmail.com Mon Apr 27 23:22:32 2015 From: tmcallaghan at gmail.com (Tim Callaghan) Date: Mon, 27 Apr 2015 17:22:32 -0400 Subject: [Soap-Python] Can't get my request to work in pysimplesoap SoapClient Message-ID: Here's my code. When I "print bd.as_xml()" it looks good to me, but all that ends up in my is 2015-04-24T00:00:00, not 2015-04-24T00:00:00. Help. -Tim -------- BEGIN CODE -------------- from pysimplesoap.client import SoapClient from pysimplesoap.simplexml import SimpleXMLElement soapLocation="https://www.changed-for-example.com/Sales2.svc " soapAction=" http://www.changed-for-example.com/webservices/sales/v2/ISalesWebService2/ " nsValue="v2" namespaceValue="http://www.changed-for-example.com/webservices/sales/v2 " httpHeaders = {'AccessToken':'**NOT*THE*REAL*TOKEN', 'LocationToken':' **NOT*THE*REAL*TOKEN'} client = SoapClient(location=soapLocation,action=soapAction,namespace=namespaceValue,ns=nsValue,trace=True,http_headers=httpHeaders) bd = SimpleXMLElement("2015-04-24T00:00:00") response = client.GetOrders(request=bd) -------------- next part -------------- An HTML attachment was scrubbed... URL: From reingart at gmail.com Tue Apr 28 00:10:37 2015 From: reingart at gmail.com (Mariano Reingart) Date: Mon, 27 Apr 2015 19:10:37 -0300 Subject: [Soap-Python] WSSE security In-Reply-To: References: Message-ID: Hi Paul: You can see a proof of concept developed for Uruguay electronic invoicing webservice: https://github.com/reingart/py_efactura_uy/blob/master/prueba.py#L101 The relevant code would be: from pysimplesoap.client import SoapClient from pysimplesoap.wsse import BinaryTokenSignature client = SoapClient(...) plugin = BinaryTokenSignature(certificate="certificado.crt", private_key="private.key", password=None, cacert="CorreoUruguayoCA.crt", ) client.plugins += [plugin] Of course you'll have to change the certificate, private key and certification authority. You can use a password if the private key has a pass-phrase. Then you can call remote methods as usual, both using "raw" arbitrary request or WSDL parsed methods, for more info see: https://code.google.com/p/pysimplesoap/wiki/SoapClient You're right, the Google Code wiki is not updated as it will be taken down, but I didn't have time to move it to GitHub yet. But, you can download the latest development code (including WSSE support) from there: https://github.com/pysimplesoap/pysimplesoap Finally, compared to the suds, pysimplesoap implementation is more ad-hoc and you could easily debug it and adapt the xml generated or signing phase, if required (so far it should work out of the box, but I've seen at least a specific server that responds with a special xml canonicalization method/transformation that needs some work). Also, the idea of pysimplesoap is to facilitate experimentation and learning from webservices internals, xml security, etc. In the other side, the suds plug-in seems to be using dm.xmlsec.binding (depending on XMLSec C library, that is very complex and include more dependencies, as far I could analyze) and PyOpenSSL (that is is a rather thin wrapper around (a subset of) the OpenSSL library, according their own documentation) pysimplesoap uses just M2Crypto (that is more complete to PyOpenSSL but you'll have to check python3 experimental support if you need it, AFAIK). Note that lxml dependency is optional. There is even a pure python implementation of a c14n.py module (canonicalization) in pysimplesoap (taken form others projects IIRC), that I'm trying to migrate to Python 3 and enhance, to avoid lxml dependency at all. Best regards Mariano Reingart http://www.sistemasagiles.com.ar http://reingart.blogspot.com On Mon, Apr 27, 2015 at 12:06 PM, Paul Tomblin wrote: > I need to talk to a web service that requires wsse:BinarySecurityToken, > ds:Security, wsse:UsernameToken and wsu:Timestamp headers. I see that the > latest version of pysimplesoap on python.org has some sort of plugin > architecture and a wsse.py for at least some of these headers, but I don't > see any documentation on how to use them. The Google Code page doesn't have > the wsse.py file, and so obviously nothing in their Wiki. > > Can somebody point me to documentation or examples? > > > -- > http://www.linkedin.com/in/paultomblin > http://careers.stackoverflow.com/ptomblin > > _______________________________________________ > Soap mailing list > Soap at python.org > https://mail.python.org/mailman/listinfo/soap > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From reingart at gmail.com Tue Apr 28 00:22:33 2015 From: reingart at gmail.com (Mariano Reingart) Date: Mon, 27 Apr 2015 19:22:33 -0300 Subject: [Soap-Python] Can't get my request to work in pysimplesoap SoapClient In-Reply-To: References: Message-ID: On Mon, Apr 27, 2015 at 6:22 PM, Tim Callaghan wrote: > Here's my code. When I "print bd.as_xml()" it looks good to me, but all > that ends up in my is 2015-04-24T00:00:00, not > > 2015-04-24T00:00:00. Help. -Tim > > > -------- BEGIN CODE -------------- > > from pysimplesoap.client import SoapClient > from pysimplesoap.simplexml import SimpleXMLElement > > soapLocation="https://www.changed-for-example.com/Sales2.svc > " > soapAction=" > http://www.changed-for-example.com/webservices/sales/v2/ISalesWebService2/ > " > nsValue="v2" > namespaceValue="http://www.changed-for-example.com/webservices/sales/v2 > " > httpHeaders = {'AccessToken':'**NOT*THE*REAL*TOKEN', 'LocationToken':' > **NOT*THE*REAL*TOKEN'} > > client = > SoapClient(location=soapLocation,action=soapAction,namespace=namespaceValue,ns=nsValue,trace=True,http_headers=httpHeaders) > > bd = SimpleXMLElement("2015-04-24T00:00:00") > > response = client.GetOrders(request=bd) > > > Can you test the following code instead calling client.getOrders directly? response = client.call("GetOrders", bd) That will detect bd as a raw simple xml object to be serialized. That generates the following output (with BusinessDate included): INFO:pysimplesoap.client:POST https://www.changed-for-example.com/Sales2.svc DEBUG:pysimplesoap.client:SOAPAction: " http://www.changed-for-example.com/webservices/sales/v2/ISalesWebService2/GetOrders " Content-length: 296 Content-type: text/xml; charset="UTF-8" AccessToken: **NOT*THE*REAL*TOKEN LocationToken: **NOT*THE*REAL*TOKEN DEBUG:pysimplesoap.client: 2015-04-24T00:00:00 BTW, from where did you get the response=raw syntax? Best regards, Mariano Reingart http://www.sistemasagiles.com.ar http://reingart.blogspot.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From tmcallaghan at gmail.com Tue Apr 28 02:48:12 2015 From: tmcallaghan at gmail.com (Tim Callaghan) Date: Mon, 27 Apr 2015 20:48:12 -0400 Subject: [Soap-Python] Can't get my request to work in pysimplesoap SoapClient In-Reply-To: References: Message-ID: That worked, so now I'm close. However, I need a little more for this, "2015-04-24T00:00:00". I can easily add the "request" tags, but if I ask for a "v2:" prefix it gives me parsing errors. I got the syntax from here, https://code.google.com/p/pysimplesoap/wiki/SoapClient#Basic_example_not_using_WSDL On Mon, Apr 27, 2015 at 6:22 PM, Mariano Reingart wrote: > On Mon, Apr 27, 2015 at 6:22 PM, Tim Callaghan > wrote: > >> Here's my code. When I "print bd.as_xml()" it looks good to me, but all >> that ends up in my is 2015-04-24T00:00:00, not >> >> 2015-04-24T00:00:00. Help. -Tim >> >> >> -------- BEGIN CODE -------------- >> >> from pysimplesoap.client import SoapClient >> from pysimplesoap.simplexml import SimpleXMLElement >> >> soapLocation="https://www.changed-for-example.com/Sales2.svc >> " >> soapAction=" >> http://www.changed-for-example.com/webservices/sales/v2/ISalesWebService2/ >> " >> nsValue="v2" >> namespaceValue="http://www.changed-for-example.com/webservices/sales/v2 >> " >> httpHeaders = {'AccessToken':'**NOT*THE*REAL*TOKEN', 'LocationToken':' >> **NOT*THE*REAL*TOKEN'} >> >> client = >> SoapClient(location=soapLocation,action=soapAction,namespace=namespaceValue,ns=nsValue,trace=True,http_headers=httpHeaders) >> >> bd = SimpleXMLElement("2015-04-24T00:00:00") >> >> response = client.GetOrders(request=bd) >> >> >> > Can you test the following code instead calling client.getOrders directly? > > response = client.call("GetOrders", bd) > > That will detect bd as a raw simple xml object to be serialized. > That generates the following output (with BusinessDate included): > > INFO:pysimplesoap.client:POST > https://www.changed-for-example.com/Sales2.svc > DEBUG:pysimplesoap.client:SOAPAction: " > http://www.changed-for-example.com/webservices/sales/v2/ISalesWebService2/GetOrders > " > Content-length: 296 > Content-type: text/xml; charset="UTF-8" > AccessToken: **NOT*THE*REAL*TOKEN > LocationToken: **NOT*THE*REAL*TOKEN > DEBUG:pysimplesoap.client: encoding="UTF-8"?> > > > 2015-04-24T00:00:00 > > BTW, from where did you get the response=raw syntax? > > Best regards, > > Mariano Reingart > http://www.sistemasagiles.com.ar > http://reingart.blogspot.com > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From reingart at gmail.com Tue Apr 28 04:13:21 2015 From: reingart at gmail.com (Mariano Reingart) Date: Mon, 27 Apr 2015 23:13:21 -0300 Subject: [Soap-Python] Can't get my request to work in pysimplesoap SoapClient In-Reply-To: References: Message-ID: You'll need to specify the namespace URI so the python parser can detect it (in the same node or in the xml root): bd = SimpleXMLElement("""2015-04-24T00:00:00""" % namespaceValue, ) Regards Mariano Reingart http://www.sistemasagiles.com.ar http://reingart.blogspot.com On Mon, Apr 27, 2015 at 9:48 PM, Tim Callaghan wrote: > That worked, so now I'm close. > > However, I need a little more for this, > "2015-04-24T00:00:00". > I can easily add the "request" tags, but if I ask for a "v2:" prefix it > gives me parsing errors. > > I got the syntax from here, > https://code.google.com/p/pysimplesoap/wiki/SoapClient#Basic_example_not_using_WSDL > > On Mon, Apr 27, 2015 at 6:22 PM, Mariano Reingart > wrote: > >> On Mon, Apr 27, 2015 at 6:22 PM, Tim Callaghan >> wrote: >> >>> Here's my code. When I "print bd.as_xml()" it looks good to me, but all >>> that ends up in my is 2015-04-24T00:00:00, not >>> >>> 2015-04-24T00:00:00. Help. -Tim >>> >>> >>> -------- BEGIN CODE -------------- >>> >>> from pysimplesoap.client import SoapClient >>> from pysimplesoap.simplexml import SimpleXMLElement >>> >>> soapLocation="https://www.changed-for-example.com/Sales2.svc >>> " >>> soapAction=" >>> http://www.changed-for-example.com/webservices/sales/v2/ISalesWebService2/ >>> " >>> nsValue="v2" >>> namespaceValue="http://www.changed-for-example.com/webservices/sales/v2 >>> " >>> httpHeaders = {'AccessToken':'**NOT*THE*REAL*TOKEN', 'LocationToken':' >>> **NOT*THE*REAL*TOKEN'} >>> >>> client = >>> SoapClient(location=soapLocation,action=soapAction,namespace=namespaceValue,ns=nsValue,trace=True,http_headers=httpHeaders) >>> >>> bd = SimpleXMLElement("2015-04-24T00:00:00") >>> >>> response = client.GetOrders(request=bd) >>> >>> >>> >> Can you test the following code instead calling client.getOrders directly? >> >> response = client.call("GetOrders", bd) >> >> That will detect bd as a raw simple xml object to be serialized. >> That generates the following output (with BusinessDate included): >> >> INFO:pysimplesoap.client:POST >> https://www.changed-for-example.com/Sales2.svc >> DEBUG:pysimplesoap.client:SOAPAction: " >> http://www.changed-for-example.com/webservices/sales/v2/ISalesWebService2/GetOrders >> " >> Content-length: 296 >> Content-type: text/xml; charset="UTF-8" >> AccessToken: **NOT*THE*REAL*TOKEN >> LocationToken: **NOT*THE*REAL*TOKEN >> DEBUG:pysimplesoap.client:> encoding="UTF-8"?> >> >> >> 2015-04-24T00:00:00 >> >> BTW, from where did you get the response=raw syntax? >> >> Best regards, >> >> Mariano Reingart >> http://www.sistemasagiles.com.ar >> http://reingart.blogspot.com >> >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tmcallaghan at gmail.com Tue Apr 28 13:50:16 2015 From: tmcallaghan at gmail.com (Tim Callaghan) Date: Tue, 28 Apr 2015 07:50:16 -0400 Subject: [Soap-Python] Can't get my request to work in pysimplesoap SoapClient In-Reply-To: References: Message-ID: I've already defined the v2 ns and namespace in my SoapClient() initialization, why would I want/need to define it again? client = SoapClient(location=soapLocation,action=soapAction,namespace=namespaceValue,ns=nsValue,trace=True,http_headers=httpHeaders) GetOrders gets the v2 ns applied to it automatically, is there a way to have that happen to all elements in SimpleXMLElement automatically? Thanks. -Tim On Mon, Apr 27, 2015 at 10:13 PM, Mariano Reingart wrote: > You'll need to specify the namespace URI so the python parser can detect > it (in the same node or in the xml root): > > bd = SimpleXMLElement(""" xmlns:v2="%s">2015-04-24T00:00:00""" % namespaceValue, > ) > > Regards > > Mariano Reingart > http://www.sistemasagiles.com.ar > http://reingart.blogspot.com > > On Mon, Apr 27, 2015 at 9:48 PM, Tim Callaghan > wrote: > >> That worked, so now I'm close. >> >> However, I need a little more for this, >> "2015-04-24T00:00:00". >> I can easily add the "request" tags, but if I ask for a "v2:" prefix it >> gives me parsing errors. >> >> I got the syntax from here, >> https://code.google.com/p/pysimplesoap/wiki/SoapClient#Basic_example_not_using_WSDL >> >> On Mon, Apr 27, 2015 at 6:22 PM, Mariano Reingart >> wrote: >> >>> On Mon, Apr 27, 2015 at 6:22 PM, Tim Callaghan >>> wrote: >>> >>>> Here's my code. When I "print bd.as_xml()" it looks good to me, but all >>>> that ends up in my is 2015-04-24T00:00:00, not >>>> >>>> 2015-04-24T00:00:00. Help. -Tim >>>> >>>> >>>> -------- BEGIN CODE -------------- >>>> >>>> from pysimplesoap.client import SoapClient >>>> from pysimplesoap.simplexml import SimpleXMLElement >>>> >>>> soapLocation="https://www.changed-for-example.com/Sales2.svc >>>> " >>>> soapAction=" >>>> http://www.changed-for-example.com/webservices/sales/v2/ISalesWebService2/ >>>> " >>>> nsValue="v2" >>>> namespaceValue="http://www.changed-for-example.com/webservices/sales/v2 >>>> " >>>> httpHeaders = {'AccessToken':'**NOT*THE*REAL*TOKEN', 'LocationToken':' >>>> **NOT*THE*REAL*TOKEN'} >>>> >>>> client = >>>> SoapClient(location=soapLocation,action=soapAction,namespace=namespaceValue,ns=nsValue,trace=True,http_headers=httpHeaders) >>>> >>>> bd = >>>> SimpleXMLElement("2015-04-24T00:00:00") >>>> >>>> response = client.GetOrders(request=bd) >>>> >>>> >>>> >>> Can you test the following code instead calling client.getOrders >>> directly? >>> >>> response = client.call("GetOrders", bd) >>> >>> That will detect bd as a raw simple xml object to be serialized. >>> That generates the following output (with BusinessDate included): >>> >>> INFO:pysimplesoap.client:POST >>> https://www.changed-for-example.com/Sales2.svc >>> DEBUG:pysimplesoap.client:SOAPAction: " >>> http://www.changed-for-example.com/webservices/sales/v2/ISalesWebService2/GetOrders >>> " >>> Content-length: 296 >>> Content-type: text/xml; charset="UTF-8" >>> AccessToken: **NOT*THE*REAL*TOKEN >>> LocationToken: **NOT*THE*REAL*TOKEN >>> DEBUG:pysimplesoap.client:>> encoding="UTF-8"?> >>> >>> >>> 2015-04-24T00:00:00 >>> >>> BTW, from where did you get the response=raw syntax? >>> >>> Best regards, >>> >>> Mariano Reingart >>> http://www.sistemasagiles.com.ar >>> http://reingart.blogspot.com >>> >>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tmcallaghan at gmail.com Tue Apr 28 14:21:11 2015 From: tmcallaghan at gmail.com (Tim Callaghan) Date: Tue, 28 Apr 2015 08:21:11 -0400 Subject: [Soap-Python] Can't get my request to work in pysimplesoap SoapClient In-Reply-To: References: Message-ID: I guess my question is really about how I do anything interesting with the call method. At the moment it doesn't seem obvious how I create any non-trivial XML to pass into it, other than simple key/value pairs. I'm calling an API where I need to pass complex XML with nested structures. If you can point me to an example I'd really appreciate it. -Tim On Tue, Apr 28, 2015 at 7:50 AM, Tim Callaghan wrote: > I've already defined the v2 ns and namespace in my SoapClient() > initialization, why would I want/need to define it again? > > client = > SoapClient(location=soapLocation,action=soapAction,namespace=namespaceValue,ns=nsValue,trace=True,http_headers=httpHeaders) > > GetOrders gets the v2 ns applied to it automatically, is there a way to > have that happen to all elements in SimpleXMLElement automatically? > > Thanks. > > -Tim > > > On Mon, Apr 27, 2015 at 10:13 PM, Mariano Reingart > wrote: > >> You'll need to specify the namespace URI so the python parser can detect >> it (in the same node or in the xml root): >> >> bd = SimpleXMLElement("""> xmlns:v2="%s">2015-04-24T00:00:00""" % namespaceValue, >> ) >> >> Regards >> >> Mariano Reingart >> http://www.sistemasagiles.com.ar >> http://reingart.blogspot.com >> >> On Mon, Apr 27, 2015 at 9:48 PM, Tim Callaghan >> wrote: >> >>> That worked, so now I'm close. >>> >>> However, I need a little more for this, >>> "2015-04-24T00:00:00". >>> I can easily add the "request" tags, but if I ask for a "v2:" prefix it >>> gives me parsing errors. >>> >>> I got the syntax from here, >>> https://code.google.com/p/pysimplesoap/wiki/SoapClient#Basic_example_not_using_WSDL >>> >>> On Mon, Apr 27, 2015 at 6:22 PM, Mariano Reingart >>> wrote: >>> >>>> On Mon, Apr 27, 2015 at 6:22 PM, Tim Callaghan >>>> wrote: >>>> >>>>> Here's my code. When I "print bd.as_xml()" it looks good to me, but >>>>> all that ends up in my is 2015-04-24T00:00:00, not >>>>> >>>>> 2015-04-24T00:00:00. Help. -Tim >>>>> >>>>> >>>>> -------- BEGIN CODE -------------- >>>>> >>>>> from pysimplesoap.client import SoapClient >>>>> from pysimplesoap.simplexml import SimpleXMLElement >>>>> >>>>> soapLocation="https://www.changed-for-example.com/Sales2.svc >>>>> " >>>>> soapAction=" >>>>> http://www.changed-for-example.com/webservices/sales/v2/ISalesWebService2/ >>>>> >>>>> " >>>>> nsValue="v2" >>>>> namespaceValue=" >>>>> http://www.changed-for-example.com/webservices/sales/v2 >>>>> " >>>>> httpHeaders = {'AccessToken':'**NOT*THE*REAL*TOKEN', 'LocationToken':' >>>>> **NOT*THE*REAL*TOKEN'} >>>>> >>>>> client = >>>>> SoapClient(location=soapLocation,action=soapAction,namespace=namespaceValue,ns=nsValue,trace=True,http_headers=httpHeaders) >>>>> >>>>> bd = >>>>> SimpleXMLElement("2015-04-24T00:00:00") >>>>> >>>>> response = client.GetOrders(request=bd) >>>>> >>>>> >>>>> >>>> Can you test the following code instead calling client.getOrders >>>> directly? >>>> >>>> response = client.call("GetOrders", bd) >>>> >>>> That will detect bd as a raw simple xml object to be serialized. >>>> That generates the following output (with BusinessDate included): >>>> >>>> INFO:pysimplesoap.client:POST >>>> https://www.changed-for-example.com/Sales2.svc >>>> DEBUG:pysimplesoap.client:SOAPAction: " >>>> http://www.changed-for-example.com/webservices/sales/v2/ISalesWebService2/GetOrders >>>> " >>>> Content-length: 296 >>>> Content-type: text/xml; charset="UTF-8" >>>> AccessToken: **NOT*THE*REAL*TOKEN >>>> LocationToken: **NOT*THE*REAL*TOKEN >>>> DEBUG:pysimplesoap.client:>>> encoding="UTF-8"?> >>>> >>>> >>>> 2015-04-24T00:00:00 >>>> >>>> BTW, from where did you get the response=raw syntax? >>>> >>>> Best regards, >>>> >>>> Mariano Reingart >>>> http://www.sistemasagiles.com.ar >>>> http://reingart.blogspot.com >>>> >>>> >>>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tmcallaghan at gmail.com Tue Apr 28 15:42:41 2015 From: tmcallaghan at gmail.com (Tim Callaghan) Date: Tue, 28 Apr 2015 09:42:41 -0400 Subject: [Soap-Python] Can't get my request to work in pysimplesoap SoapClient In-Reply-To: References: Message-ID: Ultimately, this is the Envelope I need to generate for my first integration. From there I'll be doing substantially more complicated ones (payload wise) with respect to the amount of XML I need to generate inside the Body. It's probably just a few well constructed lines of code, I can't figure them out. 2015-04-24T00:00:00 On Tue, Apr 28, 2015 at 8:21 AM, Tim Callaghan wrote: > I guess my question is really about how I do anything interesting with the > call method. At the moment it doesn't seem obvious how I create any > non-trivial XML to pass into it, other than simple key/value pairs. I'm > calling an API where I need to pass complex XML with nested structures. > > If you can point me to an example I'd really appreciate it. > > -Tim > > > On Tue, Apr 28, 2015 at 7:50 AM, Tim Callaghan > wrote: > >> I've already defined the v2 ns and namespace in my SoapClient() >> initialization, why would I want/need to define it again? >> >> client = >> SoapClient(location=soapLocation,action=soapAction,namespace=namespaceValue,ns=nsValue,trace=True,http_headers=httpHeaders) >> >> GetOrders gets the v2 ns applied to it automatically, is there a way to >> have that happen to all elements in SimpleXMLElement automatically? >> >> Thanks. >> >> -Tim >> >> >> On Mon, Apr 27, 2015 at 10:13 PM, Mariano Reingart >> wrote: >> >>> You'll need to specify the namespace URI so the python parser can detect >>> it (in the same node or in the xml root): >>> >>> bd = SimpleXMLElement(""">> xmlns:v2="%s">2015-04-24T00:00:00""" % namespaceValue, >>> ) >>> >>> Regards >>> >>> Mariano Reingart >>> http://www.sistemasagiles.com.ar >>> http://reingart.blogspot.com >>> >>> On Mon, Apr 27, 2015 at 9:48 PM, Tim Callaghan >>> wrote: >>> >>>> That worked, so now I'm close. >>>> >>>> However, I need a little more for this, >>>> "2015-04-24T00:00:00". >>>> I can easily add the "request" tags, but if I ask for a "v2:" prefix it >>>> gives me parsing errors. >>>> >>>> I got the syntax from here, >>>> https://code.google.com/p/pysimplesoap/wiki/SoapClient#Basic_example_not_using_WSDL >>>> >>>> On Mon, Apr 27, 2015 at 6:22 PM, Mariano Reingart >>>> wrote: >>>> >>>>> On Mon, Apr 27, 2015 at 6:22 PM, Tim Callaghan >>>>> wrote: >>>>> >>>>>> Here's my code. When I "print bd.as_xml()" it looks good to me, but >>>>>> all that ends up in my is 2015-04-24T00:00:00, not >>>>>> >>>>>> 2015-04-24T00:00:00. Help. -Tim >>>>>> >>>>>> >>>>>> -------- BEGIN CODE -------------- >>>>>> >>>>>> from pysimplesoap.client import SoapClient >>>>>> from pysimplesoap.simplexml import SimpleXMLElement >>>>>> >>>>>> soapLocation="https://www.changed-for-example.com/Sales2.svc >>>>>> " >>>>>> soapAction=" >>>>>> http://www.changed-for-example.com/webservices/sales/v2/ISalesWebService2/ >>>>>> >>>>>> " >>>>>> nsValue="v2" >>>>>> namespaceValue=" >>>>>> http://www.changed-for-example.com/webservices/sales/v2 >>>>>> " >>>>>> httpHeaders = {'AccessToken':'**NOT*THE*REAL*TOKEN', 'LocationToken':' >>>>>> **NOT*THE*REAL*TOKEN'} >>>>>> >>>>>> client = >>>>>> SoapClient(location=soapLocation,action=soapAction,namespace=namespaceValue,ns=nsValue,trace=True,http_headers=httpHeaders) >>>>>> >>>>>> bd = >>>>>> SimpleXMLElement("2015-04-24T00:00:00") >>>>>> >>>>>> response = client.GetOrders(request=bd) >>>>>> >>>>>> >>>>>> >>>>> Can you test the following code instead calling client.getOrders >>>>> directly? >>>>> >>>>> response = client.call("GetOrders", bd) >>>>> >>>>> That will detect bd as a raw simple xml object to be serialized. >>>>> That generates the following output (with BusinessDate included): >>>>> >>>>> INFO:pysimplesoap.client:POST >>>>> https://www.changed-for-example.com/Sales2.svc >>>>> DEBUG:pysimplesoap.client:SOAPAction: " >>>>> http://www.changed-for-example.com/webservices/sales/v2/ISalesWebService2/GetOrders >>>>> " >>>>> Content-length: 296 >>>>> Content-type: text/xml; charset="UTF-8" >>>>> AccessToken: **NOT*THE*REAL*TOKEN >>>>> LocationToken: **NOT*THE*REAL*TOKEN >>>>> DEBUG:pysimplesoap.client:>>>> encoding="UTF-8"?> >>>>> >>>>> >>>>> 2015-04-24T00:00:00 >>>>> >>>>> BTW, from where did you get the response=raw syntax? >>>>> >>>>> Best regards, >>>>> >>>>> Mariano Reingart >>>>> http://www.sistemasagiles.com.ar >>>>> http://reingart.blogspot.com >>>>> >>>>> >>>>> >>>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From reingart at gmail.com Tue Apr 28 16:43:28 2015 From: reingart at gmail.com (Mariano Reingart) Date: Tue, 28 Apr 2015 11:43:28 -0300 Subject: [Soap-Python] Can't get my request to work in pysimplesoap SoapClient In-Reply-To: References: Message-ID: You can try the following: XML = """ 2015-04-24T00:00:00 """ % namespaceValue bd = SimpleXMLElement(XML) response = client.call("GetOrders", bd) Best regards, Mariano Reingart http://www.sistemasagiles.com.ar http://reingart.blogspot.com On Tue, Apr 28, 2015 at 10:42 AM, Tim Callaghan wrote: > Ultimately, this is the Envelope I need to generate for my first > integration. From there I'll be doing substantially more complicated ones > (payload wise) with respect to the amount of XML I need to generate inside > the Body. > > It's probably just a few well constructed lines of code, I can't figure > them out. > > xmlns:v2="http://www.no-web-site.com/webservices/sales/v2" xmlns:sys=" > http://schemas.datacontract.org/2004/07/System"> > > > > > 2015-04-24T00:00:00 > > > > > > > On Tue, Apr 28, 2015 at 8:21 AM, Tim Callaghan > wrote: > >> I guess my question is really about how I do anything interesting with >> the call method. At the moment it doesn't seem obvious how I create any >> non-trivial XML to pass into it, other than simple key/value pairs. I'm >> calling an API where I need to pass complex XML with nested structures. >> >> If you can point me to an example I'd really appreciate it. >> >> -Tim >> >> >> On Tue, Apr 28, 2015 at 7:50 AM, Tim Callaghan >> wrote: >> >>> I've already defined the v2 ns and namespace in my SoapClient() >>> initialization, why would I want/need to define it again? >>> >>> client = >>> SoapClient(location=soapLocation,action=soapAction,namespace=namespaceValue,ns=nsValue,trace=True,http_headers=httpHeaders) >>> >>> GetOrders gets the v2 ns applied to it automatically, is there a way to >>> have that happen to all elements in SimpleXMLElement automatically? >>> >>> Thanks. >>> >>> -Tim >>> >>> >>> On Mon, Apr 27, 2015 at 10:13 PM, Mariano Reingart >>> wrote: >>> >>>> You'll need to specify the namespace URI so the python parser can >>>> detect it (in the same node or in the xml root): >>>> >>>> bd = SimpleXMLElement(""">>> xmlns:v2="%s">2015-04-24T00:00:00""" % namespaceValue, >>>> ) >>>> >>>> Regards >>>> >>>> Mariano Reingart >>>> http://www.sistemasagiles.com.ar >>>> http://reingart.blogspot.com >>>> >>>> On Mon, Apr 27, 2015 at 9:48 PM, Tim Callaghan >>>> wrote: >>>> >>>>> That worked, so now I'm close. >>>>> >>>>> However, I need a little more for this, >>>>> "2015-04-24T00:00:00". >>>>> I can easily add the "request" tags, but if I ask for a "v2:" prefix it >>>>> gives me parsing errors. >>>>> >>>>> I got the syntax from here, >>>>> https://code.google.com/p/pysimplesoap/wiki/SoapClient#Basic_example_not_using_WSDL >>>>> >>>>> On Mon, Apr 27, 2015 at 6:22 PM, Mariano Reingart >>>>> wrote: >>>>> >>>>>> On Mon, Apr 27, 2015 at 6:22 PM, Tim Callaghan >>>>> > wrote: >>>>>> >>>>>>> Here's my code. When I "print bd.as_xml()" it looks good to me, but >>>>>>> all that ends up in my is 2015-04-24T00:00:00, not >>>>>>> >>>>>>> 2015-04-24T00:00:00. Help. -Tim >>>>>>> >>>>>>> >>>>>>> -------- BEGIN CODE -------------- >>>>>>> >>>>>>> from pysimplesoap.client import SoapClient >>>>>>> from pysimplesoap.simplexml import SimpleXMLElement >>>>>>> >>>>>>> soapLocation="https://www.changed-for-example.com/Sales2.svc >>>>>>> " >>>>>>> soapAction=" >>>>>>> http://www.changed-for-example.com/webservices/sales/v2/ISalesWebService2/ >>>>>>> >>>>>>> " >>>>>>> nsValue="v2" >>>>>>> namespaceValue=" >>>>>>> http://www.changed-for-example.com/webservices/sales/v2 >>>>>>> " >>>>>>> httpHeaders = {'AccessToken':'**NOT*THE*REAL*TOKEN', >>>>>>> 'LocationToken':'**NOT*THE*REAL*TOKEN'} >>>>>>> >>>>>>> client = >>>>>>> SoapClient(location=soapLocation,action=soapAction,namespace=namespaceValue,ns=nsValue,trace=True,http_headers=httpHeaders) >>>>>>> >>>>>>> bd = >>>>>>> SimpleXMLElement("2015-04-24T00:00:00") >>>>>>> >>>>>>> response = client.GetOrders(request=bd) >>>>>>> >>>>>>> >>>>>>> >>>>>> Can you test the following code instead calling client.getOrders >>>>>> directly? >>>>>> >>>>>> response = client.call("GetOrders", bd) >>>>>> >>>>>> That will detect bd as a raw simple xml object to be serialized. >>>>>> That generates the following output (with BusinessDate included): >>>>>> >>>>>> INFO:pysimplesoap.client:POST >>>>>> https://www.changed-for-example.com/Sales2.svc >>>>>> DEBUG:pysimplesoap.client:SOAPAction: " >>>>>> http://www.changed-for-example.com/webservices/sales/v2/ISalesWebService2/GetOrders >>>>>> " >>>>>> Content-length: 296 >>>>>> Content-type: text/xml; charset="UTF-8" >>>>>> AccessToken: **NOT*THE*REAL*TOKEN >>>>>> LocationToken: **NOT*THE*REAL*TOKEN >>>>>> DEBUG:pysimplesoap.client:>>>>> encoding="UTF-8"?> >>>>>> >>>>>> >>>>>> 2015-04-24T00:00:00 >>>>>> >>>>>> BTW, from where did you get the response=raw syntax? >>>>>> >>>>>> Best regards, >>>>>> >>>>>> Mariano Reingart >>>>>> http://www.sistemasagiles.com.ar >>>>>> http://reingart.blogspot.com >>>>>> >>>>>> >>>>>> >>>>> >>>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From cbeck at railkey.net Tue Apr 28 16:54:36 2015 From: cbeck at railkey.net (Chris Beck) Date: Tue, 28 Apr 2015 10:54:36 -0400 Subject: [Soap-Python] Extending simple types in pysimplesoap In-Reply-To: References: <553568AE.8000209@arskom.com.tr> <553A3067.9010607@arskom.com.tr> Message-ID: Reingart - do you have any thoughts about when pysimplesoap will support extensions to simple types? Burak - is it still to be hoped that Spyne will consider its wsdl parser mature enough to be approved for general automated use in 0.12? Cheers, Chris -- Christopher Beck cbeck at railkey.net +1.514.431.7759 -------------- next part -------------- An HTML attachment was scrubbed... URL: From tmcallaghan at gmail.com Tue Apr 28 19:21:02 2015 From: tmcallaghan at gmail.com (Tim Callaghan) Date: Tue, 28 Apr 2015 13:21:02 -0400 Subject: [Soap-Python] Can't get my request to work in pysimplesoap SoapClient In-Reply-To: References: Message-ID: That worked perfectly, thanks so much for your help. On Tue, Apr 28, 2015 at 10:43 AM, Mariano Reingart wrote: > You can try the following: > > XML = """ > > > 2015-04-24T00:00:00 > > > """ % namespaceValue > bd = SimpleXMLElement(XML) > > response = client.call("GetOrders", bd) > > Best regards, > > Mariano Reingart > http://www.sistemasagiles.com.ar > http://reingart.blogspot.com > > On Tue, Apr 28, 2015 at 10:42 AM, Tim Callaghan > wrote: > >> Ultimately, this is the Envelope I need to generate for my first >> integration. From there I'll be doing substantially more complicated ones >> (payload wise) with respect to the amount of XML I need to generate inside >> the Body. >> >> It's probably just a few well constructed lines of code, I can't figure >> them out. >> >> >> >> >> >> >> 2015-04-24T00:00:00 >> >> >> >> >> >> >> On Tue, Apr 28, 2015 at 8:21 AM, Tim Callaghan >> wrote: >> >>> I guess my question is really about how I do anything interesting with >>> the call method. At the moment it doesn't seem obvious how I create any >>> non-trivial XML to pass into it, other than simple key/value pairs. I'm >>> calling an API where I need to pass complex XML with nested structures. >>> >>> If you can point me to an example I'd really appreciate it. >>> >>> -Tim >>> >>> >>> On Tue, Apr 28, 2015 at 7:50 AM, Tim Callaghan >>> wrote: >>> >>>> I've already defined the v2 ns and namespace in my SoapClient() >>>> initialization, why would I want/need to define it again? >>>> >>>> client = >>>> SoapClient(location=soapLocation,action=soapAction,namespace=namespaceValue,ns=nsValue,trace=True,http_headers=httpHeaders) >>>> >>>> GetOrders gets the v2 ns applied to it automatically, is there a way to >>>> have that happen to all elements in SimpleXMLElement automatically? >>>> >>>> Thanks. >>>> >>>> -Tim >>>> >>>> >>>> On Mon, Apr 27, 2015 at 10:13 PM, Mariano Reingart >>>> wrote: >>>> >>>>> You'll need to specify the namespace URI so the python parser can >>>>> detect it (in the same node or in the xml root): >>>>> >>>>> bd = SimpleXMLElement(""">>>> xmlns:v2="%s">2015-04-24T00:00:00""" % namespaceValue, >>>>> ) >>>>> >>>>> Regards >>>>> >>>>> Mariano Reingart >>>>> http://www.sistemasagiles.com.ar >>>>> http://reingart.blogspot.com >>>>> >>>>> On Mon, Apr 27, 2015 at 9:48 PM, Tim Callaghan >>>>> wrote: >>>>> >>>>>> That worked, so now I'm close. >>>>>> >>>>>> However, I need a little more for this, >>>>>> "2015-04-24T00:00:00". >>>>>> I can easily add the "request" tags, but if I ask for a "v2:" prefix it >>>>>> gives me parsing errors. >>>>>> >>>>>> I got the syntax from here, >>>>>> https://code.google.com/p/pysimplesoap/wiki/SoapClient#Basic_example_not_using_WSDL >>>>>> >>>>>> On Mon, Apr 27, 2015 at 6:22 PM, Mariano Reingart >>>>> > wrote: >>>>>> >>>>>>> On Mon, Apr 27, 2015 at 6:22 PM, Tim Callaghan < >>>>>>> tmcallaghan at gmail.com> wrote: >>>>>>> >>>>>>>> Here's my code. When I "print bd.as_xml()" it looks good to me, but >>>>>>>> all that ends up in my is 2015-04-24T00:00:00, not >>>>>>>> >>>>>>>> 2015-04-24T00:00:00. Help. -Tim >>>>>>>> >>>>>>>> >>>>>>>> -------- BEGIN CODE -------------- >>>>>>>> >>>>>>>> from pysimplesoap.client import SoapClient >>>>>>>> from pysimplesoap.simplexml import SimpleXMLElement >>>>>>>> >>>>>>>> soapLocation="https://www.changed-for-example.com/Sales2.svc >>>>>>>> " >>>>>>>> soapAction=" >>>>>>>> http://www.changed-for-example.com/webservices/sales/v2/ISalesWebService2/ >>>>>>>> >>>>>>>> " >>>>>>>> nsValue="v2" >>>>>>>> namespaceValue=" >>>>>>>> http://www.changed-for-example.com/webservices/sales/v2 >>>>>>>> " >>>>>>>> httpHeaders = {'AccessToken':'**NOT*THE*REAL*TOKEN', >>>>>>>> 'LocationToken':'**NOT*THE*REAL*TOKEN'} >>>>>>>> >>>>>>>> client = >>>>>>>> SoapClient(location=soapLocation,action=soapAction,namespace=namespaceValue,ns=nsValue,trace=True,http_headers=httpHeaders) >>>>>>>> >>>>>>>> bd = >>>>>>>> SimpleXMLElement("2015-04-24T00:00:00") >>>>>>>> >>>>>>>> response = client.GetOrders(request=bd) >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> Can you test the following code instead calling client.getOrders >>>>>>> directly? >>>>>>> >>>>>>> response = client.call("GetOrders", bd) >>>>>>> >>>>>>> That will detect bd as a raw simple xml object to be serialized. >>>>>>> That generates the following output (with BusinessDate included): >>>>>>> >>>>>>> INFO:pysimplesoap.client:POST >>>>>>> https://www.changed-for-example.com/Sales2.svc >>>>>>> DEBUG:pysimplesoap.client:SOAPAction: " >>>>>>> http://www.changed-for-example.com/webservices/sales/v2/ISalesWebService2/GetOrders >>>>>>> " >>>>>>> Content-length: 296 >>>>>>> Content-type: text/xml; charset="UTF-8" >>>>>>> AccessToken: **NOT*THE*REAL*TOKEN >>>>>>> LocationToken: **NOT*THE*REAL*TOKEN >>>>>>> DEBUG:pysimplesoap.client:>>>>>> encoding="UTF-8"?> >>>>>>> >>>>>>> >>>>>>> 2015-04-24T00:00:00 >>>>>>> >>>>>>> BTW, from where did you get the response=raw syntax? >>>>>>> >>>>>>> Best regards, >>>>>>> >>>>>>> Mariano Reingart >>>>>>> http://www.sistemasagiles.com.ar >>>>>>> http://reingart.blogspot.com >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>> >>>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From reingart at gmail.com Tue Apr 28 20:27:56 2015 From: reingart at gmail.com (Mariano Reingart) Date: Tue, 28 Apr 2015 15:27:56 -0300 Subject: [Soap-Python] Extending simple types in pysimplesoap In-Reply-To: References: <553568AE.8000209@arskom.com.tr> <553A3067.9010607@arskom.com.tr> Message-ID: On Tue, Apr 28, 2015 at 11:54 AM, Chris Beck wrote: > Reingart - do you have any thoughts about when pysimplesoap will support > extensions to simple types? > There are several efforts to fix/improve wsdl support in pysimplesoap, for example: https://github.com/pysimplesoap/pysimplesoap/pull/61 I don't have enough time right now to experiment and give you an estimate, but if you can fill an issue in GitHub with a minimal test case to reproduce the bug, it could be seen by other developers too. Nowadays, pysimplesoap has an open and distributed governance model, you can just sent your PR and if it doesn't break backwards compatibility (too much), is compatible with python 3, follows pep 8 (at least minimally), is easy to review (at least by other project member), has acceptable quality, etc., it would be surely merged. Most WSDL issues are not very complex and depends on dialects and minor differences, you can debug and see what is failing, that would be a great advance. Sadly we do not have enough manpower yet to fix old test (for example some webservices are no longer available), so don't guide by the Travis warning. But you can see the following PR with more related info: https://github.com/pysimplesoap/pysimplesoap/pull/51 So far, everyone that sent major contributions has become a commiter, so we encourage all kind of collaborations Eventually I offer commercial tech support (paid) to give priority and the dedication needed by some companies, but only if I could estimate and test it beforehand. Best regards, Mariano Reingart http://www.sistemasagiles.com.ar http://reingart.blogspot.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From burak.arslan at arskom.com.tr Wed Apr 29 05:18:26 2015 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Wed, 29 Apr 2015 06:18:26 +0300 Subject: [Soap-Python] Extending simple types in pysimplesoap In-Reply-To: References: <553568AE.8000209@arskom.com.tr> <553A3067.9010607@arskom.com.tr> Message-ID: <55404D82.1000804@arskom.com.tr> On 04/24/15 17:57, Chris Beck wrote: > Hi Burak, > > Is this work that you are doing to expnd on the implementation the > wsdl parser for the 0.12 Spyne release > (http://spyne.io/docs/2.11/faq.html#how-do-i-implement-a-predefined-wsdl)? Yes. > So if you use the Suds methodology, which *doesn't* have the problem > of extending simple types, and limit the recursion depth it might get > the best of both worlds. > Spyne imports everyting exactly once using correct order given your starting point. So I didn't see any need for a recursion limit. If you later use the types from the schema to implement services, your wsdl document only has what you use. I don't know how suds does it, but I do know that, having briefly worked on what became 0.4, it's not exactly a joy to work with -- too much coupling between what should have been different api layers. Spyne evolved way slower than suds so it doesn't have that problem. If you implement what's missing (see my previous post) you'll be able to use Spyne's schema parser. On 04/28/15 17:54, Chris Beck wrote: > Burak - is it still to be hoped that Spyne will consider its wsdl > parser mature enough to be approved for general automated use in 0.12? There's no WSDL parser in Spyne yet. However, once the schema parsing is done, wsdl parsing doesn't seem to be much of a problem. Best, Burak From tmcallaghan at gmail.com Wed Apr 29 23:01:15 2015 From: tmcallaghan at gmail.com (Tim Callaghan) Date: Wed, 29 Apr 2015 17:01:15 -0400 Subject: [Soap-Python] How do I iterate through the results of a response when they contain prefixes? Message-ID: I have the following data and want to iterate over the "Discounts"? If I didn't have the "a" prefix then the following code would work. for disc in response.GetDiscountsResponse.GetDiscountsResult.Discount: print " ", disc.Name, "[", disc.Id, "]" -- response from server -- 1 Discount 1 2 Discount 2 3 Discount 3 -------------- next part -------------- An HTML attachment was scrubbed... URL: From kpoman at gmail.com Thu Apr 30 02:11:13 2015 From: kpoman at gmail.com (Patricio Stegmann) Date: Thu, 30 Apr 2015 02:11:13 +0200 Subject: [Soap-Python] Spyne: ability to change default results name from FooResult to WhateverXyz ? In-Reply-To: <5538EDFB.9070405@arskom.com.tr> References: <552D57A8.5010406@gmail.com> <552E1A3C.6000807@arskom.com.tr> <5535C96E.5080102@gmail.com> <55366D53.7000301@arskom.com.tr> <55386ABC.8010407@gmail.com> <5538EDFB.9070405@arskom.com.tr> Message-ID: <55417321.3070508@gmail.com> Burak, There is the message, but inside is the result which has its own name. It is automatically generated with Result suffix, but my ws consumer didnt want that. He wanted the name of it's spec on it. I added that keyword and slightly changed some spyne lines. I had lot of issues using multiple namespaces, in the lxml output generation, which I managed to solve using git version, and now it seems to work ok. I have just a simple question. I need to be able to generate something like this: blabla bleble blibli clacla clecle clicli For that I created ComplexModels: class Item(ComplexModel): value = String class ItemList(ComplexModel): Elements = Array(Item) class MyResponse(ComplexModel): Items = Array(ItemList) ... (oversimplified) ... obviously this creates an output similar to this: .... etc... the Elements part here is useless. However I dont know how I could append Item to an Items variable without declaring Elements as an internal variable, thus making it appear when serializing. Am I doing something wrong here ???? On 23/04/2015 15:04, Burak Arslan wrote: > > > On 04/23/15 06:45, Patricio Stegmann wrote: >> Burak, >> I was able to monkey-patch the lib allowing it to carry and treat a >> _out_result_name kwarg and substitute when building response / result >> name, and it kinda works. > > Wait, _out_message_name didn't work? > >> >> They really seem quite similar with only namespace compatible >> differences. Do you have any clue what could be wrong > > > Yes, namespaces of the spyne example are different, which is quite > important in the xml world. > > Could you put your service somewhere I can reach (e.g. github gist) > I'd like to dig deeper and find out whether it's a Spyne bug. > > Best, > Burak --- This email has been checked for viruses by Avast antivirus software. http://www.avast.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From burak.arslan at arskom.com.tr Thu Apr 30 10:26:59 2015 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Thu, 30 Apr 2015 11:26:59 +0300 Subject: [Soap-Python] Spyne: ability to change default results name from FooResult to WhateverXyz ? In-Reply-To: <55417321.3070508@gmail.com> References: <552D57A8.5010406@gmail.com> <552E1A3C.6000807@arskom.com.tr> <5535C96E.5080102@gmail.com> <55366D53.7000301@arskom.com.tr> <55386ABC.8010407@gmail.com> <5538EDFB.9070405@arskom.com.tr> <55417321.3070508@gmail.com> Message-ID: <5541E753.8040701@arskom.com.tr> Hello, On 04/30/15 03:11, Patricio Stegmann wrote: > Burak, > There is the message, but inside is the result which has its own name. > It is automatically generated with Result suffix, but my ws consumer > didnt want that. He wanted the name of it's spec on it. I added that > keyword and slightly changed some spyne lines. > I had lot of issues using multiple namespaces, in the lxml output > generation, which I managed to solve using git version, and now it > seems to work ok. I'm always interested in ways people patch Spyne. If you think it's worthy, please let me know. > I have just a simple question. I need to be able to generate something > like this: > > > > > blabla > bleble > blibli > > > clacla > clecle > clicli > > > from spyne import * from spyne.util.xml import * from lxml import etree class ItemList(ComplexModel): of_type = XmlAttribute(Unicode(sub_name='ofType')) items = Unicode(max_occurs='unbounded', sub_name='Item') # 2.12 will support this, which is imo nicer to look at: items = Array(Unicode, wrapped=False, sub_name='Item') class MyResponse(ComplexModel): items = Array(ItemList, sub_name="Items") print etree.tostring(get_object_as_xml(MyResponse( items=[ ItemList(of_type="b", items=[ "blabla", "bleble", 'blibli', ]), ItemList(of_type="c", items=[ "clacla", "clecle", 'clicli', ]), ] )), pretty_print=True) The sub_name additions here are to prevent you from breaking the PEP8 rules. hth, burak -------------- next part -------------- An HTML attachment was scrubbed... URL: