.NET WCF 无法解码“分块” 回复

发布于 2024-07-19 13:12:05 字数 4380 浏览 12 评论 0原文

我正在从 WCF 调用轴 Web 服务。 该请求工作正常,但我返回空值。 使用 Fiddler,我能够确定响应是基于 Transfer-Encoding: chunked 的。 这意味着响应中的 xml 之前有控制字符。 WCF 不会引发错误。 它只是继续前进,并且该方法应该返回的对象为空。 谁能告诉我如何告诉 WCF 如何正确处理 HTTP 1.1 分块编码消息?

以下是有人提出类似问题的链接:

http://www.biztalkgurus.com /forums/t/10860.aspx

肥皂响应:

HTTP/1.1 200 OK
Date: Wed, 06 May 2009 15:34:41 GMT
Server: Apache
Set-Cookie: JSESSIONID=01A43C26DB5E284B70F1F6D466D5CD5D; Path=/arsys
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/xml;charset=utf-8

ba7
<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><ns0:HelpDesk_QueryList_ServiceResponse xmlns:ns0="urn:Port" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <ns0:getListValues>
        <ns0:Assigned_Group>CHQ-TSR-WEL</ns0:Assigned_Group>
        <ns0:Assigned_Group_Shift_Name/>
        <ns0:Assigned_Support_Company>IT Support</ns0:Assigned_Support_Company>
        <ns0:Assigned_Support_Organization>WH</ns0:Assigned_Support_Organization>
        <ns0:Assignee>David</ns0:Assignee>
        <ns0:Categorization_Tier_1>ADD</ns0:Categorization_Tier_1>
        <ns0:Categorization_Tier_2>HARDWARE</ns0:Categorization_Tier_2>
        <ns0:Categorization_Tier_3>DESKTOP/LAPTOP/NOTEBOOK</ns0:Categorization_Tier_3>
        <ns0:City/>
        <ns0:Closure_Manufacturer/>
        <ns0:Closure_Product_Category_Tier1/>
        <ns0:Closure_Product_Category_Tier2/>
        <ns0:Closure_Product_Category_Tier3/>
        <ns0:Closure_Product_Model_Version/>
        <ns0:Closure_Product_Name/>
        <ns0:Company>IT Support</ns0:Company>
        <ns0:Contact_Company>IT Support</ns0:Contact_Company>
        <ns0:Contact_Sensitivity>Standard</ns0:Contact_Sensitivity>
        <ns0:Country/>
        <ns0:Department>WEL</ns0:Department>
        <ns0:Summary>Old PC to be Cascaded
</ns0:Summary>
        <ns0:Notes> User Name:
Make: Dell
Model: Latitude D600
Serial Number: 
Location: </ns0:Notes>
        <ns0:First_Name>James</ns0:First_Name>
        <ns0:Impact>3-Moderado/Limitado</ns0:Impact>
        <ns0:Incident_Number>INC000000009017</ns0:Incident_Number>
        <ns0:Internet_E-mail></ns0:Internet_E-mail>
        <ns0:Last_Name>Goodrich</ns0:Last_Name>
        <ns0:Manufacturer/>
        <ns0:Middle_Initial/>
        <ns0:Organization>--</ns0:Organization>
        <ns0:Phone_Number>+326</ns0:Phone_Number>
        <ns0:Priority>Medium</ns0:Priority>
        <ns0:Priority_Weight/>
        <ns0:Product_Categorization_Tier_1>HARDWARE</ns0:Product_Categorization_Tier_1>
        <ns0:Product_Categorization_Tier_2>DESKTOP/LAPTOP/NOTEBOOK</ns0:Product_Categorization_Tier_2>
        <ns0:Product_Categorization_Tier_3>CASCADE PC</ns0:Product_Categorization_Tier_3>
        <ns0:Product_Model_Version/>
        <ns0:Product_Name/>
        <ns0:Region></ns0:Region>
        <ns0:Reported_Source/>
        <ns0:Resolution>New PC
Make: 
Model: 
Serial Number: 
Ship to:
Shipping Carrier:
Tracking Number:</ns0:Resolution>
        <ns0:Resolution_Category/>
        <ns0:Resolution_Category_Tier_2/>
        <ns0:Resolution_Category_Tier_3/>
        <ns0:Service_Type>User Service Request</ns0:Service_Type>
        <ns0:Site>Salt Lake City</ns0:Site>
        <ns0:Site_Group/>
        <ns0:Status>Assigned</ns0:Status>
        <ns0:Status_Reason/>
        <ns0:Urgency>3-Medium</ns0:Urgency>
        <ns0:VIP>No</ns0:VIP>
    </ns0:getListValues>
</ns0:HelpDesk_QueryList_ServiceResponse></soapenv:Body></soapenv:Envelope>
0

I am calling an axis web service from WCF. The request works just fine but I get back null values. Using Fiddler I was able to determine that the response is coming base as Transfer-Encoding: chunked. This means that there are control characters in in the response BEFORE the xml. WCF does NOT throw an error. It just moves on and the object that is supposed to be returned by the Method is null. Can anyone tell me how to tell WCF how to correctly handle an HTTP 1.1 chunked encoded message?

Here is a link to someone asking a similer question:

http://www.biztalkgurus.com/forums/t/10860.aspx

Soap Response:

HTTP/1.1 200 OK
Date: Wed, 06 May 2009 15:34:41 GMT
Server: Apache
Set-Cookie: JSESSIONID=01A43C26DB5E284B70F1F6D466D5CD5D; Path=/arsys
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/xml;charset=utf-8

ba7
<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><ns0:HelpDesk_QueryList_ServiceResponse xmlns:ns0="urn:Port" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <ns0:getListValues>
        <ns0:Assigned_Group>CHQ-TSR-WEL</ns0:Assigned_Group>
        <ns0:Assigned_Group_Shift_Name/>
        <ns0:Assigned_Support_Company>IT Support</ns0:Assigned_Support_Company>
        <ns0:Assigned_Support_Organization>WH</ns0:Assigned_Support_Organization>
        <ns0:Assignee>David</ns0:Assignee>
        <ns0:Categorization_Tier_1>ADD</ns0:Categorization_Tier_1>
        <ns0:Categorization_Tier_2>HARDWARE</ns0:Categorization_Tier_2>
        <ns0:Categorization_Tier_3>DESKTOP/LAPTOP/NOTEBOOK</ns0:Categorization_Tier_3>
        <ns0:City/>
        <ns0:Closure_Manufacturer/>
        <ns0:Closure_Product_Category_Tier1/>
        <ns0:Closure_Product_Category_Tier2/>
        <ns0:Closure_Product_Category_Tier3/>
        <ns0:Closure_Product_Model_Version/>
        <ns0:Closure_Product_Name/>
        <ns0:Company>IT Support</ns0:Company>
        <ns0:Contact_Company>IT Support</ns0:Contact_Company>
        <ns0:Contact_Sensitivity>Standard</ns0:Contact_Sensitivity>
        <ns0:Country/>
        <ns0:Department>WEL</ns0:Department>
        <ns0:Summary>Old PC to be Cascaded
</ns0:Summary>
        <ns0:Notes> User Name:
Make: Dell
Model: Latitude D600
Serial Number: 
Location: </ns0:Notes>
        <ns0:First_Name>James</ns0:First_Name>
        <ns0:Impact>3-Moderado/Limitado</ns0:Impact>
        <ns0:Incident_Number>INC000000009017</ns0:Incident_Number>
        <ns0:Internet_E-mail></ns0:Internet_E-mail>
        <ns0:Last_Name>Goodrich</ns0:Last_Name>
        <ns0:Manufacturer/>
        <ns0:Middle_Initial/>
        <ns0:Organization>--</ns0:Organization>
        <ns0:Phone_Number>+326</ns0:Phone_Number>
        <ns0:Priority>Medium</ns0:Priority>
        <ns0:Priority_Weight/>
        <ns0:Product_Categorization_Tier_1>HARDWARE</ns0:Product_Categorization_Tier_1>
        <ns0:Product_Categorization_Tier_2>DESKTOP/LAPTOP/NOTEBOOK</ns0:Product_Categorization_Tier_2>
        <ns0:Product_Categorization_Tier_3>CASCADE PC</ns0:Product_Categorization_Tier_3>
        <ns0:Product_Model_Version/>
        <ns0:Product_Name/>
        <ns0:Region></ns0:Region>
        <ns0:Reported_Source/>
        <ns0:Resolution>New PC
Make: 
Model: 
Serial Number: 
Ship to:
Shipping Carrier:
Tracking Number:</ns0:Resolution>
        <ns0:Resolution_Category/>
        <ns0:Resolution_Category_Tier_2/>
        <ns0:Resolution_Category_Tier_3/>
        <ns0:Service_Type>User Service Request</ns0:Service_Type>
        <ns0:Site>Salt Lake City</ns0:Site>
        <ns0:Site_Group/>
        <ns0:Status>Assigned</ns0:Status>
        <ns0:Status_Reason/>
        <ns0:Urgency>3-Medium</ns0:Urgency>
        <ns0:VIP>No</ns0:VIP>
    </ns0:getListValues>
</ns0:HelpDesk_QueryList_ServiceResponse></soapenv:Body></soapenv:Envelope>
0

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

守护在此方 2024-07-26 13:12:05

我不认为你能够让它工作,因为 IIS(或客户端,取决于你所在的一方)应该在它到达你之前将其删除,就像你不应该手动解压缩 a要求。

这种情况中,服务器软件似乎并不能很好地支持分块。

I don't think you will be able to get that to work as IIS (or the client depending on what side you are on) should strip that out before it gets to you, same as you should not have to manually de-gzip a request.

In this case it seems that chunked is not well supported by server software.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文