bye static method

XmlDocument bye({
  1. String? messageId,
  2. String? address,
})

Implementation

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

  builder.element(
    'Envelope',
    namespace: 'http://www.w3.org/2003/05/soap-envelope',
    nest: () {
      builder.namespace('http://www.w3.org/2003/05/soap-envelope', 's');

      builder.namespace(
        'http://schemas.xmlsoap.org/ws/2004/08/addressing',
        'a',
      );

      builder.namespace(
        'http://schemas.xmlsoap.org/ws/2005/04/discovery',
        'd',
      );

      builder.element(
        'Header',
        // namespace: 'http://www.w3.org/2003/05/soap-envelope',
        nest: () {
          builder.element(
            'Action',
            namespace: 'http://schemas.xmlsoap.org/ws/2004/08/addressing',
            nest: 'http://schemas.xmlsoap.org/ws/2005/04/discovery/Bye',
          );

          builder.element(
            'MessageID',
            namespace: 'http://schemas.xmlsoap.org/ws/2004/08/addressing',
            nest: 'uuid:${messageId ?? uuid}',
          );
        },
      );

      builder.element(
        'Body',
        nest: () {
          builder.element(
            'Bye',
            namespace: 'http://schemas.xmlsoap.org/ws/2005/04/discovery',
            nest: () {
              builder.element(
                'EndpointReference',
                namespace: 'http://schemas.xmlsoap.org/ws/2004/08/addressing',
                nest: () {
                  builder.element(
                    'Address',
                    nest: 'urn:uuid:${address ?? uuid}',
                  );
                },
              );
            },
          );
        },
      );
    },
  );

  return builder.buildDocument();
}