### Method

# Camel Session ref_service_by_url

since: 3.6

#### Declaration [src]

    CamelService*
    camel_session_ref_service_by_url (
      CamelSession* session,
      CamelURL* url,
      CamelProviderType type
    )

#### Description [src]

Looks up a `CamelService` by trying to match its `CamelURL` against the given `url` and then checking that the object is of the desired `type`. The service must have been previously added using camel_session_add_service().

The returned `CamelService` is referenced for thread-safety and must be unreferenced with `g_object_unref()` when finished with it.

Note this function is significantly slower than camel_session_ref_service().

Available since: 3.6

#### Parameters

`url`

  Type: `CamelURL`

  A `CamelURL`.

  The data is owned by the caller of the method.

`type`

  Type: `CamelProviderType`

  A `CamelProviderType`.

#### Return value

Type: `CamelService`

A `CamelService` instance, or `NULL`.

The caller of the method takes ownership of the returned data, and is responsible for freeing it.
The return value can be `NULL`.