日期:2014-05-17  浏览次数:20706 次

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, "Lo