当前位置: 代码迷 >> Java Web开发 >> Web Service 错误:服务器未能识别 HTTP 头 SOAPAction 的值: http://tempuri.org/
  详细解决方案

Web Service 错误:服务器未能识别 HTTP 头 SOAPAction 的值: http://tempuri.org/

热度:10627   发布时间:2013-02-25 21:11:19.0
Web Service 异常:服务器未能识别 HTTP 头 SOAPAction 的值: http://tempuri.org/
异常代码如下:
Java code
System.Web.Services.Protocols.SoapException: 服务器未能识别 HTTP 头 SOAPAction 的值: http://tempuri.org/GetSDCities。   在 System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest()   在 System.Web.Services.Protocols.SoapServerProtocol.RouteRequest(SoapServerMessage message)   在 System.Web.Services.Protocols.SoapServerProtocol.Initialize()   在 System.Web.Services.Protocols.ServerProtocol.SetContext(Type type, HttpContext context, HttpRequest request, HttpResponse response)   在 System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)    at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:251)    at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:168)    at org.apache.axis.encoding.DeserializationContextImpl.endElement(DeserializationContextImpl.java:1001)    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:601)    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782)    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2939)    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)    at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)    at org.apache.axis.encoding.DeserializationContextImpl.parse(DeserializationContextImpl.java:242)    at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:538)    at org.apache.axis.Message.getSOAPEnvelope(Message.java:377)    at org.apache.axis.client.Call.invokeEngine(Call.java:2545)    at org.apache.axis.client.Call.invoke(Call.java:2515)    at org.apache.axis.client.Call.invoke(Call.java:2210)    at org.apache.axis.client.Call.invoke(Call.java:2133)    at org.apache.axis.client.Call.invoke(Call.java:1656)    at com.avis.test.AvisDemo.testDemo4(AvisDemo.java:137)    at com.avis.test.AvisDemo.main(AvisDemo.java:149)


代码:

Java code
public static void testDemo4() {        String url = "http://203.148.56.10/WebService/AvisRentalService.asmx";        String namespace = "http://tempuri.org/";        String methodName = "GetSDCities";        String soapActionURI = "http://tempuri.org/GetSDCities";        Service service = new Service();        Call call;        try {            call = (Call) service.createCall();                        call.setTargetEndpointAddress(url);            call.setUseSOAPAction(true);            call.setSOAPActionURI(soapActionURI);            call.setOperationName(new QName(namespace, methodName));            call.addParameter(new QName(namespace, "LoginName"), XMLType.XSD_STRING,ParameterMode.IN);            call.addParameter(new QName(namespace, "Password"), XMLType.XSD_STRING,ParameterMode.IN);            call.setReturnType(XMLType.XSD_STRING);            String[] str = new String[2];            str[0] = "avis@common.com";            str[1] = "zI9Fvh4NmMA=";            Object obj = call.invoke(str);            System.out.println("obj + " + obj);        } catch (ServiceException e) {            e.printStackTrace();        } catch (RemoteException e) {            e.printStackTrace();        }    }
  相关解决方案
本站暂不开放注册!
内测阶段只得通过邀请码进行注册!
 
  • 最近登录:Wed May 23 01:26:06 CST 2018
  • 最近登录:Wed May 23 01:26:06 CST 2018
  • 最近登录:Wed May 23 01:26:06 CST 2018
  • 最近登录:Wed May 23 01:26:06 CST 2018
  • 最近登录:Wed May 23 01:26:06 CST 2018