Commit 42d6d92d authored by Owen Rudge's avatar Owen Rudge Committed by Alexandre Julliard

wsdapi: Populate SOAP header structure.

parent 09612dd5
...@@ -31,6 +31,54 @@ WINE_DEFAULT_DEBUG_CHANNEL(wsdapi); ...@@ -31,6 +31,54 @@ WINE_DEFAULT_DEBUG_CHANNEL(wsdapi);
#define APP_MAX_DELAY 500 #define APP_MAX_DELAY 500
static const WCHAR discoveryTo[] = {
'u','r','n',':',
's','c','h','e','m','a','s','-','x','m','l','s','o','a','p','-','o','r','g',':',
'w','s',':','2','0','0','5',':','0','4',':',
'd','i','s','c','o','v','e','r','y', 0 };
static const WCHAR actionHello[] = {
'h','t','t','p',':','/','/',
's','c','h','e','m','a','s','.','x','m','l','s','o','a','p','.','o','r','g','/',
'w','s','/','2','0','0','5','/','0','4','/',
'd','i','s','c','o','v','e','r','y','/',
'H','e','l','l','o', 0 };
static BOOL create_guid(LPWSTR buffer)
{
const WCHAR formatString[] = { 'u','r','n',':','u','u','i','d',':','%','s', 0 };
WCHAR* uuidString = NULL;
UUID uuid;
if (UuidCreate(&uuid) != RPC_S_OK)
return FALSE;
UuidToStringW(&uuid, (RPC_WSTR*)&uuidString);
if (uuidString == NULL)
return FALSE;
wsprintfW(buffer, formatString, uuidString);
RpcStringFreeW((RPC_WSTR*)&uuidString);
return TRUE;
}
static void populate_soap_header(WSD_SOAP_HEADER *header, LPCWSTR to, LPCWSTR action, LPCWSTR message_id,
WSD_APP_SEQUENCE *sequence, const WSDXML_ELEMENT *any_headers)
{
ZeroMemory(header, sizeof(WSD_SOAP_HEADER));
header->To = to;
header->Action = action;
header->MessageID = message_id;
header->AppSequence = sequence;
header->AnyHeaders = (WSDXML_ELEMENT *)any_headers;
/* TODO: Implement RelatesTo, ReplyTo, From, FaultTo */
}
static HRESULT write_and_send_message(IWSDiscoveryPublisherImpl *impl, WSD_SOAP_HEADER *header, WSDXML_ELEMENT *body_element, static HRESULT write_and_send_message(IWSDiscoveryPublisherImpl *impl, WSD_SOAP_HEADER *header, WSDXML_ELEMENT *body_element,
struct list *discovered_namespaces, IWSDUdpAddress *remote_address, int max_initial_delay) struct list *discovered_namespaces, IWSDUdpAddress *remote_address, int max_initial_delay)
{ {
...@@ -72,8 +120,24 @@ HRESULT send_hello_message(IWSDiscoveryPublisherImpl *impl, LPCWSTR id, ULONGLON ...@@ -72,8 +120,24 @@ HRESULT send_hello_message(IWSDiscoveryPublisherImpl *impl, LPCWSTR id, ULONGLON
const WSD_URI_LIST *xaddrs_list, const WSDXML_ELEMENT *hdr_any, const WSDXML_ELEMENT *ref_param_any, const WSD_URI_LIST *xaddrs_list, const WSDXML_ELEMENT *hdr_any, const WSDXML_ELEMENT *ref_param_any,
const WSDXML_ELEMENT *endpoint_ref_any, const WSDXML_ELEMENT *any) const WSDXML_ELEMENT *endpoint_ref_any, const WSDXML_ELEMENT *any)
{ {
WSD_SOAP_HEADER soapHeader;
WSD_APP_SEQUENCE sequence;
WCHAR message_id[64];
HRESULT ret = E_OUTOFMEMORY;
sequence.InstanceId = instance_id;
sequence.MessageNumber = msg_num;
sequence.SequenceId = session_id;
if (!create_guid(message_id)) goto cleanup;
populate_soap_header(&soapHeader, discoveryTo, actionHello, message_id, &sequence, hdr_any);
/* TODO: Populate message body */ /* TODO: Populate message body */
/* Write and send the message */ /* Write and send the message */
return write_and_send_message(impl, NULL, NULL, NULL, NULL, APP_MAX_DELAY); ret = write_and_send_message(impl, &soapHeader, NULL, NULL, NULL, APP_MAX_DELAY);
cleanup:
return ret;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment