目录

wsdl报文解析

wsdl报文总体概述

示例wsdl报文

http://img.cana.space/picStore/20201109183354.png

标签说明

http://img.cana.space/picStore/20201109182213.png

20201109182331

wsdl:definition

http://img.cana.space/picStore/20201109182815.png

wsdl:types

我们java定义的服务接口中某方法的输入参数和返回值

http://img.cana.space/picStore/20201109183005.png

使用注解修改修改默认参数名

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
package com.eh.webservice.demo;

import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;

@WebService
public interface HelloService {

    @WebResult(name = "resultX") String sayHello(@WebParam(name = "whoX") String who);
}

wsdl

http://img.cana.space/picStore/20201109184256.png

请求

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
POST /cxf
Content-Type: text/xml; charset=utf-8
Accept: */*
Cache-Control: no-cache
Host: localhost:9999

<soap:Envelope
        xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

    <soap:Body>
        <ns2:sayHello xmlns:ns2="http://demo.webservice.eh.com/">
            <whoX>徐达</whoX>
        </ns2:sayHello>
    </soap:Body>

</soap:Envelope>

返回

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
POST http://localhost:9999/cxf

HTTP/1.1 200 OK
Date: Mon, 09 Nov 2020 10:41:29 GMT
Content-Type: text/xml;charset=utf-8
Content-Length: 229
Server: Jetty(9.4.31.v20200723)

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
        <ns2:sayHelloResponse xmlns:ns2="http://demo.webservice.eh.com/">
            <resultX>hello, 徐达</resultX>
        </ns2:sayHelloResponse>
    </soap:Body>
</soap:Envelope>

wsdl:message

http://img.cana.space/picStore/20201109184416.png

wsdl:portType

http://img.cana.space/picStore/20201109184845.png

wsdl:binding

http://img.cana.space/picStore/20201109185052.png

wsdl:service

http://img.cana.space/picStore/20201109185435.png

总结

http://img.cana.space/picStore/20201109190600.png