我正在使用下一个配置创建一个spring集成出站网关:
@Configuration
public class WebServiceConfiguration {
@Bean
@ServiceActivator(inputChannel = "invocationChannel")
public MessageHandler wsOutboundGateway() throws Exception {
MarshallingWebServiceOutboundGateway gw =
new MarshallingWebServiceOutboundGateway(
"http://localhost:8098/mockPort",
jaxb2Marshaller());
gw.setOutputChannelName("responseChannel");
return gw;
}
public Jaxb2Marshaller jaxb2Marshaller() throws Exception {
Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
marshaller.setProcessExternalEntities(true);
// List of packages with XML Root elements (types) generated with Wsdl2Java
marshaller.setContextPaths(
"com.company.wsdl.types.p1", "com.company.wsdl.types.p2");
}
但是我得到了:"无法从给定的源创建信封,因为命名空间未被识别"我对这个错误有任何想法:
Caused by: com.sun.xml.internal.messaging.saaj.soap.SOAPVersionMismatchException: Unable to create envelope from given source because the namespace was not recognized
at com.sun.xml.internal.messaging.saaj.soap.SOAPPartImpl.lookForEnvelope(SOAPPartImpl.java:150)
at com.sun.xml.internal.messaging.saaj.soap.SOAPPartImpl.getEnvelope(SOAPPartImpl.java:121)
at com.sun.xml.internal.messaging.saaj.soap.EnvelopeFactory.createEnvelope(EnvelopeFactory.java:110)
at com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPPart1_1Impl.createEnvelopeFromSource(SOAPPart1_1Impl.java:68)
at com.sun.xml.internal.messaging.saaj.soap.SOAPPartImpl.getEnvelope(SOAPPartImpl.java:128)
at org.springframework.ws.soap.saaj.SaajSoapMessageFactory.createWebServiceMessage(SaajSoapMessageFactory.java:189)
更新
我将我的RequestType更改为Envelope,它似乎被识别但现在我得到了:" org.springframework.ws.client.WebServiceTransportException:内部服务器错误[500]"。
我的服务器正在通过SOAP UI进行监听,并且可以在浏览器中访问。
更新II
Transformer and Handler配置:
SENDER
@Transformer(inputChannel="requestChannel", outputChannel="invocationChannel")
public ResquestType buildRequest(Message<String> msg) {
//creates a ResquestType from msg param
return ResquestType;
}
RESPONSE HANDLER
@ServiceActivator(inputChannel="responseChannel")
public int getResponse(Message<Envelope> msg) {
// Builds the response status
}
我发送结构:
接收结构:
答案 0 :(得分:0)
“org.springframework.ws.client.WebServiceTransportException:内部服务器错误[500]:无法从给定来源创建信封,因为无法识别名称空间
SOAP UI具有跟踪请求/响应的功能。使用它,您可以查看您或您的服务为SOAP提供错误的XML。