检索BizTalk中的自定义HTTP后响应状态描述

时间:2012-11-23 11:03:25

标签: http post biztalk

如何通过HTTP发送适配器检索由POST发出的自定义HTTP ResponseStatusDescription,以便成功(ACK / StatusCode == 200)和不成功(NACKs / StatusCode!= 200)发布

即。来自Fiddler的回应:

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();

    }

1 个答案:

答案 0 :(得分: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>