### Method

# EDataServer SoupSession send_message_sync

since: 3.26

#### Declaration [src]

    GInputStream*
    e_soup_session_send_message_sync (
      ESoupSession* session,
      SoupMessage* message,
      GCancellable* cancellable,
      GError** error
    )

#### Description [src]

Synchronously sends prepared message and returns `GInputStream` that can be used to read its contents.

This calls `soup_session_send()` internally, but it also setups the `message` according to `ESoupSession:source` authentication settings. It also extracts information about used certificate, in case of G_TLS_ERROR_BAD_CERTIFICATE error and keeps it for later use by e_soup_session_get_ssl_error_details().

Use `e_soup_session_send_message_simple_sync()` to read whole content into a `GByteArray`.

Note that SoupSession doesn’t log content read from GInputStream, thus the caller may print the read content on its own when needed.

Note the `message` is fully filled only after there is anything read from the resulting `GInputStream`, thus use `e_soup_session_check_result()` to verify that the receive had been finished properly.

Make sure the `GInputStream` is read and freed from the same thread, and with the same thread default main context, which this function was called from, otherwise it can break libsoup3.

Available since: 3.26

#### Parameters

`message`

  Type: `SoupMessage`

  A `SoupMessage` to send.

  The data is owned by the caller of the method.

`cancellable`

  Type: `GCancellable`

  Optional `GCancellable` object, or `NULL`.

  The argument can be `NULL`.
  The data is owned by the caller of the method.

`error`

  Type: `GError **`

  The return location for a recoverable error.

  The argument can be `NULL`.
  If the return location is not `NULL`, then you must initialize it to a `NULL` `GError*`.
  The argument will be left initialized to `NULL` by the method if there are no errors.
  In case of error, the argument will be set to a newly allocated `GError`; the caller will take ownership of the data, and be responsible for freeing it.

#### Return value

Type: `GInputStream`

A newly allocated `GInputStream`, that can be used to read from the URI pointed to by `message`. Free it with g_object_unref(), when no longer needed.

The caller of the method takes ownership of the returned data, and is responsible for freeing it.