WsDecodeUrl function (webservices.h)

Evaluates the components of an URL to determine its "scheme". A WS_URL_SCHEME_TYPE value is encapsulated in a WS_URL structure and a reference to the structure is returned via output parameter. If the scheme is not recognized, the function returns WS_E_INVALID_FORMAT.
Only scheme types identified in WS_URL_SCHEME_TYPE are supported.


HRESULT WsDecodeUrl(
  [in]           const WS_STRING *url,
  [in]           ULONG           flags,
  [in]           WS_HEAP         *heap,
                 WS_URL          **outUrl,
  [in, optional] WS_ERROR        *error


[in] url

A pointer to a WS_STRING representation of the URL to evaluate.

[in] flags

Determines the URL scheme evaluation method. See WS_URL_FLAGS.

[in] heap

A pointer to a WS_HEAP in which to allocate the returned URL reference.


Reference to the WS_URL structure that encapsulates the WS_URL_SCHEME_TYPE value.

[in, optional] error

A pointer to a WS_ERROR object where additional information about the error should be stored if the function fails.

Return value

This function can return one of these values.

Return code Description
One or more arguments are invalid.
Ran out of memory.
The input URL was not in the correct format, or the scheme was not recognized.
Other Errors
This function may return other errors not listed above.


The grammar parsed for the schemes "http", "https", "net.tcp" and "soap.udp" can be found at For these schemes:

  • A non-empty hostname is required.
  • For the IP-literal production all the characters demarcated by "[" and "]" are returned. They are not enforced to follow the IPv6Address production.
  • The userinfo part of authority (for example, userinfo@hostname:port) is not supported.

If no port is specified the default port for that scheme is returned.

If no port is specified for the soap.udp scheme 0xFFFFFFFF is returned as the default.


Minimum supported client Windows 7 [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 R2 [desktop apps | UWP apps]
Target Platform Windows
Header webservices.h
Library WebServices.lib
DLL WebServices.dll