我在向第三方应用程序发送肥皂请求时遇到异常,并且在代码中没有设置 Soap 请求的内容类型。
我试图在元帅发送和接收(..(之前打印肥皂请求,但我看不到任何请求被打印,我认为错误发生在它可以打印/记录请求之前。
需要帮助!!
以下是例外情况:
.sun.xml.internal.messaging.saaj.soap : SAAJ0537: Invalid Content-Type.
Could be an error message instead of a SOAP message
2020-01-22 09:09:42.116 ERROR [cheque-
service,ca93accf0bdaa764,85d910ae8dabce62,false] 230 --- [0.0-8888-exec-2]
c.d.i.m.p.c.e.ExceptionLoggerAspect : Cheque Print service - Unexpected
error occurred:
org.springframework.ws.soap.SoapMessageCreationException: Could not create message from InputStream: Invalid Content-Type:text/html. Is this an error message instead of a SOAP response?; nested exception is com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Invalid Content-Type:text/html. Is this an error message instead of a SOAP response?
at org.springframework.ws.soap.saaj.SaajSoapMessageFactory.createWebServiceMessage(SaajSoapMessageFactory.java:216)
at org.springframework.ws.soap.saaj.SaajSoapMessageFactory.createWebServiceMessage(SaajSoapMessageFactory.java:60)
at org.springframework.ws.transport.AbstractWebServiceConnection.receive(AbstractWebServiceConnection.java:92)
at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:611)
at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:555)
at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:390)
at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:383)
at com.deloitte.insurcloud.microservices.payment.chequeservice.service.client.GwApiClient.callGuidewire(GwApiClient.java:43)
at com.deloitte.insurcloud.microservices.payment.chequeservice.service.client.GwApiClient.updateCheckStatus(GwApiClient.java:36)
at com.deloitte.insurcloud.microservices.payment.chequeservice.service.client.GwApiClient$$FastClassBySpringCGLIB$$9966cc9c.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:736)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:84)
at com.deloitte.insurcloud.microservices.payment.chequeservice.exception.ExceptionLoggerAspect.aroundProcessException(ExceptionLoggerAspect.java:26)
看起来内容类型值是错误的。
请使用以下示例:
headers.setContentType(MediaType.TEXT_XML);
注意:text/xml 是 SOAP 1.1 内容类型。