New Transparent capture is in preview. Record every app's traffic with no proxy configuration, on Windows, macOS and Linux. Learn more

contentTypeXmlFilter Filter

Select exchanges whose response carries an XML content type, useful when working with SOAP services, RSS feeds and legacy XML APIs.

contentTypeXmlFilter is a thin, focused filter that pairs well with response header actions. It is most useful in mixed estates where some endpoints still return XML alongside newer JSON or gRPC services.

When to use this filter

Use contentTypeXmlFilter when you want to scope a rule to responses that return XML. The filter inspects the response Content-Type header for the standard XML media types (typically application/xml, text/xml, and the +xml family).

Typical situations:

  • Debugging legacy SOAP services where the request is also XML but the response is the meaningful payload.
  • Tagging RSS or Atom feeds in a busy capture to find them quickly later.
  • Stripping or rewriting a response header only when the body is XML so JSON endpoints remain untouched.

The filter fires on the responseHeaderReceivedFromRemote scope, so the response headers must already be available. Pair it with response side actions, request scoped actions are not applicable here.

Real world examples

Tag SOAP service responses

Apply a tag to every XML response coming from a SOAP host so they are easy to filter in the timeline during a debugging session.

rules:
- filter:
    typeKind: FilterCollection
    operation: and
    children:
    - typeKind: HostFilter
      pattern: soap.example.com
      operation: Exact
    - typeKind: ContentTypeXmlFilter
  actions:
  - typeKind: ApplyTagAction
    tag:
      value: soap-response

Force a permissive CORS header on XML feeds

Add a CORS header to XML feed responses so a single page application can consume them from a different origin during development.

rules:
- filter:
    typeKind: ContentTypeXmlFilter
  actions:
  - typeKind: AddResponseHeaderAction
    headerName: Access-Control-Allow-Origin
    headerValue: '*'

Comment any non XML response from a SOAP host

Invert the filter to flag responses from a SOAP host that came back with an unexpected non XML body, those are usually error pages from a fronting load balancer.

rules:
- filter:
    typeKind: FilterCollection
    operation: and
    children:
    - typeKind: HostFilter
      pattern: soap.example.com
      operation: Exact
    - typeKind: ContentTypeXmlFilter
      inverted: true
  actions:
  - typeKind: ApplyCommentAction
    comment: unexpected non-XML response on SOAP host

Reference

contentTypeXmlFilter

Description

Select exchanges having XML response body.

Evaluation scope

Evaluation scope defines the timing where this filter will be applied.

responseHeaderReceivedFromRemote This scope occurs the moment fluxzy has done parsing the response header.

YAML configuration name

contentTypeXmlFilter

Settings

This filter has no specific characteristic

The following table describes the customizable properties available for this filter:

Property Type Description DefaultValue
inverted boolean Negate the filter result false

Example of usage

The following examples apply a comment to the filtered exchange

Select exchanges having XML response body.

rules:
- filter:
    typeKind: ContentTypeXmlFilter
  actions:
  - typeKind: ApplyCommentAction
    comment: filter was applied

.NET reference

View definition of ContentTypeXmlFilter for .NET integration.

See also

The following filters are related to this filter:

Frequently asked questions

Which MIME types are considered XML?

The filter matches the standard XML media types, including application/xml, text/xml and the +xml suffix family such as application/soap+xml or application/atom+xml.

Does it work for request bodies too?

No. contentTypeXmlFilter inspects the response Content-Type header. To match XML in a request body, use a requestHeaderFilter targeting Content-Type.

Can I invert the match?

Yes. Set inverted to true to select every response whose Content-Type is not XML.

What if the server omits the Content-Type header?

The filter cannot match because it has no header to inspect. Fluxzy treats a missing header as not XML.

Learn more about Fluxzy rules