1. 程式人生 > >SOAP web service with soaplib 0.9+

SOAP web service with soaplib 0.9+

from soaplib.serializers.primitive import Boolean, String
from soaplib.service import DefinitionBase, rpc
from soaplib.wsgi import Application

from django.http import HttpResponse

# the class with actual web methods
class MySOAPService(DefinitionBase):
    @rpc(String, String, _returns=Boolean)
    def Test(self, f1, f2):
        return True

# the class which acts as a wrapper between soaplib WSGI functionality and Django
class DjangoSoapApp(Application):
    def __call__(self, request):
        # wrap the soaplib response into a Django response object
        django_response = HttpResponse()
        def start_response(status, headers):
            status, reason = status.split(' ', 1)
            django_response.status_code = int(status)
            for header, value in headers:
                django_response[header] = value
        response = super(DjangoSoapApp, self).__call__(request.META, start_response)
        django_response.content = '\n'.join(response)
        return django_response

# the view to use in urls.py
my_soap_service = DjangoSoapApp([MySOAPService], __name__


相關推薦

SOAP web service with soaplib 0.9+

from soaplib.serializers.primitive import Boolean, String from soaplib.service import DefinitionBase, rpc from soaplib.wsgi import Applic

Spring 5.X+CXF 3.X 開發SOAP Web Service Client客戶端例項

服務介面, 可以使用soapui產生 @WebService(targetNamespace = “http://service.demo.ws.osxm.com/”) public interface DemoSoapWsService { @WebMethod(operat

Spring 5.X+CXF 3.X 開發SOAP Web Service服務端例項

方式1:使用 jaxws:server 步驟1. 定義返回的Model POJO的定義, 最好是加上預設建構函式。服務端不加不會出錯, 但是在客戶端呼叫的時候類似的Model定義不加預設建構函式會出錯不加會出錯。 /** * @Title: Demo.java * @Pack

利用JDK自帶工具構建一個簡單的Java SOAP Web Service

這兩天由於工作的某些原因,需要了解一些關於Web Service的知識,然後在網上看到了這麼一篇簡單的有點略微過時但是對於初次接觸Web Service的同學來說又很有必要了解的文章,於是自己嘗試著將文章翻譯過來。 A. 構造Web服務 1. 構造一個簡單的hello

URL Shortener Golang web service with Mongodb

Web technologies are in the heart of the software industry in this day and age. And one of the most popular approaches for web services to communicate w

Develop Web Service With Axis2 #8

我的應用環境如下: JDK  v1.6.x Axis2  v1.5.4 Ant  v1.7.1 Hibernate  v3.3.1 Tomcat  v6.0.26 Weblogic v1.03 1) 當部署axis2 war檔案到tomcat,tomcat無法正常啟動 這是我看到的異常在tomcat啟動的

使用Spring呼叫SOAP Web Service

你也可以直接參閱該指南匯入程式碼,或通過Spring工具集(Spring Tool Suite,簡稱STS)通過網頁瀏覽程式碼,從而幫助你學習該章節內容。原始碼下載地址:https://github.com/spring-guides/gs-consuming-web-service.git。 如何完成該指

使用Spring WS 2.0開發基於SOAPweb service

經過1年的開發之後,SpringWeb service專案最近釋出了一個新的主要版本Spring WS 2.0。這個版本要求使用它的工程使用的是Java 5或以上版本及Spring 3.0或以上版本。但是升級到Spring WS 2.0是十分值得的,因為Spring WS

Web Service技術的SOAP實現

寫在前面的話:本文章由劉源師兄分享,非我原創。此處僅作學習記錄之用。 0 SOA 1 簡介 1.1 提出 1.2 定義 1.3 特點

Web Service平臺有三種元素構成:SOAP、WSDL、UDDI。區別和聯絡

Web Service平臺有三種元素構成:SOAP、WSDL、UDDI。一個消費者可以在UDDI登錄檔查詢服務,取得服務的WSDL描述,然後通過SOAP來呼叫服務。SOAP、WSDL、UDDI的區別如下:1. SOAP(Simple Object Access Protocol,簡單物件訪問協議)① SOAP

使用 PHP SOAP 來建立一個簡單的 Web Service

訪問:   http://www.debug.com/php-soap-demo.php?client=22   結果:   apache: <VirtualHost _default_:80> DocumentRoot "E:\www\te

Web Service (SOAP)和HTTP介面的區別

什麼是web service? soap請求 (SimpleObject Access Protocol,簡單物件訪問協議) 是HTTP POST的一個專用版本,遵循一種特殊的xml訊息格式Content-type設定為: text/xml任何資料都可以xml化

IIS 6.0/7.0/7.5、Nginx、Apache 等Web Service解析漏洞總結 Apache解析漏洞詳解

[+]IIS 6.0 目錄解析:/xx.asp/xx.jpg  xx.jpg可替換為任意文字檔案(e.g. xx.txt),文字內容為後門程式碼 IIS6.0 會將 xx.jpg 解析為 asp 檔案。 字尾解析:/xx.asp;.jpg     /xx

Web Service進階 三 HTTP-GET HTTP-POST and SOAP的比較

XML Web Service 支援三種協議來與使用者交流資料。這三種協議分別是: 1.SOAP:Simple Object Access Protocol 2.HTTP-GET 3.HTTP-POST 1.首先我們先來理解一下這三者的大概定義。

Atitit webservice之道 艾提拉著 目錄 1. 基本說明Web Service 1 2. 基本概念與內部構成 2 2.1. Web services要使用兩種技術: XML SOAP

Atitit webservice之道 艾提拉著   目錄 1. 基本說明Web Service 1 2. 基本概念與內部構成 2 2.1. Web services要使用兩種技術: XML SOAP 2 2.2. WSDL  

Web Service進階 二 如何用Apache TCPMon來截獲SOAP訊息

        注:以下是關於TCPMon的一些使用常識,如果不需要或是已經熟悉就不用往下看了。 在WebService伺服器和客戶機之間會傳遞SOAP訊息,有時我們需要得到這些訊息以便除錯,而Apache的TCPMon可

Web Service兩種釋出協議--SOAP和REST的區別

1、 SOAP是一種具體的通訊協議,REST是一種規範.    2、 SOAP(Simple Object Access Protocol)簡單物件訪問協議,是基於HTTP的一種異構系統通訊的協議,說白了就是xml文件傳輸,之所以會有它,就是在於不同語言C,C++,JAVA等語言開發的系統進行通訊,是WebS

Web Service筆記(三):wsdl 與 soap協議詳解

一、WSDL語言:(web service definition language - web service定義語言) (一)簡介: 2、wsdl 文件描述了 ws 主要的3個方面: 1)WHATA:該 ws 包含”什麼“操作,即有幾個方法。 2)HOW:該 ws

網路程式設計(二)SOAP, WSDL, Web Service

上篇文章講到了,使用網上一個工具WSDL2ObjC.app來把已有的 wsdl轉化為ios可使用的程式碼, 然後通過這部分程式碼進行soap的請求與獲取響應。 但是上面這種方式的劣勢也不言自明, 所以下面將用最原始的方式來做同樣的事情。 這裡首先需要感謝的提供這個網站供使用

IIS 6.0/7.0/7.5、Nginx、Apache 等 Web Service 解析漏洞總結

[+]IIS 6.0 目錄解析:/xx.asp/xx.jpg  xx.jpg可替換為任意文字檔案(e.g. xx.txt),文字內容為後門程式碼 IIS6.0 會將 xx.jpg 解析為 asp 檔案。 字尾解析:/xx.asp;.jpg     /xx.asp:.jpg