将WSDL添加到Project后,底层连接意外关闭

时间:2014-12-03 19:04:18

标签: c# web-services soap wsdl

我收到了一个WSDL文件,我想向我的应用程序添加一项服务,该服务通过该服务发送数据。

我通过以下方式添加了WSDL文件:

  1. 右键单击项目 - >添加服务参考
  2. 点击高级 - >添加Web引用
  3. 将WSDL文件URL添加到URL文本框
  4. 添加参考
  5. 参考出现在Web Reference文件夹下。

    我添加了这段代码:

            using (var client = new getSubmitClaimWSD())
            {
                SubmitClaimRequest request = new SubmitClaimRequest()
                {
                    buName = "Thermo King TSA",
                    dealerNumber = "PHSDF",
                    userName = "Roger",
                    password = "1234",
                    transactionType = "WARRANTY",
                    claimLanguage = "ENG",
                    serviceVersion = "1.0",
                    claimType = "PARTS",
                    failureDate = new DateTime(2014, 11, 26),
                    faultFound = "PERFORM A FREE INSPECTION",
                    inventorySerialNumber = "12352341",
                    repairDate = new DateTime(2014, 11, 26),
                    workOrderNumber = "testProcede1",
                    conditionsFound = "test",
                    workPerformed = "test",
                    claimNotes = "test claim notes",
                    faultLocation = "FF",
                    failureDetail = "test",
                    smrClaim = "N",
                    forceToDraft = "Y",
                    validateOnly = "N",
                    commercialPolicy = "N",
                    fuelSurcharge = 0,
                    shopSupplies = 0,
                    claimCurrency = "USD",
                    workOrderSegment = "1",
                    partsType = new[]
                    {
                        new eachPart() {partNumber = "1234", partPrice = 100.78, partQuantity = 17, partType = "NONIR", partDescription = "test part desc"},
                        new eachPart() {partNumber = "5678", partPrice = 200.90, partQuantity = 1, partType = "IRREMOVED", partDescription = "test part desc 2"}
                    }
                };
    
                var response = client.getSubmitClaim(null, request);
                var rsp = response.response;
                Console.WriteLine("Status {0}, claim {1}; {2} {3}, {4} errors", rsp.status, rsp.claimNumber,
                    rsp.workOrderNumber, rsp.workOrderSegment, rsp.errorsType.Length);
            }
    

    在这一行:

    var response = client.getSubmitClaim(null, request);
    

    我一直得到例外:

    enter image description here

    这是我的web.config

    的一部分
      <applicationSettings>
        <TKWarranty.Properties.Settings>
          <setting name="TKWarranty_ThermalKing_getSubmitClaimWSD" serializeAs="String">
            <value>http://data.thermoking.com:443/ws/ThermoKingWebServices.SubmitClaim:getSubmitClaimWSD</value>
          </setting>
        </TKWarranty.Properties.Settings>
      </applicationSettings>
    

    可以找到WSDL文件HERE

    当我有Fiddler运行时,我在同一行上收到此错误消息:

    enter image description here

    有谁知道为什么我会收到此错误?我已在网络配置中确认了端口号。

0 个答案:

没有答案