2

I have multiple different APIs with different schemas serialised in XML or JSON which I need to output as a standardised schema.

Main features needed:

  • Serialisation to XML and JSON
  • Authentication
    • I.e.: can't get/set data unless you have the correct user+pass
  • Role/Scope limitation
    • I.e.: you can't access everything in our database, only what your role allows for
  • Get/set (conversion) between different schemas
    • I.e.: No matter the input API, you can get it formatted in whichever output API you request

Or to put it visually:

Server1 >[send as SOAP 1.1]>[My Server]>[Server3 receives as XML in Server3 schema]

Server3>[Send as XML]>[My Server]>[Server1 receives as SOAP 1.1 in Server1 schema]


Or to put it programmically:

id=MyServer.read.SOAP[Server1.schema](Server1).id
MyServer.send.XML[Server2.schema](data_get(id), Server2)

It would need to store all received data in a Model (database) so that read is available on-demand.

Is this the sort of problem Slumber with TastyPie would be best for?

Or are there a different libraries you'd recommend?

4

1 回答 1

1

这比看起来更难,原因有两个:1)SOAP 和 REST 是不同的范例(基于消息传递 v 的资源),所以有些东西不会有直接的映射,2)如果涉及任何 API,则需要内置可维护性改变。

建立一个中间层服务来进行重新路由和访问控制绝对是有意义的。TastyPie 和 Slumber 有助于创建其余 API 本身,但您似乎还想同时公开一个 SOAP API。因此,您可能需要将 pysimplesoap 或 SOAPy 之类的东西放到中间层的公共数据结构上。(如果你能在离开的路上摆脱 SOAP,你的生活会更轻松:)。)。

如果所有后端服务的用户群都相同,则用户名密码可能仍然有意义,但如果不同的人对不同的服务拥有不同的权限,那么最好将 oAuth 之类的东西放在 oAuth 库中,然后跟踪每个用户独立的权利。

于 2012-05-03T08:15:11.437 回答