简体   繁体   English

将XML转换为http URI-template

[英]Transforming XML to http URI-template

We are using WSO2 ESB to translate incoming SOAP payload onto outbound REST api. 我们使用WSO2 ESB将传入的SOAP有效负载转换为出站REST api。 We are currently using XPath to set parameters and use them to craft http endpoint (uri-template). 我们目前正在使用XPath来设置参数并使用它们来制作http端点(uri-template)。 This approach works with few parameters but as number of parameters increases, the XML code is hard to manage and more error prone. 这种方法适用于少量参数,但随着参数数量的增加,XML代码难以管理且更容易出错。

Any suggestion on best practice to to extract XML element/attribute values and populate REST URL (uri-template)? 有关提取XML元素/属性值和填充REST URL(uri-template)的最佳实践的建议吗?

To avoid this, you can design the your REST Api in proper way. 为避免这种情况,您可以以适当的方式设计REST Api。 In the your REST Api, you can design resource methods with less number of URL parameters(to select the resource) and other parameters you can send via the message payload (via request body) 在您的REST Api中,您可以使用较少数量的URL参数(以选择资源)和可以通过消息有效负载(通过请求正文)发送的其他参数来设计资源方法

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM