Documentation > Administration > HTTP Bridge > HTTP Bridge Callee

HTTP Bridge Callee

The HTTP Callee feature is available starting with Crossbar 0.10.3.

  • The HTTP Callee is a service that translates WAMP procedures to HTTP requests.

Try it

Clone the examples repository, and go to the rest/callee subdirectory.

Now start Crossbar:

crossbar start

This example is configured to register a WAMP procedure named, which sends requests to The procedure's complete keyword arguments are detailed further down, but if we use a kwargs of {"url": "get", "method": "GET"}, Crossbar will send a HTTP GET request to and respond with the result. You can test this using the HTTP Caller configured in the example:

curl -H "Content-Type: application/json" \
    -d '{"procedure": "", "kwargs": {"url": "get", "method": "GET"}}' \

This will call the procedure and print the web response to the terminal.


The HTTP Callee is configured as a WAMP component. Here it is as part of a Crossbar configuration:

    "type": "container",
    "options": {
        "pythonpath": [".."]
    "components": [
            "type": "class",
            "classname": "",
            "realm": "realm1",
            "extra": {
                "procedure": "",
                "baseurl": ""
            "transport": {
                "type": "websocket",
                "endpoint": {
                    "type": "tcp",
                    "host": "",
                    "port": 8080
                "url": "ws://"

The callee is configured through the extra dictionary:

option description
procedure The WAMP procedure name to register the callee as. (required)
baseurl The base URL that the callee will use. All calls will work downward from this URL. If you wish to call any URL, set it as an empty string "". This URL must contain the protocol (e.g. "https://") (required)

When making calls to the registered WAMP procedure, you can use the following keyword arguments:

argument description
method The HTTP method. (required)
url The url which will be appended to the configurd base URL. For example, if the base URL was "", providing "test" as this argument would send the request to (optional, uses the configured base URL if not provided)
body The body of the request as a string. (optional, empty if not provided)
headers A dictionary, containing the header names as the key, and a list of header values as the value. For example, to send a Content-Type of application/json, you would use {"Content-Type": ["application/json"]} as the argument. (optional)
params Request parameters to send, as a dictionary. (optional)



Wikipedia has a web API that we can use for this demonstration.

Configure the RESTCallee WAMP component:

"extra": {
    "procedure": "org.wikipedia.en.api",
    "baseurl": ""

This code snippet calls the procedure with the parameters to look up the current revision of the Twisted Wikipedia page, reads the web response as JSON, and then pretty prints the response to the terminal.

import json
from twisted.internet import reactor
from twisted.internet.defer import inlineCallbacks
from autobahn.twisted.wamp import ApplicationSession, ApplicationRunner

class AppSession(ApplicationSession):

    def onJoin(self, details):
        res = yield"org.wikipedia.en.api",
                                  "format": "json",
                                  "action": "query",
                                  "titles": "Twisted (software)",
                                  "prop": "revisions",
                                  "rvprop": "content"

        pageContent = json.loads(res["content"])
        print(json.dumps(pageContent, sort_keys=True,
                         indent=4, separators=(',', ': ')))

if __name__ == '__main__':
    from autobahn.twisted.wamp import ApplicationRunner
    runner = ApplicationRunner("ws://", "realm1")
remote management for
Test remote management for
Community Chat