有人的地方就有江湖什么意思| 小儿惊痫是什么症状| 甜胚子是什么做的| 长痘痘去医院挂什么科| 什么是有氧运动什么是无氧运动| 16年属什么生肖| ercp是什么意思| 维生素b2吃多了有什么副作用| 什么食物是养肝的| 为什么会得霉菌感染| 93年属于什么生肖| 哪吒他妈叫什么名字| 曹真和曹操什么关系| 用牙膏洗脸有什么好处和坏处| power是什么牌子| 树叶像什么比喻句| 遥字五行属什么| 梅五行属什么| 胸部爱出汗是什么原因| 带状疱疹用什么药| 什么叫梅核气| 人工授精是什么意思| 胸口正中间疼痛是什么病症| 心肌缺血吃什么中成药| 什么情况下要做宫腔镜| 腹泻拉水吃什么药| 十一月份什么星座| 月经前腰疼的厉害是什么原因| 乳房硬块疼是什么原因| 双相是什么| 贝母和川贝有什么区别| 面部填充用什么填充效果好| 劳燕分飞是什么意思| 健硕是什么意思| 紫藤花什么时候开| angelababy英文什么意思| 宫颈活检是什么意思| 6克血是什么概念| 女人身体发热预示什么| 为什么晚上睡不着觉| ganni是什么牌子| 男生圆脸适合什么发型| 燕条和燕盏有什么区别| 喝苹果醋有什么好处和坏处| 虎口长痣代表什么| 8月24号是什么星座| 瑜伽是什么运动| 二狗子是什么意思| 眼睛粘糊是什么原因| 来事吃什么水果好| skr什么意思| 什么麻料最好| 山楂泡水喝有什么好处| 脖子后面正中间有痣代表什么| 什么的青蛙| 复山是什么意思| 对口高考班是什么意思| 双氧水是什么| 615是什么星座| 什么是兼职| 突然耳朵疼是什么原因| 什么是结肠炎| 一什么不| 什么饭不能吃| 挚爱适合用在什么人| 男朋友过生日送什么礼物最有意义| 缩阳是什么意思| 1966年属马的是什么命| 马来西亚说什么语言| 羊肉炖什么好吃| 射手属于什么象星座| 温州冬至吃什么| chick什么意思| 今年为什么闰六月| 千斤拔泡酒有什么功效| 属牛的守护神是什么菩萨| 喜鹊吃什么食物| 上技校学什么专业好| 给花施肥用什么肥料| 皮肤黄什么原因| 66年属马是什么命| 肺热会引起什么症状| 87年是什么年| 与其让你在我怀中枯萎是什么歌| 孢子是什么| 连续做噩梦是什么原因| 鱼子酱为什么那么贵| 减肥晚上吃什么合适| 便秘挂什么科室| 男性尿分叉是什么原因| 抗ccp抗体高说明什么| dolphin是什么意思| 擦什么能阻止毛发生长| 吃什么对眼睛近视好| 食字五行属什么| 摸摸唱是什么意思| 苦荞茶有什么功效| 为什么精液是流出来的| 离婚需要什么资料| 道心是什么意思| 合掌是什么意思| 燕窝有什么功效| 尿黄是什么原因| 231是什么意思| 1970年五行属什么| 猪头肉是什么意思| 色弱是什么意思| 高压偏低是什么原因造成的| 画像是什么意思| 五行中什么生木| 祈福是什么意思| 心功能不全是什么意思| 急性阑尾炎什么症状| 有肾病的人吃什么好| 许嵩为什么叫vae| 江字五行属什么| 蚊虫叮咬过敏用什么药| 雷诺综合征是什么病| 眉骨疼是什么原因| 第二名叫什么| 劲酒兑什么饮料好喝| 见性成佛是什么意思| 维生素b12治什么病| 灵芝长在什么地方| 什么流淌| 远香近臭是什么意思| nary是什么牌子的手表| 做可乐鸡翅用什么可乐| hk什么意思| 洋葱为什么会让人流泪| http什么意思| 大数据是什么专业| 螳螂吃什么东西| 张菲和费玉清什么关系| 做月子要注意什么| 动脉导管未闭是什么意思| 先天性心脏病最怕什么| 7月8号是什么星座的| 眼睛红是什么原因引起的| 妇科衣原体感染是什么病| 耳朵后面痒是什么原因| 眼睛无神呆滞什么原因| 尿泡沫多是什么原因| 不排卵是什么原因造成| 糜烂性胃炎可以吃什么蔬菜| sassy是什么意思| 一岁宝宝吃什么| ed病毒是什么| 梦到车被撞了什么预兆| 什么级别可以配秘书| 扑朔迷离是什么意思| 肺大泡是什么意思| 仪仗队是什么意思| 不可以加什么偏旁| 鼠和什么属相最配对| 男模什么意思| 胆结石不能吃什么东西| 金相是什么意思| 胆囊壁毛糙是什么意思| 83年猪是什么命| 老实是什么意思| 孩子老打嗝是什么原因| 黑醋是什么醋| ab型血和o型血的孩子是什么血型| 后背发凉是什么原因| mnm是什么单位| 氯化钠是什么盐| 钙片吃多了有什么副作用| 国家发改委主任什么级别| 菩提树是什么树| 圈癣是什么引起的| 2月17日是什么星座| 马英九是什么生肖| 动脉硬化挂什么科| 家里放什么最招财| 海藻糖是什么| 淋巴发炎吃什么药| 风热咳嗽吃什么药| 寻常疣是什么样子图片| 免疫力差吃什么| 凌晨4点是什么时辰| 蜈蚣属于什么类动物| 肾五行属什么| 妇科做活检是什么意思| 什么的小草| z值是什么意思| 标王是什么意思| 牛和什么生肖相冲| 红月亮是什么兆头| 鼻毛变白什么征兆| 低蛋白血症是什么意思| 尿频尿急小腹胀痛吃什么药| 表达是什么意思| 做梦梦到捡钱是什么征兆| 布洛芬属于什么类药物| 胃为什么会疼| 深海鱼油起什么作用| 车辙是什么意思| 血管紧张素是什么意思| 什么人容易得心脏病| 提是什么生肖| 黄体破裂是什么症状| 舅舅的女儿叫什么| 全自动洗衣机不排水是什么原因| 后脑袋疼是什么原因| 10月29号是什么星座| 冰恋是什么意思| 眼角有眼屎是什么原因| 淋巴细胞是什么意思| 什么是电离辐射| 8023什么意思| 蛋蛋疼是什么原因| 脑梗吃什么最好| 鬼针草有什么作用| 肝裂不宽是什么意思| 貔貅是什么动物| 食品级pp材质是什么| 不发烧流鼻涕打喷嚏吃什么药| 月经喝什么比较好| 阴茎是什么| 什么的废墟| 吃什么可以让月经快点来| 木指什么生肖| 香菜不能和什么一起吃| 车厘子是什么| 血小板是什么意思| 什么饼不能吃脑筋急转弯| 外阴红肿疼痛用什么药| 桦树茸有什么作用| 我们在干什么| 甜菜根在中国叫什么| 同人文什么意思| 养老金什么时候补发| 嗤之以鼻是什么意思| 荔枝什么品种好吃| 瓜子脸适合什么眼镜| 相亲第一次见面送什么礼物好| 神经纤维由什么组成| 自渡是什么意思| 中性粒细胞比率偏低是什么意思| 呼吸重是什么原因| 什么药能治阳痿早泄| 空调什么度数最省电| 金丝雀是什么意思| 心力憔悴是什么意思| 老师结婚学生送什么礼物好| 残局是什么意思| 青储是什么| 脖子长痘痘是因为什么原因| 稀饭和粥有什么区别| 上火流鼻血是什么原因| 宫颈炎是什么病| 跳蛋是什么| 每天放很多屁是什么原因| 6.21什么星座| 7月1号什么节| 指甲弯曲是什么原因| tf是什么意思| 什么人不怕冷| 疱疹用什么药膏最有效| 喝什么可以减肥| 子宫糜烂是什么症状| 主理人是什么意思| 奇的多音字是什么| 百度
DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Attention Kubernetes users! DZone is researching how K8s usage is evolving in 2025 — tell us the good, the bad, + the frustrating.

