可以在SpringWS-webservice中重命名th响应名称空间前缀吗?
我已经基于上的示例构建了一个SpringWS-webservice。响应包含前缀为“ns2”的我的命名空间 Soap响应可以在SpringWS-webservice中重命名th响应名称空间前缀吗?,spring,web-services,jaxb,xml-namespaces,spring-ws,Spring,Web Services,Jaxb,Xml Namespaces,Spring Ws,我已经基于上的示例构建了一个SpringWS-webservice。响应包含前缀为“ns2”的我的命名空间 Soap响应 <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Header/> <SOAP-ENV:Body> <ns2:mitteilungResponse xmlns:ns2="http://
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<ns2:mitteilungResponse xmlns:ns2="http://www.mycompany.com/somewhere">
<ns2:responseContent>
<ns2:message>Hello World!</ns2:message>
</ns2:responseContent>
</ns2:mitteilungResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
你好,世界!
是否可以将该前缀重命名为“myprefix”?怎么用?有人吗?好的,我找到了解决办法。这很简单。。。只需将其添加到包info.java中的@XmlSchema注释中,如下所示:
@XmlSchema(
xmlns = {
@XmlNs(prefix = "myprefix", namespaceURI="http://www.mycompany.com/foobar")
},
namespace = "http://www.mycompany.com/somewhere",
elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED
)
package com.mycompany.project;
好的,我找到了解决办法。这很简单。。。只需将其添加到包info.java中的@XmlSchema注释中,如下所示:
@XmlSchema(
xmlns = {
@XmlNs(prefix = "myprefix", namespaceURI="http://www.mycompany.com/foobar")
},
namespace = "http://www.mycompany.com/somewhere",
elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED
)
package com.mycompany.project;