From phd1501101003 at iiti.ac.in Wed May 6 11:09:22 2015 From: phd1501101003 at iiti.ac.in (Gyan Prakash Tiwary) Date: Wed, 6 May 2015 14:39:22 +0530 Subject: [Soap-Python] To Enquire about a Complete Reference Message-ID: Hello all, I am very new with web services. I do not know JAVA, but I know Python. As we know there are many tutorials on youtube and books available who teach complete web services concepts both SOAP and REST from scratch using JAVA. But I did not seen such tutorials or Books using Python. Please guide me how can I learn web services and web services security concepts from scratch using Python. Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: From kpoman at gmail.com Thu May 14 20:51:48 2015 From: kpoman at gmail.com (Patricio Stegmann) Date: Thu, 14 May 2015 15:51:48 -0300 Subject: [Soap-Python] Spyne: ability to change default results name from FooResult to WhateverXyz ? In-Reply-To: <5541E753.8040701@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> <55417321.3070508@gmail.com> <5541E753.8040701@arskom.com.tr> Message-ID: <5554EEC4.9070400@gmail.com> Burak, """ import os, sys, time from spyne.model.primitive import String, Integer, Boolean, DateTime, Float from spyne.server import wsgi from spyne.model import ByteArray from spyne.model.complex import Array, ComplexModel, XmlAttribute from spyne.model.enum import Enum from spyne import * from spyne.util.xml import * from lxml import etree class FingerImageType(ComplexModel): #__namespace__ = 'tns' Version = String NumberOfDistinctPositions = Integer RepresentationList = String class Template(ComplexModel): Position = String Data = String class TemplateListType(ComplexModel): #__namespace__ = 'tns' TemplateType = XmlAttribute(String) templates = Array(Template, wrapped=False)#max_occurs='unbounded', sub_name='Template') __type_name__ = 'TemplateList' class RecuperaConteudoType(ComplexModel): id = String class RecuperaConteudoResponseType(ComplexModel): #__namespace__ = 'tns'l FingerImagem = FingerImageType templates = Array(TemplateListType, sub_name='Templates') print etree.tostring( get_object_as_xml(RecuperaConteudoResponseType( FingerImagem=FingerImageType(), templates = [ TemplateListType( TemplateType='ANSI', templates=[ Template(Position='one', Data='data-one'), Template(Position='two', Data='data-two') ] ), TemplateListType( TemplateType='XYT_NIST', templates=[ Template(Position='three', Data='data-three'), Template(Position='two', Data='data-four') ] ) ] ) ), pretty_print=True ) """ I am almost there: this prints the following: The problem is that I want to get rid of container, I want TemplateList to have, inside, directly, Template blocks ! On 30/04/2015 05:26, Burak Arslan wrote: > 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 > > --- This email has been checked for viruses by Avast antivirus software. http://www.avast.com -------------- next part -------------- An HTML attachment was scrubbed... URL: