此上下文已知 SendShortMessageRequest 或其任何超级 class
SendShortMessageRequest nor any of its super class is known to this context
我有一个 spring 引导应用程序,我正在尝试访问 SOAP 网络服务
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.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)
谢谢
我已经注册了 class 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();
}
}
我有一个 spring 引导应用程序,我正在尝试访问 SOAP 网络服务
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.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)
谢谢
我已经注册了 class 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();
}
}