Owen Rudge : wsdapi: Populate SOAP header structure.
Alexandre Julliard
julliard at winehq.org
Tue Mar 20 17:51:34 CDT 2018
Module: wine
Branch: master
Commit: 42d6d92d0d28d58378ea55d6275723bad1645e79
URL: https://source.winehq.org/git/wine.git/?a=commit;h=42d6d92d0d28d58378ea55d6275723bad1645e79
Author: Owen Rudge <orudge at codeweavers.com>
Date: Mon Mar 19 21:46:18 2018 +0000
wsdapi: Populate SOAP header structure.
Signed-off-by: Owen Rudge <orudge at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/wsdapi/soap.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 65 insertions(+), 1 deletion(-)
diff --git a/dlls/wsdapi/soap.c b/dlls/wsdapi/soap.c
index f67dc9e..c33c73b 100644
--- a/dlls/wsdapi/soap.c
+++ b/dlls/wsdapi/soap.c
@@ -31,6 +31,54 @@ WINE_DEFAULT_DEBUG_CHANNEL(wsdapi);
#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,
struct list *discovered_namespaces, IWSDUdpAddress *remote_address, int max_initial_delay)
{
@@ -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 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 */
/* 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;
}
More information about the wine-cvs
mailing list