【发布时间】:2016-10-26 07:28:52
【问题描述】:
调用我们的 Web 服务希望我们返回以下 XML:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:loc="http://www.csapi.org/schema/parlayx/sms/notification/v2_2/local">
<soapenv:Header />
<soapenv:Body>
<loc:notifySmsDeliveryReceiptResponse />
</soapenv:Body>
</soapenv:Envelope>
我们使用 JAX-WS 来提供我们的 Web 服务。以下是我们如何定义我们的 Web 服务接口:
@BindingType(value = javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_MTOM_BINDING)
@WebService (targetNamespace = "http://www.csapi.org/schema/parlayx/sms/notification/v2_2/local")
@HandlerChain(file = "deliverysoaphandler.xml")
@SOAPBinding(style = Style.DOCUMENT)
public interface DeliveryService {
@WebMethod ()
public void notifySmsReception(
@WebParam(name = "correlator", targetNamespace = "http://www.csapi.org/schema/parlayx/sms/notification/v2_2/local") @XmlElement(required = true) String correlator,
@WebParam(name = "message", targetNamespace = "http://www.csapi.org/schema/parlayx/sms/notification/v2_2/local") @XmlElement(required = true) Message message
) throws DeliveryException;
}
这会产生以下返回文件:
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<S:Body>
<ns2:notifySmsReceptionResponse xmlns:ns2="http://www.csapi.org/schema/parlayx/sms/notification/v2_2/local"/>
</S:Body>
</S:Envelope>
我们认为该文档与调用系统所期望的基本相同,但被拒绝了,因为 1) 命名空间大写,2) 重复相同的命名空间引用,以及 3) 文档中间有一个命名空间声明.
我是否可以说服 JAX-WS 提供者生产其他系统想要的东西?
【问题讨论】:
标签: web-services jax-ws