Getting Started With DevSecOps: This Refcard provides actionable insights for embedding security into your DevOps culture and workflows.

Data Engineering: Not your average "AI is changing everything" report. Dive into tooling, strategy, + systems in scalable data ecosystems.

Java Caching: This Refcard explores core caching concepts and demonstrates how to implement them using Java’s JCache API.

Related

  • Building REST API Backend Easily With Ballerina Language
  • Choosing a Library to Build a REST API in Java
  • Composite Requests in Salesforce Are a Great Idea
  • Creating a Secure REST API in Node.js

Trending

  • A Complete Guide to Creating Vector Embeddings for Your Entire Codebase
  • Revolutionizing the Command Line: An Introduction to Gemini CLI
  • LangGraph Orchestrator Agents: Streamlining AI Workflow Automation
  • How to Improve Software Architecture in a Cloud Environment
  1. DZone
  2. Data Engineering
  3. Databases
  4. Build a REST API with XML Payload

银行集体搅局移动支付领域 角力新战场支付宝胜算如何

Creating REST APIs with XML payloads.

By 
Neerav Aggarwal user avatar
Neerav Aggarwal
·
Apr. 23, 16 · Tutorial
Likes (3)
Comment
Save
Tweet
Share
49.0K Views
百度 二要准确把握党委会工作方法的全面性,增强学习意识。

