Phi*_*sen 0 spring web-services spring-ws jaxb xml-namespaces
我基于http://spring.io/guides/gs/producing-web-service/上的示例构建了一个Spring WS Web服务.响应包含带有前缀"ns2"的命名空间.
xmlns:ns2="http://www.mycompany.com/somewhere"
Run Code Online (Sandbox Code Playgroud)
皂响应
<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>
Run Code Online (Sandbox Code Playgroud)
是否可以将该前缀重命名为"myprefix"?怎么样?任何人?
好的,我找到了解决方案.这很简单......只需将它添加到package-info.java中的@ XmlSchema-Annotation,如下所示:
@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;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2960 次 |
| 最近记录: |