如何在一个Jaxb2Marshaller中处理更多的WSDL?
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何在一个Jaxb2Marshaller中处理更多的WSDL?相关的知识,希望对你有一定的参考价值。
我有一个Spring启动Gradle项目,并使用JAXB marshaller来编组和解组XML请求/响应。
它适用于一组包路径:
@Bean
public SoapClient client(Jaxb2Marshaller marshaller) throws Exception {
SoapClient client = new SoapClient();
client.setDefaultUri("http://localhost:8088");
client.setMarshaller(marshaller);
client.setUnmarshaller(marshaller);
client.setMessageSender(httpComponentsMessageSender());
return client;
}
@Bean
public Jaxb2Marshaller marshaller() throws Exception {
Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
//works
//marshaller.setContextPaths("generated.identity.wsdl");
//works
//marshaller.setContextPaths("generated.network.wsdl");
//does not work
marshaller.setContextPaths("generated.identity.wsdl","generated.network.wsdl");
return marshaller;
}
运行更多参数后,我收到以下错误消息:
xycontroller.VerificationControllerTest > checkByToken FAILED
java.lang.IllegalStateException
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException
Caused by: org.springframework.beans.factory.BeanCreationException
Caused by: org.springframework.beans.BeanInstantiationException
Caused by: org.springframework.oxm.UncategorizedMappingException
Caused by: com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException
谢谢你的帮助!
答案
2 WSDL生成了具有相同名称的类。他们是冲突的,所以需要JaxB绑定。
以上是关于如何在一个Jaxb2Marshaller中处理更多的WSDL?的主要内容,如果未能解决你的问题,请参考以下文章
Jaxb2Marshaller在春天解组 - 意想不到的元素