spyne

Remove the namespace from Spyne response variables

随声附和 提交于 2019-12-19 10:07:30
问题 Implementing a WebService according to a specific WSDL. Client cannot be changed. Correctly processing request from Client, but Client is complaining on Response because of namespace in variables. What I want (soapUI response based on WSDL): <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cal="http://callback.foo.com/"> <soapenv:Header/> <soapenv:Body> <cal:foo_statusResponse> <result>SUCCESS</result> <notify>Thanks!</notify> </cal:foo_statusResponse> <

Restrict spyne SOAP service with oauth2_provider

隐身守侯 提交于 2019-12-12 04:37:27
问题 I need to restrict some of my SOAP method so they can only be accessible with an Access Token. My SOAP service is running with Spyne and my OAuth2 provider comes from django-oauth2-toolkit. from django.contrib.auth.decorators import login_required from spyne.service import ServiceBase from spyne.decorator import srpc, rpc from oauth2_provider.views.generic import ProtectedResourceView class SOAPService(ProtectedResourceView, ServiceBase): @rpc(Unicode, _returns=Unicode) @login_required() def

Name customization for attribute_of

瘦欲@ 提交于 2019-12-12 00:09:01
问题 I'm playing with attribute_of and spyne 2.10 (very glad it's out). Let's consider following model: class Product(ComplexModel): id = complex.XmlAttribute(primitive.Uuid) edition = primitive.Unicode edition_id = complex.XmlAttribute(primitive.Uuid, attribute_of='edition') That gives results like: <product id="00000000-0000-0000-0000-000000000000"> <edition edition_id="00000000-0000-0000-0000-000000000000">My edition</edition> </product> How to customize edition_id 's name for results like

python spyne service - base64 strings come escaped

泄露秘密 提交于 2019-12-11 17:57:12
问题 I have a simple spyne service: class JiraAdapter(ServiceBase): @srpc(Unicode, String, Unicode, _returns=Status) def CreateJiraIssueWithBase64Attachment(summary, base64attachment, attachment_filename): status = Status try: newkey = jira_client.createWithBase64Attachment(summary, base64attachment, attachment_filename) status.Code = StatusCodes.IssueCreated status.Message = unicode(newkey) except Exception as e: status.Code = StatusCodes.InternalError status.Message = u'Internal Exception: %s' %

Create multiple services using Spyne

蹲街弑〆低调 提交于 2019-12-11 08:39:12
问题 I'm trying to create a SOAP web services using Spyne. Based on the simple Hello example, I want to create 2 different services: from spyne.application import Application from spyne.protocol.soap import Soap11 from spyne.server.wsgi import WsgiApplication from spyne.decorator import rpc from spyne.service import ServiceBase from spyne.model.complex import Iterable from spyne.model.primitive import Unicode class HelloWorldService(ServiceBase): @rpc(Unicode, _returns=Iterable(Unicode)) def say

Spyne server with complex input

泄露秘密 提交于 2019-12-11 05:41:56
问题 I am trying to write a simple python server using Spyne, I have gone over the hello world examples, and now trying to do something a bit more sophisticated. Sadly, there are little to no examples for this (or at least, I couldn't find anything helpful) I am sending the following XML to the server: <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <ObjectA xmlns="urn:SNSR

How to describe element attributes with Spyne

丶灬走出姿态 提交于 2019-12-08 05:50:41
问题 I'm ok with Spyne's hello world examples, but when it comes to something more complex I faced with lack of documentation and advanced examples. In my case I have a service method which accepts body like this <OTA_HotelAvailRQ xmlns="http://www.opentravel.org/OTA/2003/05" Version="1.0" TimeStamp="2005-08-01T09:30:47+02:00" EchoToken="fb57388d" AvailRatesOnly="true"> <AvailRequestSegments> <AvailRequestSegment AvailReqType="Room"> <HotelSearchCriteria> <Criterion> <HotelRef HotelCode="HOTEL1"/>

Spyne - how to duplicate one elements of wsdl file created by spyne?

懵懂的女人 提交于 2019-12-08 03:13:26
问题 I need to duplicate one of the elements of generated wsdl file. My code is like this: class SDPSimulator(ServiceBase): @rpc(UserCredential, Unicode, Unicode, Unicode, Integer, _returns=SendSmsReturn.customize(sub_name='return')) def sendSms(ctx, userCredential, srcAddress, regionIds,msgBody,maxSendCount): I want to create my request wsdl file like this with Spyne: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:loc="localhost" xmlns:apps="apps.simulator.views

Qualified element/attribute forms and unqualified forms with Spyne soap server

♀尐吖头ヾ 提交于 2019-12-06 05:21:00
问题 Is there any way to use elementFormDefault="unqualified" server schema type with Spyne server? Now my all trials end up with method response result: <senv:Envelope xmlns:tns="http://test.com/remoteService/" xmlns:senv="http://schemas.xmlsoap.org/soap/envelope/"> <senv:Body> <tns:testResponse> <tns:status>ok</tns:status> </tns:testResponse> </senv:Body> And generated wsdl fragment with "qualified" elementFormDefault : <xs:schema targetNamespace="http://test.com/remoteService/"

There is an example of Spyne client?

落花浮王杯 提交于 2019-12-06 00:17:01
问题 I'm trying to use spyne (http://spyne.io) in my server with ZeroMQ and MsgPack. I've followed the examples to program the server side, but i can't find any example that helps me to know how to program the client side. I've found the class spyne.client.zeromq.ZeroMQClient , but I don't know what it's supposed to be the 'app' parameter of its constructor. Thank you in advance! Edit: The (simplified) server-side code: from spyne.application import Application from spyne.protocol.msgpack import