如何使用javax.xml.bind.annotation在java中添加空白命名空间

swvgeqrz  于 2021-06-26  发布在  Java
关注(0)|答案(0)|浏览(200)

我不熟悉soap服务,这是我的输出和java类的细节。
如何添加空白 xmlns 在小班?
输出请求:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<sendEmail xmlns="http://ws.cns.channel.sendnotification.sdfsfds.com/">
    <EmailNotificationRequest>
        <requestHeader>
            <channel>fsdfs</channel>
            <subChannel>sdfds</subChannel>
            <systemName>sdfsd</systemName>
            <applicationName>dsfs</applicationName>
        </requestHeader>
    </EmailNotificationRequest>
</sendEmail>

程序包类

@javax.xml.bind.annotation.XmlSchema(namespace = "http://ws.cns.channel.sendnotification.sdfsfds.com/",
        elementFormDefault = XmlNsForm.QUALIFIED
    )
    package com.etisalat.sendnotification.channel.cns.ws;

    import javax.xml.bind.annotation.XmlNsForm;

请求头类

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "requestHeader", propOrder = {
    "channel",
    "subChannel",
    "agentID",
    "systemName",
    "applicationName",
    "hostID",
    "requestDate"
})

public class RequestHeader {
    @XmlElement(required = true)
    protected String channel;
    protected String subChannel;
    protected String agentID;
    @XmlElement(required = true)
    protected String systemName;
    protected String applicationName;
}

所需输入请求

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<sendEmail xmlns="http://ws.cns.channel.sendnotification.sdfsfds.com/">
    <EmailNotificationRequest>
        <requestHeader xmlns="">
            <channel>fsdfs</channel>
            <subChannel>sdfds</subChannel>
            <systemName>sdfsd</systemName>
            <applicationName>dsfs</applicationName>
        </requestHeader>
    </EmailNotificationRequest>
</sendEmail>

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题