spring - SendShortMessageRequest 及其任何超类对此上下文都是已知的
问题描述
我有一个 Spring Boot 应用程序,我正在尝试访问 SOAP Web 服务
SendShortMessageRequest request = new SendShortMessageRequest();
AddressList addressList = new AddressList();
List<Address> recipientAddresses = new ArrayList<>();
Address recipientAddress = new Address();
recipientAddress.setAddr(recipient);
recipientAddresses.add(recipientAddress);
addressList.setAddress(recipientAddresses);
Address originator = new Address();
originator.setAddr(sender);
request.setText(validationCode);
request.setRecipients(addressList);
request.setOriginator(originator);
SendShortMessageResponse response = (SendShortMessageResponse) getWebServiceTemplate()
.marshalSendAndReceive(messagesLocation, request, new SoapActionCallback(sendShortMessageAction));
我得到了一个肥皂例外。知道这有什么问题。
org.springframework.oxm.UncategorizedMappingException: Unknown JAXB exception; nested exception is javax.xml.bind.JAXBException: class com.openmind.primecast.webservices.wsdl.SendShortMessageRequest nor any of its super class is known to this context.
at org.springframework.oxm.jaxb.Jaxb2Marshaller.convertJaxbException(Jaxb2Marshaller.java:913)
at org.springframework.oxm.jaxb.Jaxb2Marshaller.marshal(Jaxb2Marshaller.java:682)
at org.springframework.ws.support.MarshallingUtils.marshal(MarshallingUtils.java:81)
at org.springframework.ws.client.core.WebServiceTemplate$2.doWithMessage(WebServiceTemplate.java:399)
at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:590)
at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:555)
at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:390)
at com.openmind.primecast.webservices.impl.PhoneNumberConfirmationMessageClientImpl.sendConfirmationMessage(PhoneNumberConfirmationMessageClientImpl.java:94)
at com.openmind.primecast.service.UserService.setupContactNumber(UserService.java:290)
谢谢你
解决方案
我已经注册了类 SendShortMessageRequest @XmlRegistry 它开始工作。
@XmlRegistry
public class ObjectFactory {
/**
* Create an instance of {@link SendShortMessageRequest }
*
*/
public SendShortMessageRequest createSendShortMessageRequest() {
return new SendShortMessageRequest();
}
/**
* Create an instance of {@link SendShortMessageResponse }
*
*/
public SendShortMessageResponse createSendShortMessageResponse() {
return new SendShortMessageResponse();
}
}
推荐阅读
- java - 从包含多个
- javascript - 当我使用拖放时,拖动对象部署在 img 内部而不是 div
- coldfusion - 如何在 ColdFusion 中实现 recaptcha v3?
- python - 与 python 的连接问题:badstatusline
- python - UFC 数据集 InvalidArgumentError 断言失败:[Label IDs must < n_classes] [Condition x < y did not hold element-wise:]
- python - 未给出可选参数时在 argparse 中运行钩子的简单方法
- python - 如何将 for 循环转换为向量并将其写入 csv?
- java - 导航到网页中的每个链接后,如何使用 selenium java 使用方法 =post 获取所有表单的列表
- python-3.x - 从 python 执行的 Outlook 邮件模板中删除签名
- python - 无法通过批处理文件运行 pandas python 脚本