JAVA写的WEBSERVICE(是别人的),我用.NET程序访问WS出错。错误如下:
HTTP/1.1 501 Method                                                                                                                                                                                                                       POST is not defined in RFC 2068 and is not supported by the Servlet API 
X-Powered-By: Servlet 2.4; Tomcat-5.0.28/JBoss-4.0.0 (build: CVSTag=JBoss_4_0_0 date=200409200418)
Content-Type: text/html;charset=utf-8
Content-Length: 1868
Date: Thu, 17 Jun 2010 07:59:18 GMT
Server: Apache-Coyote/1.1
Connection: close
不知道哪位兄弟遇到过没有,非常感谢!

解决方案 »

  1.   

    http://topic.csdn.net/u/20071214/10/c70433ea-5970-452f-8985-e7453e9b1cae.html看看你是否也是post方法名大小写问题。
      

  2.   

    我觉得就跟这种HTTP底层东西有关。核对或更换一下运行场景。
      

  3.   

    肯定不是大小写问题,我的POST都是大写的
    另外:我是写的一个SOCKET程序去访问的WS,直接发送的一个字符串,如下:string soap4= @"<?xml version=""1.0"" encoding=""utf-8""?>
    <soap:Envelope xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"" 
    xmlns:soapenc=""http://schemas.xmlsoap.org/soap/encoding/"" 
    xmlns:tns=""http://192.168.0.169:8080/testWS/services/HelloServices"" 
    xmlns:types=""http://192.168.0.169:8080/testWS/services/HelloServices/encodedTypes"" 
    xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" 
    xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
    <soap:Body soap:encodingStyle=""http://schemas.xmlsoap.org/soap/encoding/"">
    <q1:sayHelloToPerson xmlns:q1=""http://webservice.sinosoft.com"">
    <name xsi:type=""xsd:string"">test</name>
    </q1:sayHelloToPerson>
    </soap:Body>
    </soap:Envelope>";
                string httpHeader4 = @"POST /testWS/services/HelloServices HTTP/1.1
    User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 2.0.50727.3603)
    Content-Type: text/xml; charset=utf-8
    SOAPAction: """"
    Host: 192.168.0.169:8080
    Content-Length: " + soap4.Length + @"
    Expect: 100-continue
    Connection: Keep-Alive";
    在本机上测试都是可以访问到WS的,但是实际环境中,需要过一个网闸,那样的话就返回上面的错误了。
    后面我用抓包工具看了一下,WS的机子收到的数据中,实际环境中,只要过了网闸,那么就把里面的回车符换成了"..",也就是换成了两个点,不知道是怎么回事,有没有哪位大侠遇到过!
      

  4.   

    不知道有没有哪位大侠用过smartSniff的,过网闸的时候,接收到的数据包有显示十六进制的信息,也有显示具体的数据包信息。
    而不过网闸的情况(这种情况可以访问到WS),接收到的数据包并没有显示十六进制,不知道是怎么回事!
      

  5.   

    终于发现问题所在了,我发送的SOCKET数据包,如果不通过网闸的话,WS接收到的就跟我发送的一样,自然就能够处理了;但是如果过网闸的话,不知道怎么回事,数据包的前面加了很多空格,所以WS就不认识了,非常郁闷,不知道有没有哪个兄弟遇到过。
    或者有没有办法将这个空格在WS处理接收到数据之前删除掉!!