调用第三方http接口 hutool工具类

2023-12-15 11:36:11

在这里插入图片描述
1、引入依赖

<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.0.M2</version>
</dependency>

2、请求组装

   String params=
                "<BSXml>" +
                    " <MsgHeader>" +
                         "<Sender>RIS</Sender>" +
                         "<MsgType>CDR_5401</MsgType>" +
                         "<MsgVersion>3.0</MsgVersion>" +
                         "<OperationType>Quesry_Result</OperationType>" +
                         "<EffectiveTime>"+"20231212044208"+"</EffectiveTime>" +
                     " </MsgHeader>" +
                     " <MsgBody>" +
                            "<AuthorOrganization>91441400MA4UH38H20</AuthorOrganization>" +
                            "<VisitId>"+"231208020777"+"</VisitId>" +
                     " </MsgBody>" +
                "</BSXml>";
        logger.info("请求报文参数:"+ params);
                cn.hutool.http.HttpResponse response = HttpRequest.post("http://10.10.203.129:7004/LisServicesInterConnectHIS.asmx/LabResultQuery")
                .header(Header.CONTENT_TYPE, "application/x-www-form-urlencoded")
                .header(Header.HOST, "10.10.203.129")
                .form("paraXML",params)
                .execute();

文章来源:https://blog.csdn.net/weixin_46399670/article/details/135012117
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。