Join the DZone community and get the full member experience.

Join For Free

There is hardly any argument on the fact that APIs are increasingly becoming an important part of how companies do business. API has become the de facto standard to unlock one of their most valuable resources, data.

And as organizations are publishing more APIs, the observed trend is that REST is replacing SOAP as the data transfer protocol of choice. When it comes to the data that APIs serve up, XML is still the most used format. Although JSON is hot on its heels, we still need to address plenty of use cases with XML payload.

In this post, we will go step by step through an example to build out a RESTful web service with XML request and response payload. Check out the complete project on Anypoint Exchange.

Pre-requisites:

  • Sign up for an Anypoint Platform Account.
  • Download Anypoint Platform Design Tool – MuleSoft Anypoint Studio. In this post, we are using version 5.4 of Anypoint Studio with the new “Studio Light Theme”. You can always revert to the old theme in Preferences.
  • A database where we can create and load a sample table required for this project. In this example, we will use an instance of the MySQL database.
  • To follow the example in this guide, run the SQL script customer.sql to set up the table and load it with some sample data.

Steps:

  1. Since we are working with an XML payload, we will either have an existing schema for the request and response message or create one from scratch. In this example, we will consider the latter. Since the foundation for Anypoint Studio is the Eclipse IDE, we can leverage the XML schema design tool which comes included with Anypoint Studio.
    Open Anypoint Studio and create a “General Project”.
    Fullscreen_12_25_15__4_17_PM
  2. Create a new file in the project of type “XML Schema File”. Refer link to get step by step instructions in designing the XML Schema using the Eclipse-based schema editor. For the scope of this example, download the schema for request and response XML payload.
    New_and_Mule_Design_
    Now that we have the schema definitions ready we can start defining the API specification. We do this with the help of RESTful API Modeling Language (RAML). RAML is central to the design first approach to implementing an API that we have discussed in out previous blog posts(link here).
  3. To start defining an API specification, first, sign up for an Anypoint account if you don’t already have one.
    Anypoint_Platform_and_Anypoint_Platform
  4. After logging into the account click on “API” on the top which will bring up the page listing any existing APIs. If this is the first API, then the list will be blank.
    Anypoint_Platform_and_Postman_and_Mule_Design_-_restxmlpayload_src_main_app_api_xml_-_Anypoint_Studio_-__Users_neerav_agrawal_Mule_Workspace_MuleWorkspace_Workspace_NewStudio
  5. Click on “Add new API” which brings up the API detail page where on the left side we click on “Define API in API Designer.” which brings up the API Designer tool.
    Mule_Workspace_MuleWorkspace_Workspace_NewStudio
  6. Using the API Designer tool where we will start creating our API specification using RAML. Import the schema files we created earlier into API designer by clicking on “Import”.
    ImportSchema
  7. Using simple descriptive language, we will document the requirements for our API to query customer details. For more information, please refer to the RAML tutorial here.
    For this example download the RAML spec here.
    ramlSpecCustomer
  8. Once we have confirmed and documented the API requirements, we will export the resulting RAML file along with the referenced XSD.
    Using the API specification we just exported we will now configure the actual implementation of the operations defined in the RAML file. For this purpose, we will use Mulesoft Anypoint Studio.
    exportRaml
  9. Open up Studio. Create a new “Mule Project”. Give a name to the project. Since we are implementing the operations defined in the RAML file, we will reference the exported RAML archive at the bottom. Click Finish.
    createProjectRAML1
  10. Referencing the RAML file will preconfigure the application with the flows and exception handling.
    We will configure the “Post” operation and add components to query the database and map the result set to the required XML payload.
    AddToPost
  11. Add the database connector. In this example, we are using a MYSQL database. So configure the connector with MySQLvers. You can configure any other JDBC database drivers here. Add in the relevant connection parameters and click “Finish”.Screenshot_1_8_16__5_00_PM
  12. Pick the “Select” operation and configure the select query. In this example, we are fetching the customerID from the XML input request. We will use this customerID in the select query to fetch the relevant customer record from the database table. We use an XPATH3 function to parse through the incoming XML payload. We use wildcard “*” to escape the namespace. If there is a need to incorporate the namespace, then refer to the documentation.
    dbSelectQuery
  13. Now that we have configured the database connector, we need to map the result set returned from the connector to the XML response payload. For this purpose, we will use the DataWeave transform component. Because of DataSense, metadata on the left and right side are automatically fetched making it very easy to map the data.
    transformCustomerOutput
  14. Using the mapper, drag and drop the result set from left to right side. After which we map each relevant data element from left to right side.
    transformMapping_123
  15. Right-click on the project and run it in Anypoint Studio as a mule application which will open up the API console in Studio. We can test the API here by adding a sample request XML with a customer id. Press Send, which executes the flow we just configured and to fetch the customer details from the database table.
    runApplication

