webservice地址:http://j300k69666.zicp.vip/?wsdl
我做的这个webservice是用python做的,地址由本地主机127.0.0.1经花生壳内网映射而来。
postman测试无误。
---------------附Python服务端代码----------------
- from spyne import Application, rpc, ServiceBase
- from spyne import Integer, Unicode, Array, ComplexModel, Iterable, String
- from spyne.protocol.soap import Soap11, Soap12
- from spyne.server.wsgi import WsgiApplication
- from wsgiref.**_server import make_server
- import json
- class H3yunWebService(ServiceBase):
- @rpc(Unicode, _returns=Unicode)
- def GetSchema(self, schemaCode):
- schema = {}
- return json.dumps(schema)
- @rpc(_returns=Unicode)
- def GetSchemaList(self):
- schemaList = {}
- return json.dumps(schemaList)
- @rpc(Unicode, Unicode, Unicode, _returns=Unicode)
- def GetList(self, userCode, schemaCode, filter):
- results = {}
- return json.dumps(results)
- @rpc(Unicode, Unicode, Unicode, Unicode, _returns=Unicode)
- def Invoke(self, userCode, schemaCode, methodName, param):
- results = {"code":0}
- return json.dumps(results)
- application = Application([H3yunWebService],
- 'http://tempuri.org/',
- in_protocol=Soap11(validator='lxml'),
- out_protocol=Soap12())
- wsgi_application = WsgiApplication(application)
- if __name__ == '__main__':
- import logging
- host = '127.0.0.1'
- port = 8000
- logging.info("listening to http://127.0.0.1:8000")
- logging.info("wsdl is at: http://localhost:8000/?wsdl")
- server = make_server(host, port, wsgi_application)
- server.serve_for**r()
复制代码 -----------postman测试------------------
请求raw数据:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<Invoke xmlns="http://tempuri.org/">
<userCode>jicheng</userCode>
<schemaCode>jicheng</schemaCode>
<methodName>get</methodName>
<param>{"jicheng":"jicheng"}</param>
</Invoke>
</soap:Body>
----------postman测试返回数据-------------
<?xml version='1.0' encoding='UTF-8'?>
<soap12env:Envelope xmlns:soap12env="http://www.w3.org/2003/05/soap-envelope" xmlns:tns="http://tempuri.org/">
<soap12env:Body>
<tns:InvokeResponse>
<tns:InvokeResult>{"code": 0}</tns:InvokeResult>
</tns:InvokeResponse>
</soap12env:Body>
</soap12env:Envelope>
|