前段时间做一个用户接口,对方提供WebService方式的接口供调用,记录遇到的几个问题
1、Soap1.1、Soap1.2与SoapAction
错误描述:用saaj访问axis2构建的WS,返回错误消息:
com.sun.xml.internal.messaging.saaj.soap.MessageImpl identifyContentType
严重: SAAJ0537: Invalid Content-Type. Could be an error message instead of a SOAP message
com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl:java.security.PrivilegedActionException: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Invalid Content-Type:application/xml. Is this an error message instead of a SOAP response?
at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.call(HttpSOAPConnection.java:146)
错误分析:返回的Soap消息的Content-Type是application/xml,saaj不识别此
Content-Type,认为返回的不是Soap响应
原因:1)客服端saaj能识别的Content-Type为text/xml和application/soap+xml
2)axis2返回的为application/xml,之所以返回此类型,是因为axis2根