我想更改 SOAP Endpoint 请求对象名称

Posted

技术标签:

【中文标题】我想更改 SOAP Endpoint 请求对象名称【英文标题】:I want to change SOAP Endpoint request object name 【发布时间】:2022-01-24 05:35:49 【问题描述】:
import javax.xml.bind.annotation.*;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = 
        "sysinfo"
)
@XmlRootElement(name = "CheckPaymentRequest", namespace = "http://munis.ws.uz/")
public class CheckPaymentRequest 

    @XmlElement(name = "sysinfo", required = true)
    protected Sysinfo sysinfo;

    public Sysinfo getSysinfo() 
        return sysinfo;
    

    public void setSysinfo(Sysinfo sysinfo) 
        this.sysinfo = sysinfo;
    

    @Override
    public String toString() 
        return "CheckPaymentRequest" +
                "sysinfo=" + sysinfo +
                '';
    

    @XmlAccessorType(XmlAccessType.FIELD)
    @XmlType(name = "", propOrder = 
            "data",
            "time",
            "bid",
            "tid",
            "sid",
            "hash"
    )
    public static class Sysinfo 
        @XmlElement(name = "data", required = true)
        protected String data;
        @XmlElement(name = "time", required = true)
        protected String time;
        @XmlElement(name = "bid", required = true)
        protected String bid;
        @XmlElement(name = "tid", required = true)
        protected String tid;
        @XmlElement(name = "sid", required = true)
        protected String sid;
        @XmlElement(name = "hash", required = true)
        protected String hash;

        public Sysinfo() 
        

        public Sysinfo(String data, String time, String bid, String tid, String sid, String hash) 
            this.data = data;
            this.time = time;
            this.bid = bid;
            this.tid = tid;
            this.sid = sid;
            this.hash = hash;
        

        public String getData() 
            return data;
        

        public void setData(String data) 
            this.data = data;
        

        public String getTime() 
            return time;
        

        public void setTime(String time) 
            this.time = time;
        

        public String getBid() 
            return bid;
        

        public void setBid(String bid) 
            this.bid = bid;
        

        public String getTid() 
            return tid;
        

        public void setTid(String tid) 
            this.tid = tid;
        

        public String getSid() 
            return sid;
        

        public void setSid(String sid) 
            this.sid = sid;
        

        public String getHash() 
            return hash;
        

        public void setHash(String hash) 
            this.hash = hash;
        

        @Override
        public String toString() 
            return "Sysinfo" +
                    "data='" + data + '\'' +
                    ", time='" + time + '\'' +
                    ", bid='" + bid + '\'' +
                    ", tid='" + tid + '\'' +
                    ", sid='" + sid + '\'' +
                    ", hash='" + hash + '\'' +
                    '';
        
    






 <?xml version="1.0" encoding="UTF-8"?>
    
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
               targetNamespace="http://munis.ws.uz/"
               xmlns:tns="http://munis.ws.uz/" elementFormDefault="qualified">
    
        <xs:element name="CheckPaymentRequest">
            <xs:complexType>
                <xs:sequence>
                    <xs:element name="sysinfo" type="tns:Sysinfo"/>
                </xs:sequence>
            </xs:complexType>
        </xs:element>
    
       <xs:complexType name="Sysinfo">
            <xs:sequence>
                <xs:element name="data" type="xs:string"/>
                <xs:element name="time" type="xs:string"/>
                <xs:element name="bid" type="xs:string"/>
                <xs:element name="tid" type="xs:string"/>
                <xs:element name="sid" type="xs:string"/>
                <xs:element name="hash" type="xs:string"/>
            </xs:sequence>
        </xs:complexType>
    </xs:schema>
    

@PayloadRoot(namespace = "http://munis.ws.uz/", localPart = "CheckPaymentRequest") @ResponsePayload 公共 CheckPaymentResponse processCheckPaymentRequest(@RequestPayload @WebParam(name = "checkPayment") CheckPaymentRequest request) CheckPaymentResponse checkPaymentResponse = new CheckPaymentResponse(); 返回 checkPaymentResponse;

我正在创建一个 wsdl 查询

但我必须有那个样子

但我想如果我将类名从 CheckPaymentRequest 更改为 CheckPayment,它不会在 wsdl 中创建查询。提前感谢您的帮助

【问题讨论】:

【参考方案1】:

我建议你把@XmlRootElement(name = "CheckPaymentRequest", namespace = "http://munis.ws.uz/")修改成@XmlRootElement(name = "checkPayment", namespace = "http://munis.ws.uz/")而不是类名。

【讨论】:

我在这个视图中写了但是wsdl没有生成查询

以上是关于我想更改 SOAP Endpoint 请求对象名称的主要内容,如果未能解决你的问题,请参考以下文章

SOAP - 不知道我的端点URL是什么

签署 JAX-WS SOAP 请求

如何使用 ZEEP 更改 SOAP 请求中的端点地址

在调用Web服务时,是否有一种简单的方法可以获取请求的soap消息和响应的soap消息?

soap:address和jaxws:enpoint address之间的区别

nodejs soap 0.18.0