如何在spring-ws中停止自动生成的名称空间

问题描述

我正在使用Spring-WS构建一个soap应用程序,在握手之后它将向客户端发送get / set参数,但是在输出消息中总是自动生成一个名称空间,我无法通过许多不同的方式将其删除。 这是package-info类:

@XmlSchema(namespace = "urn:vohforum-com:vohf",xmlns = { 
    @XmlNs(namespaceURI = "urn:vohforum-com:vohf",prefix = "vohf")
},elementFormDefault = javax.xml.bind.annotation.XmlNsForm.UNQUALIFIED,attributeFormDefault = javax.xml.bind.annotation.XmlNsForm.UNQUALIFIED)

package com.voh.jaxbt.model;

import javax.xml.bind.annotation.XmlNs;
import javax.xml.bind.annotation.XmlSchema;

我的终点:

@Endpoint
public class VOHF {
    
    private final String NAMESPACE_VOHF = "urn:vohforum-com:vohf";
       
    @PayloadRoot(namespace = NAMESPACE_VOHF,localPart = "HandShake")
    @ResponsePayload
    public GenericRPC handShakeHandle(){
        GenericRPC response = new GetParameters();
        // or GenericRPC response = new SetParameters();
        return response;
    }
}

输出消息,它始终包含xmlns:ns3 =“ http://schemas.xmlsoap.org/soap/encoding/”

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding" xmlns:vohf="urn:vohforum-com:vohf" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding">
    <SOAP-ENV:Header>
        <vohf:ID>061602</vohf:ID>
    </SOAP-ENV:Header>
    <SOAP-ENV:Body>
        <vohf:GetParameters xmlns:ns3="http://schemas.xmlsoap.org/soap/encoding/"/>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

GenericRPC类:

@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name="GenericRPC",namespace = "urn:vohforum-com:vohf")
@XmlSeeAlso({
    GetParameters.class,SetParameters.class})
public abstract class GenericRPC {}

我的GetParameters类和SetParameters相同:

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "",propOrder = {
    "parameters"
})
@XmlRootElement(name = "GetParameters",namespace = "urn:vohforum-com:vohf")
public class GetParameters extends GenericRPC{

    @XmlElement(name = "Parameters",required = true)
    protected ParameterNames parameters;

    public ParameterNames getParameters() {
        return parameterNames;
    }

    public void setParameters(ParameterNames value) {
        this.parameterNames = value;
    }
}

有人可以帮助我吗?预先感谢!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)