Comments (11)
this is also needed to transform soaplib from a soap server library to a generic soap parsing library.
from spyne.
the plan is to split wsgi.Application class in two. The part that will remain in wsgi module will obviously handle only the wsgi-related parts. everything else will be moved to the soaplib.Application class. it will have at least those public methods:
class Application(object):
def parse_request(self,istr):
"""Takes an input stream containing ONE soap message.
Returns the native python object.
"""
pass
def process_request(self,req_obj)
"""Takes the native request object.
Returns the response to the request as a native python object
"""
pass
def push_response(self,ostr, resp_obj)
"""Pushes the native python object to the output stream as a
soap response
"""
pass
def get_wsdl(self):
"""Returns the application wsdl"""
pass
from spyne.
This is great. I was sitting down this morning to plan work on this issues for the rest of the week. Also, I just did a pull master and I see that you've begun implementing the plan.
I'd really like to help with this but, I don't want to step on your toes.
Can you let me know where you'd prefer I'd pitch in on this? I've got plenty of time to work on this right now since soaplib looks pretty core to some of our new project's.
from spyne.
the interface has changed a bit, but it's essentially the same.
let me stabilize the api, then we'll talk.
from spyne.
i think i've got the basics to work. please hunt down bugs by writing tests / fixing the ones that fail.
this is the public api. what do you think?
class Application(object):
def deserialize_soap(self, envelope_string, charset=None):
"""Takes a string containing ONE soap message.
Returns the corresponding native python object, along with the request
context
Not meant to be overridden.
"""
def process_request(self,ctx,req_obj):
"""Takes the native request object.
Returns the response to the request as a native python object.
Not meant to be overridden.
"""
def serialize_soap(self, ctx, native_obj):
"""Pushes the native python object to the output stream as a
soap response
Not meant to be overridden.
"""
def get_namespace_prefix(self, ns):
"""Returns the namespace prefix for the given namespace.
Creates a new one automatically if it doesn't exist
Not meant to be overridden.
"""
def set_namespace_prefix(self, ns, pref):
"""Forces a namespace prefix on a namespace by either
creating it or moving the existing namespace to a new prefix
Not meant to be overridden.
"""
def get_name(self):
"""Returns service name that is seen in the name attribute
of the definitions tag.
Not meant to be overridden.
"""
def get_tns(self):
"""Returns default namespace that is seen in the targetNamespace
attribute of the definitions tag.
Not meant to be overridden.
"""
def get_service_class(self, method_name):
"""This call maps method names to the services that will handle
them.
Override this function to alter the method mappings. Just try
not to get too crazy with regular expressions :)
"""
def get_service(self, service, http_req_env=None):
"""The function that maps service classes to service instances.
Overriding this function is useful in case e.g. you need to
pass additional parameters to service constructors.
"""
def get_schema(self):
"""Simple accessor method that caches application's xml schema,
once generated.
Not meant to be overridden.
"""
def get_wsdl(self, url):
"""Simple accessor method that caches the wsdl of the
application, once generated.
Not meant to be overridden.
"""
def validate_request(self, payload):
"""Method to be overriden to perform any sort of custom input
validation.
"""
def on_exception_object(self, exc):
'''Called when the app throws an exception. (might be inside or
outside the service call.
@param the wsgi environment
@param the fault object
'''
def on_exception_xml(self, fault_xml):
'''Called when the app throws an exception. (might be inside or
outside the service call.
@param the wsgi environment
@param the xml element containing the xml serialization of the
fault
'''
from spyne.
I thinks looks pretty good. I've started working on the tests today I should have a pull request for you tomorrow.
from spyne.
i'm not happy with two properties of the context object:
- it's created only by the serialize_soap call.
- it's in fact the service definition object.
here's how i think those issues should be addressed:
- separate context creation into its own public method: create_call_context
- the said function will return an RpcContext object that will have the service definition instance in a public instance variable called 'service'.
i haven't started implementing this yet. if anyone does, please drop a notice here so that we don't step on each other's toes.
from spyne.
the above is implemented in 6e41a83.
from spyne.
from spyne.
the next step is to implement alternative transports and patterns in order to validate current api and its implementation.
from spyne.
zeromq transport is implemented. i consider this job accomplished. closing issue.
from spyne.
Related Issues (20)
- spyne.model.complex.XmlAttribute issue HOT 1
- ComplexModels attempting to use in-line customization are silently dropped from inheriting objects HOT 2
- Add Starlette as server transport option HOT 2
- Modernise to use type annotations rather than @rpc(Unicode, Integer, _returns=Iterable(Unicode)) HOT 2
- only old docs available HOT 1
- How to use the type AnyXml correctly? HOT 1
- Strategies for dealing with broken clients? (invalid documents) HOT 3
- Python3 - TypeError: sequence item 0: expected a bytes-like object, int found
- spyne.server.django.DjangoView.as_view small bug HOT 1
- Flask Example Werkzeug DispatcherMiddleware import does not work
- GHSL-2021-115 HOT 3
- SQLAlchemy 1.4 support HOT 2
- etreeconv: Python 3.10 incompatible "collections.Sized"
- Exposing simple types on WSDL with Spyne
- Unable to use ByteArray value received HOT 3
- Re-opening issue on ByteArray HOT 1
- I could not read data from wsdl file
- How to get access soap request body elements
- Returning response is not xml format, it is json HOT 4
- Aarry not add xml tag HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spyne.