You can download this complete project from Anypoint Exchange.

In this post and from our previous post we have understood how easy it is to create an API with the end user in mind.

The trends suggest the shift towards RESTful APIs but the decision of the data format between JSON or XML is still fifty-fifty. In any case, we can have either or both data formats in our API repository.

In the next post, we will see how we can configure composite processes by utilizing multiple APIs with both JSON and XML data formats.

API XML REST Web Protocols Payload (computing) Database Build (game engine)

Published at DZone with permission of Neerav Aggarwal. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Building REST API Backend Easily With Ballerina Language
  • Choosing a Library to Build a REST API in Java
  • Composite Requests in Salesforce Are a Great Idea
  • Creating a Secure REST API in Node.js

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

子宫肌瘤钙化是什么意思 和亲是什么意思 川芎的功效与作用是什么 肌肉跳动是什么原因 洋葱与什么食物相克
碘伏是什么 日在校园讲的什么 什么食物含碘 中央办公厅主任什么级别 男性下焦湿热吃什么药
瞳距是什么意思 黄皮果是什么水果 酱油色尿是什么原因 帕金森是什么引起的 乳头为什么会痛
大牙什么时候换 臭屁什么意思 病入膏肓什么意思 寡欲是什么意思 鸩杀是什么意思
化生子是什么意思hcv9jop6ns9r.cn hpv42阳性是什么意思hcv8jop1ns5r.cn 孙策和孙权什么关系hcv8jop6ns7r.cn 猴子的尾巴像什么hcv8jop9ns7r.cn 2月11日是什么星座hcv8jop6ns6r.cn
我国最早的中医学专著是什么hcv8jop9ns8r.cn 紫色代表什么hcv9jop5ns3r.cn 小肚子胀疼是什么原因gysmod.com 市长什么级别hcv7jop7ns3r.cn 血小板低是什么原因造成的wzqsfys.com
1999是什么年hcv7jop5ns1r.cn 高中校长什么级别hcv8jop6ns5r.cn 兰芝属于什么档次hcv9jop7ns0r.cn 打嗝多是什么原因hcv9jop7ns2r.cn 双脚麻木是什么病的前兆hcv7jop7ns0r.cn
肚子疼恶心想吐吃什么药tiangongnft.com 荤菜是什么意思qingzhougame.com 1981属什么hcv8jop2ns6r.cn 什么水果维生素c含量最高hcv9jop5ns5r.cn 逆熵是什么意思hcv8jop8ns9r.cn
百度