我的jax-ws-soap-webservice接受text/xml,但是当我使用content-type作为application/xml时抛出一个错误。
error:wsservletdelegate doget 严重:捕获到可丢弃的java.lang.abstractmethoderror
我试着使用@mtom enabling,但没有成功。我的处理程序甚至不识别请求,并返回500个内部服务器错误响应。
这就是我的处理者的样子。公共类htngmessagehandler实现soaphandler{
RateAvlSrv ravs = new RateAvlSrv();
CallBackDoorNew cBD = new CallBackDoorNew();
static final Logger logger = Logger.getLogger(HTNGMessageHandler.class);
Integer counter = 0;
@XmlMimeType("application/xml")
@Override
public boolean handleMessage(SOAPMessageContext context) {
Boolean request = (Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");
MimeHeaders headers = new MimeHeaders();
headers.setHeader("Content-Type", "application/xml");
headers.setHeader("Encoding", "UTF-8");
LocalDateTime now = LocalDateTime.now();
if (counter++ == 0) {
logger.info("RECIEVED REQUEST");
logger.info("TIME NOW :" + dtf.format(now));
} else if (counter > 0) {
logger.info("RETURNED RESPONSE");
counter = 0;
logger.info("TIME NOW :" + dtf.format(now));
}
if (!request) {
try {
SOAPMessage msg = context.getMessage();
SOAPEnvelope env = msg.getSOAPPart().getEnvelope();
SOAPHeader header = env.getHeader();
SOAPBody soapBody = env.getBody();
ravs.sendSOAPBODYtoService(soapBody);
cBD.sendSOAPBODYtoService(soapBody);
if (header == null) {
header = env.addHeader();
return false;
}
Node node = (Node) header.getElementsByTagName("Name").item(0);
String token;
if (node != null) {
token = node.getChildNodes().item(0).getNodeValue();
ravs.setHeaders(token);
cBD.setHeaders(token);
logger.debug(token);
return true;
}
} catch (SOAPException | DOMException e) {
logger.error("ERROR : " + e);
e.printStackTrace();
}
return false;
}
return true;
}
@Override
public Set<QName> getHeaders() {
return Collections.EMPTY_SET;
}
@Override
public boolean handleFault(SOAPMessageContext messageContext) {
logger.info(messageContext.getMessage());
return true;
}
@Override
public void close(MessageContext context) {
}
}
我还在sun-jaxws.xml中添加了enable mtom=“true”。
但到目前为止,没有任何东西能帮助我的web服务接受application/xml。
我需要帮助。
暂无答案!
目前还没有任何答案,快来回答吧!