news 2026/7/3 2:24:32

08.07.02.tiptop webserver接口篇(创建webserver服务器)

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
08.07.02.tiptop webserver接口篇(创建webserver服务器)

本页目录

  • 1、创建项目
  • 2、发布项目
  • 3、测试

创建项目

  • 菜单位置: File > New > Other…>Java>Java Project

    • Project Name:SOAPServer
    • Use a project specific JRE: 选择本地jdk
    • Next > Libraries 选项卡 > Add Library…>User Library>axis2
  • 右键src文件夹> New > Other…>Java>Class

    • Package: com.web.service
    • Name: HelloWorld
packagecom.web.service;publicclassHelloWorld{publicfloataddValue(floatvalue){return(value+10);}publicfloatsubtractValue(floatvalue){return(value-10);}publicStringsayHi(Stringuser){return"Hi, "+user;}}
  • 保存后:.class自动生成到bin文件夹下

发布项目

  • New > File > Other > Axis2 wizards > Axis2 Services Archiver

    • Class File Location:C:\Work\eclipse\SOAPServer\bin
    • include .class files only
    • Next>Next>Next
    • Generate the service xml automatically > Next
      • Service name:SOAPServer
      • Class name:com.web.service.HelloWorld > Load > Next
        • Output file location: C:\Software\tomcat\webapps\axis2\WEB-INF\services
        • Output File Name: SOAPServer_service
  • 启动tomcat

# 管理员身份进入cmdcdC:\Software\tomcat\bin catalina.bat run

测试

  • 浏览器输入:http://localhost:8080/axis2/services/listServices

    • 多出:SOAPServer。点击进入可以看到:sayHiResponse接口
  • 使用SOAP_UI 访问接口

    • url:http://localhost:8080/axis2/services/SOAPServer?wsdl
<soapenv:Envelopexmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"xmlns:ser="http://service.web.com"><soapenv:Header/><soapenv:Body><ser:sayHi><!--Optional:--><ser:user>111</ser:user></ser:sayHi></soapenv:Body></soapenv:Envelope>

  • 使用Apipost 访问接口

在这里插入图片描述

  • POST方式
    • url: http://localhost:8080/axis2/services/SOAPServer
    • Header
Content-Type:text/xml;charset=UTF-8 SOAPAction:""
- Body - raw 选xml
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"xmlns:ser="http://service.web.com"><soapenv:Header/><soapenv:Body><ser:sayHi><!--Optional:--><ser:user>111</ser:user></ser:sayHi></soapenv:Body></soapenv:Envelope>
版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/6/29 16:44:08

基于SSM的医药管理系统(11876)

有需要的同学&#xff0c;源代码和配套文档领取&#xff0c;加文章最下方的名片哦 一、项目演示 项目演示视频 二、资料介绍 完整源代码&#xff08;前后端源代码SQL脚本&#xff09;配套文档&#xff08;LWPPT开题报告&#xff09;远程调试控屏包运行 三、技术介绍 Java…

作者头像 李华
网站建设 2026/7/2 2:26:47

C++模板

传统函数重载的问题 假设我们要写一个交换函数&#xff1a; void Swap(int& a, int& b) {int tmp a; a b; b tmp; }void Swap(double& a, double& b) {double tmp a; a b; b tmp; }void Swap(char& a, char& b) {char tmp a; a b; b tmp; }重…

作者头像 李华
网站建设 2026/7/2 2:27:46

架构设计怎么做:一套可复用、可落地的方法论

架构设计的本质不是“画图”&#xff0c;而是在约束条件下&#xff0c;对系统的关键质量属性&#xff08;性能、可用性、安全、可演进性、成本&#xff09;做出一系列可验证的决策&#xff0c;并把这些决策沉淀为团队可执行的方案与规范。下面给出一套工程化流程&#xff0c;你…

作者头像 李华