probe static method

XmlDocument probe({
  1. String? messageId,
})

Implementation

static XmlDocument probe({String? messageId}) {
  builder.declaration(encoding: 'UTF-8');

  builder.element(
    'Envelope',
    namespaceUri: 'http://www.w3.org/2003/05/soap-envelope',
    nest: () {
      builder.namespaceUri('s', 'http://www.w3.org/2003/05/soap-envelope');
      builder.namespaceUri(
        'a',
        'http://schemas.xmlsoap.org/ws/2004/08/addressing',
      );
      builder.namespaceUri(
        'd',
        'http://schemas.xmlsoap.org/ws/2005/04/discovery',
      );

      builder.element(
        'Header',
        namespaceUri: 'http://www.w3.org/2003/05/soap-envelope',
        nest: () {
          builder.element(
            'MessageID',
            namespaceUri: 'http://schemas.xmlsoap.org/ws/2004/08/addressing',
            nest: 'uuid:${messageId ?? uuid}',
          );

          builder.element(
            'To',
            namespaceUri: 'http://schemas.xmlsoap.org/ws/2004/08/addressing',
            nest: () {
              builder.attribute(
                'mustUnderstand',
                'true',
                namespaceUri: 'http://www.w3.org/2003/05/soap-envelope',
              );
              builder.text('urn:schemas-xmlsoap-org:ws:2005:04:discovery');
            },
          );

          builder.element(
            'ReplyTo',
            namespaceUri: 'http://schemas.xmlsoap.org/ws/2004/08/addressing',
            nest: () {
              builder.element(
                'Address',
                namespaceUri:
                    'http://schemas.xmlsoap.org/ws/2004/08/addressing',
                nest: () {
                  builder.text(
                    'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous',
                  );
                },
              );
            },
          );

          builder.element(
            'Action',
            namespaceUri: 'http://schemas.xmlsoap.org/ws/2004/08/addressing',
            nest: () {
              builder.attribute(
                'mustUnderstand',
                'true',
                namespaceUri: 'http://www.w3.org/2003/05/soap-envelope',
              );
              builder.text(
                'http://schemas.xmlsoap.org/ws/2005/04/discovery/Probe',
              );
            },
          );
        },
      );

      builder.element(
        'Body',
        namespaceUri: 'http://www.w3.org/2003/05/soap-envelope',
        nest: () {
          builder.element(
            'Probe',
            namespaceUri: 'http://schemas.xmlsoap.org/ws/2005/04/discovery',
            nest: () {
              builder.element(
                'Types',
                namespaceUri:
                    'http://schemas.xmlsoap.org/ws/2005/04/discovery',
                nest: () {
                  builder.namespaceUri('dn', Xmlns.dn);
                  builder.namespaceUri('tds', Xmlns.tds);

                  builder.text('dn:NetworkVideoTransmitter  tds:Device');
                },
              );
            },
          );
        },
      );
    },
  );

  return builder.buildDocument();
}