加载中...
加载中...
使用JAVA创建一个WebService服务

使用JAVA创建一个WebService服务 原创

WebSer使用JAVA创建一个WebService服务


复制收展Javapackage com.taikang.service;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.xml.ws.Endpoint;

@WebService(name = "YtkcFiService", targetNamespace = "urn:sap-com:document:sap:soap:functions:mc-style")
public class YtkcFiGetAcdocHslServiceImpl {

@WebMethod(operationName = "YtkcFiGetAcdocHsl")
public @WebResult(name = "EvJson") String ytkcFiGetAcdocHsl(@WebParam(name = "IvJson") String IvJson){
System.out.printf("ytkcFiGetAcdocHsl 请求="+IvJson);
String result = "[{\"RLDNR\":\"\",\"GJAHR\":\"2024\",\"POPER\":\"003\",\"BUKRS\":\"ABK01\",\"hsl\": \"2000000.00\"}]";
System.out.printf("ytkcFiGetAcdocHsl 响应="+IvJson);
return result;
}

public static void main(String[] args) {
String address="http://localhost:8989/WS_Server/Webservice"; //定义服务访问路径
Endpoint.publish(address,new YtkcFiGetAcdocHslServiceImpl());
System.out.println("模拟Webservice服务端发布成功了!"); //发布后控制台输出信息
}

}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25

报文

复制收展XML请求报文
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:urn="urn:sap-com:document:sap:soap:functions:mc-style" >
<soapenv:Header/>
<soapenv:Body>
<urn:YtkcFiGetAcdocHsl>
<IvJson>[{"RLDNR":"","GJAHR":"2024","POPER":"003","BUKRS":"ABK01"}]</IvJson>
</urn:YtkcFiGetAcdocHsl>
</soapenv:Body>
</soapenv:Envelope>

响应报文
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:YtkcFiGetAcdocHslResponse xmlns:ns2="urn:sap-com:document:sap:soap:functions:mc-style">
<EvJson>[{"RLDNR":"","GJAHR":"2024","POPER":"003","BUKRS":"ABK01","hsl": "100000"}]</EvJson>
</ns2:YtkcFiGetAcdocHslResponse>
</S:Body>
</S:Envelope>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20



没有更多推荐了 [去首页]
image
文章
376
原创
293
转载
83
翻译
0
访问量
183397
喜欢
73
粉丝
5
码龄
7年
资源
3

文章目录

加载中...
0
0