This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"security": { | |
"name": "my security", | |
"type": "wss", | |
"username": "my user", | |
"password": "my password", | |
}, | |
"outconns": { | |
"my external app": { | |
"type": "soap", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
request = {'from':'EUR', 'to':'HRK'} | |
response = get_exchange_rate(request) | |
print(response.rate) | |
# 1 EUR = 7.4680 HRK as of Jun 13, 2013, 5:00PM GMT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.template.response import TemplateResponse | |
def home(req): | |
# A dictionary of input data read from HTTP GET. If no input was given | |
# we translate from EUR to HRK. | |
to = req.GET.get('to', 'HRK') | |
request = {'from':'EUR', 'to':to} | |
# Pass the dictionary into the client's invoke method along with the name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from zato.client import AnyServiceInvoker | |
class ZatoMiddleware(object): | |
def process_request(self, req): | |
req.zato_client = AnyServiceInvoker('http://localhost:17010', | |
'/django/sample', ('django-app', 'django-password')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form action="." method="get"> | |
From EUR to | |
<input type="text" name="to" value="{{ to }}" /> | |
<input type="submit" value="Get exchange rates" /> | |
</form> | |
<table id="rates"> | |
<tr> | |
<th>Provider</th> | |
<th>Rate</th> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from __future__ import absolute_import, division, print_function, unicode_literals | |
# stdlib | |
from datetime import datetime | |
from traceback import format_exc | |
# anyjson | |
from anyjson import loads |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ zato service invoke /opt/server1/ zato.security.basic-auth.get-list \ | |
--payload '{"cluster_id":1}' | |
[{u'username': u'admin.invoke', u'is_active': True, | |
u'realm': u'Zato admin invoke', u'id': 1L, u'name': u'admin.invoke'}, | |
{u'username': u'pubapi', u'is_active': True, u'realm': u'Zato public API', | |
u'id': 2L, u'name': u'pubapi'}] | |
$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ zato service invoke /opt/server1 zato.security.basic-auth.get-list \ | |
--data-format xml \ | |
--payload '<zato_security_basic_auth_get_list_request><cluster_id>1</cluster_id>\ | |
</zato_security_basic_auth_get_list_request>' | |
<zato_security_basic_auth_get_list_response xmlns="https://zato.io/ns/20130518"> | |
<zato_env> | |
<cid>K034857440351657368008263132215876374901</cid> | |
<result>ZATO_OK</result> | |
</zato_env> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from zato.server.service import Service | |
class MyService(Service): | |
def handle(self): | |
# JMS WebSphere MQ | |
self.outgoing.jms_wmq.conn.send(self.request.payload, 'JMS MQ app', 'QUEUE.1') | |
# AMQP | |
self.outgoing.amqp.conn.send(self.request.payload, 'AMQP app', 'EXCH.1', '/') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# anyjson | |
from anyjson import loads | |
# bunch | |
from bunch import bunchify | |
# decimal | |
from decimal import Decimal | |
# lxml |