简体   繁体   English

为什么从gsoap调用IIS 7.5中运行的Web服务时出现HTTP 400错误?

[英]Why am I getting a HTTP 400 error calling a web service running in IIS 7.5 when called from gsoap?

I am trying to call a web service running on a Windows 7 machine inside of IIS 7.5. 我正在尝试调用在IIS 7.5内的Windows 7计算机上运行的Web服务。 I can call the web service from the local machine using soapUI and a Java client from another machine and it works. 我可以使用soapUI从本地计算机调用Web服务,并从另一台计算机调用Java客户端,它可以工作。 When I try to call the web service from a remote machine using the gsoap framework in a C program, I get an HTTP 400: Bad Request. 当我尝试在C程序中使用gsoap框架从远程计算机调用Web服务时,收到HTTP 400:错误请求。 My request/response is below, any ideas? 我的要求/回应如下,有什么想法吗?

POST /MyService/AddressService.asmx HTTP/1.1
Host: thisMachine.myDomain.net
User-Agent: gSOAP/2.7
Content-Type: text/xml; charset=utf-8
Content-Length: 714
Connection: close
SOAPAction: "http://thisMachine.myDomain.net/MyService/AddressService.asmx/CheckAddress"
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope>
<SOAP-ENV:Body>
    <AddressService1:CheckAddress>
        <AddressService1:chkAddress>
            <AddressService1:chkCompanyName>Test</AddressService1:chkCompanyName>
            <AddressService1:chkStreet1>123 Some Rd</AddressService1:chkStreet1>
            <AddressService1:chkStreet2></AddressService1:chkStreet2>
            <AddressService1:chkCity>Columbia</AddressService1:chkCity>
            <AddressService1:chkState>SC</AddressService1:chkState>
            <AddressService1:chkZipcode5>29054</AddressService1:chkZipcode5>
            <AddressService1:chkZipcode4></AddressService1:chkZipcode4>
            <AddressService1:chkSuite></AddressService1:chkSuite>
        </AddressService1:chkAddress>
    </AddressService1:CheckAddress>
</SOAP-ENV:Body>

HTTP/1.1 400 Bad Request
Cache-Control: private
Server: Microsoft-IIS/7.5
X-AspNet-Version: 2.0.50727
X-Powered-By: ASP.NET
Date: Mon, 29 Aug 2011 19:46:55 GMT
Connection: close
Content-Length: 0

I forgot to mention that I am running GSOAP on OpenVms. 我忘了提到我在OpenVms上运行GSOAP。 This turns out to be significant because gSoap was ported to OpenVms and it appears there may have been an error in the port. 事实证明这很重要,因为gSoap已移植到OpenVms,并且看来端口中可能有错误。 What seems to be going on is that I used the -n option with WSDL2H and specified a namespace to be used in the generation of the gsoap client source files. 似乎正在发生的事情是,我在WSDL2H中使用了-n选项,并指定了用于生成gsoap客户端源文件的名称空间。 The array of namespaces in the generated .nsmap file had my namespace appended to the array's name which causes issues when the array is being referenced (this showed up as a warning at compile time once I changed my make (command procedure) to show warnings); 生成的.nsmap文件中的名称空间数组将我的名称空间附加到该数组的名称上,这会在引用该数组时引起问题(一旦我更改了make(命令过程)以显示警告,这就会在编译时显示为警告) ; since the array couldn't be referenced, the namespaces where left out of the SOAP document and this was unacceptable to the .Net web service and resulted in an HTTP 400 - Bad Request error. 由于无法引用该数组,因此SOAP文档中缺少名称空间,这对.Net Web服务是不可接受的,并导致HTTP 400-错误请求错误。 To get this fixed, I changed the name of the namespace array to 'namespaces' which fixed how the SOAP documents were generated. 为了解决此问题,我将名称空间数组的名称更改为“名称空间”,该名称空间固定了SOAP文档的生成方式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么通过WCF通过https调用.Net 2.0 Web服务时,我收到400错误的请求? - Why am I getting 400 bad request when calling a .Net 2.0 web service from WCF over https? gSOAP 错误 400 HTTP 错误请求 - gSOAP Error 400 HTTP Bad Request 为什么使用IIS Express的.Net Web应用程序出现编译错误? - Why am I getting compilation error with this .Net web app using IIS express? Web服务IIS7 .net Framework 4 http 400 - web service IIS7 .net framework 4 http 400 当Web服务“ B”作为“ A”驻留在服务器上时,是否有从IIS Web服务“ A”调用IIS Web服务“ B”的担忧? - Are there any concerns with calling IIS Web Service “B” from IIS Web Service “A” when Web Service “B” resides on the server as “A”? IIS7.5 WCF服务 - HTTP错误401.3(即使在添加IIS_IUSRS之后) - IIS7.5 WCF Service - HTTP Error 401.3 (Even after adding IIS_IUSRS) 调用Web服务时出现HTTP 407代理身份验证错误 - HTTP 407 proxy authentication error when calling a web service 调用WCF服务操作时HTTP 400 Bad Request? - HTTP 400 Bad Request when calling WCF Service Operation? 尝试连接到WCF服务时为什么会出现此错误 - Why am I getting this error when trying to connect to my WCF service 在Linux上运行.net核心控制台应用程序时,为什么会出现“ Resource file” resx错误? - Why am I getting “Resource file” resx error when running .net core console app on linux?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM