0

对于成功(ACKs / StatusCode == 200)和不成功(NACKs / StatusCode != 200)发布,如何通过 HTTP 发送适配器检索由 POST 产生的自定义 HTTP ResponseStatusDescription

即来自提琴手的回应:

HTTP/1.1 200 ResponseStatusDescription
Cache-Control: private
Transfer-Encoding: chunked
Content-Type: text/html; charset=utf-8
Server: Microsoft-IIS/7.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Fri, 23 Nov 2012 10:19:06 GMT

2c
This is the response body, statuscode: '200'
0

无效响应示例:

HTTP/1.1 408 Custom Status Description
Cache-Control: private
Transfer-Encoding: chunked
Content-Type: text/html; charset=utf-8
Server: Microsoft-IIS/7.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Fri, 23 Nov 2012 14:42:37 GMT

2c
This is the response body, statuscode: '408'
0

如果有帮助,我正在测试一个简单的 asp.net Web 项目,其中 Page_Load 被覆盖,如下所示:

    protected void Page_Load(object sender, EventArgs e)
    {            
        Response.SuppressContent = false;
        //Response.StatusCode = 200;
        Response.StatusCode = 400;
        Response.StatusDescription = "ResponseStatusDescription";
        string Resp = string.Format("This is the response body, statuscode: '{0}'", Response.StatusCode);
        Response.Write(Resp);
        Response.Flush();

    }
4

1 回答 1

0

使用下面的架构,创建一个带有平面文件反汇编器组件的接收管道,并在属性中使用下面的架构。现在在 HTTP 端口的接收响应部分使用这个自定义接收管道。

<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns="http://httpresponse.httpresponse" targetNamespace="http://httpresponse.httpresponse" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:annotation>
    <xs:appinfo>
      <schemaEditorExtension:schemaInfo namespaceAlias="b" extensionClass="Microsoft.BizTalk.FlatFileExtension.FlatFileExtension" standardName="Flat File" xmlns:schemaEditorExtension="http://schemas.microsoft.com/BizTalk/2003/SchemaEditorExtensions" />
      <b:schemaInfo standard="Flat File" codepage="65001" default_pad_char=" " pad_char_type="char" count_positions_by_byte="false" parser_optimization="speed" lookahead_depth="3" suppress_empty_nodes="false" generate_empty_nodes="true" allow_early_termination="false" early_terminate_optional_fields="false" allow_message_breakup_of_infix_root="false" compile_parse_tables="false" root_reference="HTTPResponse" />
    </xs:appinfo>
  </xs:annotation>
  <xs:element name="HTTPResponse">
    <xs:annotation>
      <xs:appinfo>
        <b:recordInfo structure="delimited" child_delimiter_type="hex" child_delimiter="0xD 0xA" child_order="infix" sequence_number="1" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" />
      </xs:appinfo>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:annotation>
          <xs:appinfo>
            <groupInfo sequence_number="0" xmlns="http://schemas.microsoft.com/BizTalk/2003" />
          </xs:appinfo>
        </xs:annotation>
        <xs:element name="Line1" type="xs:string">
          <xs:annotation>
            <xs:appinfo>
              <b:fieldInfo justification="left" sequence_number="1" />
            </xs:appinfo>
          </xs:annotation>
        </xs:element>
        <xs:element name="Line2">
          <xs:annotation>
            <xs:appinfo>
              <b:recordInfo structure="delimited" child_delimiter_type="char" child_delimiter="'" child_order="postfix" sequence_number="2" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" />
            </xs:appinfo>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:annotation>
                <xs:appinfo>
                  <groupInfo sequence_number="0" xmlns="http://schemas.microsoft.com/BizTalk/2003" />
                </xs:appinfo>
              </xs:annotation>
              <xs:element name="Text" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" sequence_number="1" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
              <xs:element name="HTTPResponseCode" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" sequence_number="2" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="Line3" type="xs:string">
          <xs:annotation>
            <xs:appinfo>
              <b:fieldInfo justification="left" sequence_number="3" />
            </xs:appinfo>
          </xs:annotation>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>
于 2012-11-26T12:58:48.903 回答