简体   繁体   中英

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. I can call the web service from the local machine using soapUI and a Java client from another machine and it works. 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. 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. This turns out to be significant because gSoap was ported to OpenVms and it appears there may have been an error in the port. 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. 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); 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. To get this fixed, I changed the name of the namespace array to 'namespaces' which fixed how the SOAP documents were generated.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM