wsdapi: Create Body and Hello elements in Hello message.
Signed-off-by: Owen Rudge <orudge@codeweavers.com> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
1a7df56e56
commit
86515b390e
|
@ -73,6 +73,8 @@ static const WCHAR instanceIdString[] = { 'I','n','s','t','a','n','c','e','I','d
|
||||||
static const WCHAR messageNumberString[] = { 'M','e','s','s','a','g','e','N','u','m','b','e','r', 0 };
|
static const WCHAR messageNumberString[] = { 'M','e','s','s','a','g','e','N','u','m','b','e','r', 0 };
|
||||||
static const WCHAR sequenceIdString[] = { 'S','e','q','u','e','n','c','e','I','d', 0 };
|
static const WCHAR sequenceIdString[] = { 'S','e','q','u','e','n','c','e','I','d', 0 };
|
||||||
static const WCHAR emptyString[] = { 0 };
|
static const WCHAR emptyString[] = { 0 };
|
||||||
|
static const WCHAR bodyString[] = { 'B','o','d','y', 0 };
|
||||||
|
static const WCHAR helloString[] = { 'H','e','l','l','o', 0 };
|
||||||
|
|
||||||
struct discovered_namespace
|
struct discovered_namespace
|
||||||
{
|
{
|
||||||
|
@ -732,6 +734,10 @@ static HRESULT create_soap_envelope(IWSDXMLContext *xml_context, WSD_SOAP_HEADER
|
||||||
ret = write_xml_element(header_element, writer);
|
ret = write_xml_element(header_element, writer);
|
||||||
if (FAILED(ret)) goto cleanup;
|
if (FAILED(ret)) goto cleanup;
|
||||||
|
|
||||||
|
/* Write the body */
|
||||||
|
ret = write_xml_element(body_element, writer);
|
||||||
|
if (FAILED(ret)) goto cleanup;
|
||||||
|
|
||||||
ret = WsWriteEndElement(writer, NULL);
|
ret = WsWriteEndElement(writer, NULL);
|
||||||
if (FAILED(ret)) goto cleanup;
|
if (FAILED(ret)) goto cleanup;
|
||||||
|
|
||||||
|
@ -774,7 +780,7 @@ static HRESULT write_and_send_message(IWSDiscoveryPublisherImpl *impl, WSD_SOAP_
|
||||||
char *full_xml;
|
char *full_xml;
|
||||||
HRESULT ret;
|
HRESULT ret;
|
||||||
|
|
||||||
ret = create_soap_envelope(impl->xmlContext, header, NULL, &heap, &xml, &xml_length, discovered_namespaces);
|
ret = create_soap_envelope(impl->xmlContext, header, body_element, &heap, &xml, &xml_length, discovered_namespaces);
|
||||||
if (ret != S_OK) return ret;
|
if (ret != S_OK) return ret;
|
||||||
|
|
||||||
/* Prefix the XML header */
|
/* Prefix the XML header */
|
||||||
|
@ -812,7 +818,9 @@ 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)
|
||||||
{
|
{
|
||||||
|
WSDXML_ELEMENT *body_element = NULL, *hello_element;
|
||||||
struct list *discoveredNamespaces = NULL;
|
struct list *discoveredNamespaces = NULL;
|
||||||
|
WSDXML_NAME *body_name = NULL;
|
||||||
WSD_SOAP_HEADER soapHeader;
|
WSD_SOAP_HEADER soapHeader;
|
||||||
WSD_APP_SEQUENCE sequence;
|
WSD_APP_SEQUENCE sequence;
|
||||||
WCHAR message_id[64];
|
WCHAR message_id[64];
|
||||||
|
@ -822,21 +830,42 @@ HRESULT send_hello_message(IWSDiscoveryPublisherImpl *impl, LPCWSTR id, ULONGLON
|
||||||
sequence.MessageNumber = msg_num;
|
sequence.MessageNumber = msg_num;
|
||||||
sequence.SequenceId = session_id;
|
sequence.SequenceId = session_id;
|
||||||
|
|
||||||
if (!create_guid(message_id)) goto cleanup;
|
if (!create_guid(message_id)) goto failed;
|
||||||
|
|
||||||
discoveredNamespaces = WSDAllocateLinkedMemory(NULL, sizeof(struct list));
|
discoveredNamespaces = WSDAllocateLinkedMemory(NULL, sizeof(struct list));
|
||||||
if (!discoveredNamespaces) goto cleanup;
|
if (!discoveredNamespaces) goto failed;
|
||||||
|
|
||||||
list_init(discoveredNamespaces);
|
list_init(discoveredNamespaces);
|
||||||
|
|
||||||
populate_soap_header(&soapHeader, discoveryTo, actionHello, message_id, &sequence, hdr_any);
|
populate_soap_header(&soapHeader, discoveryTo, actionHello, message_id, &sequence, hdr_any);
|
||||||
|
|
||||||
/* TODO: Populate message body */
|
ret = IWSDXMLContext_AddNameToNamespace(impl->xmlContext, envelopeNsUri, bodyString, &body_name);
|
||||||
|
if (FAILED(ret)) goto cleanup;
|
||||||
|
|
||||||
|
/* <soap:Body>, <wsd:Hello> */
|
||||||
|
ret = WSDXMLBuildAnyForSingleElement(body_name, NULL, &body_element);
|
||||||
|
if (FAILED(ret)) goto cleanup;
|
||||||
|
|
||||||
|
ret = add_child_element(impl->xmlContext, body_element, discoveryNsUri, helloString, NULL, &hello_element);
|
||||||
|
if (FAILED(ret)) goto cleanup;
|
||||||
|
|
||||||
|
/* Write any body elements */
|
||||||
|
if (any != NULL)
|
||||||
|
{
|
||||||
|
ret = duplicate_element(hello_element, any, discoveredNamespaces);
|
||||||
|
if (FAILED(ret)) goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
/* Write and send the message */
|
/* Write and send the message */
|
||||||
ret = write_and_send_message(impl, &soapHeader, NULL, discoveredNamespaces, NULL, APP_MAX_DELAY);
|
ret = write_and_send_message(impl, &soapHeader, body_element, discoveredNamespaces, NULL, APP_MAX_DELAY);
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
failed:
|
||||||
|
ret = E_OUTOFMEMORY;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
WSDFreeLinkedMemory(body_name);
|
||||||
|
WSDFreeLinkedMemory(body_element);
|
||||||
WSDFreeLinkedMemory(discoveredNamespaces);
|
WSDFreeLinkedMemory(discoveredNamespaces);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -507,7 +507,7 @@ static void Publish_tests(void)
|
||||||
messageStorage *msgStorage;
|
messageStorage *msgStorage;
|
||||||
WSADATA wsaData;
|
WSADATA wsaData;
|
||||||
BOOL messageOK, hello_message_seen = FALSE, endpoint_reference_seen = FALSE, app_sequence_seen = FALSE;
|
BOOL messageOK, hello_message_seen = FALSE, endpoint_reference_seen = FALSE, app_sequence_seen = FALSE;
|
||||||
BOOL metadata_version_seen = FALSE, any_header_seen = FALSE, wine_ns_seen = FALSE;
|
BOOL metadata_version_seen = FALSE, any_header_seen = FALSE, wine_ns_seen = FALSE, body_hello_seen = FALSE;
|
||||||
int ret, i;
|
int ret, i;
|
||||||
HRESULT rc;
|
HRESULT rc;
|
||||||
ULONG ref;
|
ULONG ref;
|
||||||
|
@ -629,8 +629,9 @@ static void Publish_tests(void)
|
||||||
metadata_version_seen = (strstr(msg, "<wsd:MetadataVersion>1</wsd:MetadataVersion>") != NULL);
|
metadata_version_seen = (strstr(msg, "<wsd:MetadataVersion>1</wsd:MetadataVersion>") != NULL);
|
||||||
any_header_seen = (strstr(msg, "<wine:Beer>PublishTest</wine:Beer>") != NULL);
|
any_header_seen = (strstr(msg, "<wine:Beer>PublishTest</wine:Beer>") != NULL);
|
||||||
wine_ns_seen = (strstr(msg, "xmlns:wine=\"http://wine.test/\"") != NULL);
|
wine_ns_seen = (strstr(msg, "xmlns:wine=\"http://wine.test/\"") != NULL);
|
||||||
|
body_hello_seen = (strstr(msg, "<soap:Body><wsd:Hello") != NULL);
|
||||||
messageOK = hello_message_seen && endpoint_reference_seen && app_sequence_seen && metadata_version_seen &&
|
messageOK = hello_message_seen && endpoint_reference_seen && app_sequence_seen && metadata_version_seen &&
|
||||||
any_header_seen && wine_ns_seen;
|
any_header_seen && wine_ns_seen && body_hello_seen;
|
||||||
|
|
||||||
if (messageOK) break;
|
if (messageOK) break;
|
||||||
}
|
}
|
||||||
|
@ -649,6 +650,7 @@ static void Publish_tests(void)
|
||||||
todo_wine ok(messageOK == TRUE, "Hello message metadata not received\n");
|
todo_wine ok(messageOK == TRUE, "Hello message metadata not received\n");
|
||||||
ok(any_header_seen == TRUE, "Custom header not received\n");
|
ok(any_header_seen == TRUE, "Custom header not received\n");
|
||||||
ok(wine_ns_seen == TRUE, "Wine namespace not received\n");
|
ok(wine_ns_seen == TRUE, "Wine namespace not received\n");
|
||||||
|
ok(body_hello_seen == TRUE, "Body and Hello elements not received\n");
|
||||||
|
|
||||||
after_publish_test:
|
after_publish_test:
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue