以下是我通过以下代码段调用我的网络服务的方式。
try{
SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
SOAPConnection soapConnection = soapConnectionFactory.createConnection();
String url = "http://**********/webservice.asmx?WSDL";
SOAPMessage soapACK = soapConnection.call(soapCalling(dataID,dataString), url);
printSOAP(soapACK,dataID);
}
catch (Exception e){
e.printStackTrace();
System.err.println(e.toString());
}
我一直在收到错误。错误是否反映服务器已关闭或此处有任何其他提示?什么是最好的整改?是否需要添加soapConnection .setConnectTimeout(30 * 1000); // 15秒 soapConnection .setReadTimeout(30 * 1000);
com.sun.xml.internal.messaging.saaj.soap.MessageImpl identifyContentType
SEVERE: SAAJ0537: Invalid Content-Type. Could be an error message instead of a SOAP message
com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Invalid Content-Type:text/html. Is this an error message instead of a SOAP response?
at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.call(HttpSOAPConnection.java:148)
at cs1$cr1.sendIncomingData(cs1.java:2829)
at cs1$cr1r.run(cs1.java:2454)
at java.lang.Thread.run(Thread.java:722)
Caused by: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Invalid Content-Type:text/html. Is this an error message instead of a SOAP response?
at com.sun.xml.internal.messaging.saaj.soap.MessageImpl.identifyContentType(MessageImpl.java:649)
at com.sun.xml.internal.messaging.saaj.soap.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:85)
at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.post(HttpSOAPConnection.java:327)
at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.call(HttpSOAPConnection.java:144)