为什么我会从Web服务获得400(错误请求)响应

时间:2018-12-20 14:00:23

标签: c# soap wsdl

我正在尝试为SOAP Web服务创建客户端,我已经从WSDL中将Web服务添加为Web服务引用,一切正常,直到我发送请求为止(我将在此处添加完整请求),每次收到响应“ Bad Request”

我已经尝试了所有修复程序,并排除了所有可能导致此问题的问题(在线)(服务器地址正确,没有凭据等)。

POST http://XXXXX--CoveredHost--XXXXX/WebServices.Service.Call.cls HTTP/1.1
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://tempuri.org/WebServices.Service.Call.OpenCall"
Host: XXXXX--CoveredHost--XXXXX
Content-Length: 515
Expect: 100-continue
Accept-Encoding: gzip, deflate
Connection: Keep-Alive

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<OpenCall xmlns="http://tempuri.org" xmlns:i="http://www.w3.org/2001/XMLSchemainstance">
<InpObj>
<CustNum>0</CustNum>
<CustIdNum>1234567890</CustIdNum>
<CustIdType>0</CustIdType>
<CustTel>0505050505</CustTel>
<CallType>10</CallType>
<Subject>1</Subject>
<Subject2>2</Subject2>
<CallDescription>blablalbvl</CallDescription>
<MkmCode>0</MkmCode>
</InpObj>
<OutObj>
<ServiceCallNum>0</ServiceCallNum>
</OutObj>
</OpenCall>
</s:Body>
</s:Envelope>

我的c#代码:

private void button1_Click(object sender, EventArgs e)
        {
            ServiceCall.CallWSSoapClient call = new ServiceCall.CallWSSoapClient();
            ServiceCall.OpenCallOut outOb = new ServiceCall.OpenCallOut();
            ServiceCall.OpenCallInp inOb = new ServiceCall.OpenCallInp();



            inOb.CallDescription = "blablalbvl";
            inOb.CallType = 10;
            inOb.CustIdNum = "1234567890";
            inOb.CustTel = "0505050505";
            inOb.Subject = 1;
            inOb.Subject2 = 8;

            long answer = call.OpenCall(inOb, ref outOb);
        }

0 个答案:

没有答案