wsdapi: Add SequenceId to SOAP header, add test.
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
5df08c9de4
commit
dead047bdb
|
@ -71,6 +71,7 @@ static const WCHAR relatesToString[] = { 'R','e','l','a','t','e','s','T','o', 0
|
|||
static const WCHAR appSequenceString[] = { 'A','p','p','S','e','q','u','e','n','c','e', 0 };
|
||||
static const WCHAR instanceIdString[] = { 'I','n','s','t','a','n','c','e','I','d', 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 emptyString[] = { 0 };
|
||||
|
||||
struct discovered_namespace
|
||||
|
@ -437,6 +438,25 @@ static BOOL add_ulonglong_attribute(IWSDXMLContext *xml_context, WSDXML_ELEMENT
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL add_string_attribute(IWSDXMLContext *xml_context, WSDXML_ELEMENT *parent, LPCWSTR ns_uri, LPCWSTR name,
|
||||
LPCWSTR value)
|
||||
{
|
||||
WSDXML_ATTRIBUTE *attribute = add_attribute(xml_context, parent, ns_uri, name);
|
||||
|
||||
if (attribute == NULL)
|
||||
return FALSE;
|
||||
|
||||
attribute->Value = duplicate_string(attribute, value);
|
||||
|
||||
if (attribute->Value == NULL)
|
||||
{
|
||||
remove_attribute(parent, attribute);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL add_discovered_namespace(struct list *namespaces, WSDXML_NAMESPACE *discovered_ns)
|
||||
{
|
||||
struct discovered_namespace *ns;
|
||||
|
@ -499,12 +519,17 @@ static WSDXML_ELEMENT *create_soap_header_xml_elements(IWSDXMLContext *xml_conte
|
|||
if (!add_ulonglong_attribute(xml_context, app_sequence_element, NULL, instanceIdString, min(UINT_MAX,
|
||||
header->AppSequence->InstanceId))) goto cleanup;
|
||||
|
||||
/* SequenceID attribute */
|
||||
if (header->AppSequence->SequenceId != NULL)
|
||||
{
|
||||
if (!add_string_attribute(xml_context, app_sequence_element, NULL, sequenceIdString, header->AppSequence->SequenceId))
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* MessageNumber attribute */
|
||||
if (!add_ulonglong_attribute(xml_context, app_sequence_element, NULL, messageNumberString, min(UINT_MAX,
|
||||
header->AppSequence->MessageNumber))) goto cleanup;
|
||||
|
||||
/* TODO: SequenceID attribute */
|
||||
|
||||
/* </d:AppSequence> */
|
||||
|
||||
/* TODO: Write any headers */
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#define SEND_PORT "3702"
|
||||
|
||||
static const char *publisherId = "urn:uuid:3AE5617D-790F-408A-9374-359A77F924A3";
|
||||
static const char *sequenceId = "urn:uuid:b14de351-72fc-4453-96f9-e58b0c9faf38";
|
||||
|
||||
#define MAX_CACHED_MESSAGES 5
|
||||
#define MAX_LISTENING_THREADS 20
|
||||
|
@ -501,8 +502,8 @@ static void Publish_tests(void)
|
|||
IWSDiscoveryPublisher *publisher = NULL;
|
||||
IWSDiscoveryPublisherNotify *sink1 = NULL, *sink2 = NULL;
|
||||
IWSDiscoveryPublisherNotifyImpl *sink1Impl = NULL, *sink2Impl = NULL;
|
||||
char endpointReferenceString[MAX_PATH];
|
||||
LPWSTR publisherIdW = NULL;
|
||||
char endpointReferenceString[MAX_PATH], app_sequence_string[MAX_PATH];
|
||||
LPWSTR publisherIdW = NULL, sequenceIdW = NULL;
|
||||
messageStorage *msgStorage;
|
||||
WSADATA wsaData;
|
||||
BOOL messageOK, hello_message_seen = FALSE, endpoint_reference_seen = FALSE, app_sequence_seen = FALSE;
|
||||
|
@ -557,6 +558,9 @@ static void Publish_tests(void)
|
|||
publisherIdW = utf8_to_wide(publisherId);
|
||||
if (publisherIdW == NULL) goto after_publish_test;
|
||||
|
||||
sequenceIdW = utf8_to_wide(sequenceId);
|
||||
if (sequenceIdW == NULL) goto after_publish_test;
|
||||
|
||||
msgStorage = heap_alloc_zero(sizeof(messageStorage));
|
||||
if (msgStorage == NULL) goto after_publish_test;
|
||||
|
||||
|
@ -570,7 +574,7 @@ static void Publish_tests(void)
|
|||
ok(ret == TRUE, "Unable to listen on IPv4 addresses (ret == %d)\n", ret);
|
||||
|
||||
/* Publish the service */
|
||||
rc = IWSDiscoveryPublisher_Publish(publisher, publisherIdW, 1, 1, 1, NULL, NULL, NULL, NULL);
|
||||
rc = IWSDiscoveryPublisher_Publish(publisher, publisherIdW, 1, 1, 1, sequenceIdW, NULL, NULL, NULL);
|
||||
ok(rc == S_OK, "Publish failed: %08x\n", rc);
|
||||
|
||||
/* Wait up to 2 seconds for messages to be received */
|
||||
|
@ -587,6 +591,8 @@ static void Publish_tests(void)
|
|||
ok(msgStorage->messageCount >= 1, "No messages received\n");
|
||||
|
||||
sprintf(endpointReferenceString, "<wsa:EndpointReference><wsa:Address>%s</wsa:Address></wsa:EndpointReference>", publisherId);
|
||||
sprintf(app_sequence_string, "<wsd:AppSequence InstanceId=\"1\" SequenceId=\"%s\" MessageNumber=\"1\"></wsd:AppSequence>",
|
||||
sequenceId);
|
||||
|
||||
messageOK = FALSE;
|
||||
|
||||
|
@ -598,7 +604,7 @@ static void Publish_tests(void)
|
|||
|
||||
hello_message_seen = (strstr(msg, "<wsa:Action>http://schemas.xmlsoap.org/ws/2005/04/discovery/Hello</wsa:Action>") != NULL);
|
||||
endpoint_reference_seen = (strstr(msg, endpointReferenceString) != NULL);
|
||||
app_sequence_seen = (strstr(msg, "<wsd:AppSequence InstanceId=\"1\" MessageNumber=\"1\"></wsd:AppSequence>") != NULL);
|
||||
app_sequence_seen = (strstr(msg, app_sequence_string) != NULL);
|
||||
metadata_version_seen = (strstr(msg, "<wsd:MetadataVersion>1</wsd:MetadataVersion>") != NULL);
|
||||
messageOK = hello_message_seen && endpoint_reference_seen && app_sequence_seen && metadata_version_seen;
|
||||
|
||||
|
@ -621,6 +627,7 @@ static void Publish_tests(void)
|
|||
after_publish_test:
|
||||
|
||||
if (publisherIdW != NULL) heap_free(publisherIdW);
|
||||
if (sequenceIdW != NULL) heap_free(sequenceIdW);
|
||||
|
||||
ref = IWSDiscoveryPublisher_Release(publisher);
|
||||
ok(ref == 0, "IWSDiscoveryPublisher_Release() has %d references, should have 0\n", ref);
|
||||
|
|
Loading…
Reference in New Issue