Commit ff5982fc authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

webservices: Properly initialize messages.

parent be940a00
...@@ -1687,7 +1687,6 @@ static HRESULT send_message( struct channel *channel, WS_MESSAGE *msg, const WS_ ...@@ -1687,7 +1687,6 @@ static HRESULT send_message( struct channel *channel, WS_MESSAGE *msg, const WS_
WS_WRITE_OPTION option, const void *body, ULONG size ) WS_WRITE_OPTION option, const void *body, ULONG size )
{ {
HRESULT hr; HRESULT hr;
WsInitializeMessage( msg, WS_REQUEST_MESSAGE, NULL, NULL );
if ((hr = WsAddressMessage( msg, &channel->addr, NULL )) != S_OK) return hr; if ((hr = WsAddressMessage( msg, &channel->addr, NULL )) != S_OK) return hr;
if ((hr = message_set_action( msg, desc->action )) != S_OK) return hr; if ((hr = message_set_action( msg, desc->action )) != S_OK) return hr;
if ((hr = init_writer( channel )) != S_OK) return hr; if ((hr = init_writer( channel )) != S_OK) return hr;
...@@ -1766,6 +1765,8 @@ HRESULT WINAPI WsSendMessage( WS_CHANNEL *handle, WS_MESSAGE *msg, const WS_MESS ...@@ -1766,6 +1765,8 @@ HRESULT WINAPI WsSendMessage( WS_CHANNEL *handle, WS_MESSAGE *msg, const WS_MESS
return WS_E_INVALID_OPERATION; return WS_E_INVALID_OPERATION;
} }
WsInitializeMessage( msg, WS_BLANK_MESSAGE, NULL, NULL );
if (!ctx) async_init( &async, &ctx_local ); if (!ctx) async_init( &async, &ctx_local );
hr = queue_send_message( channel, msg, desc, option, body, size, ctx ? ctx : &ctx_local ); hr = queue_send_message( channel, msg, desc, option, body, size, ctx ? ctx : &ctx_local );
if (!ctx) if (!ctx)
...@@ -1810,6 +1811,7 @@ HRESULT WINAPI WsSendReplyMessage( WS_CHANNEL *handle, WS_MESSAGE *msg, const WS ...@@ -1810,6 +1811,7 @@ HRESULT WINAPI WsSendReplyMessage( WS_CHANNEL *handle, WS_MESSAGE *msg, const WS
return WS_E_INVALID_OPERATION; return WS_E_INVALID_OPERATION;
} }
WsInitializeMessage( msg, WS_REPLY_MESSAGE, NULL, NULL );
if ((hr = message_get_id( request, &id )) != S_OK) goto done; if ((hr = message_get_id( request, &id )) != S_OK) goto done;
if ((hr = message_set_request_id( msg, &id )) != S_OK) goto done; if ((hr = message_set_request_id( msg, &id )) != S_OK) goto done;
...@@ -2533,6 +2535,8 @@ HRESULT WINAPI WsRequestReply( WS_CHANNEL *handle, WS_MESSAGE *request, const WS ...@@ -2533,6 +2535,8 @@ HRESULT WINAPI WsRequestReply( WS_CHANNEL *handle, WS_MESSAGE *request, const WS
return WS_E_INVALID_OPERATION; return WS_E_INVALID_OPERATION;
} }
WsInitializeMessage( request, WS_REQUEST_MESSAGE, NULL, NULL );
if (!ctx) async_init( &async, &ctx_local ); if (!ctx) async_init( &async, &ctx_local );
hr = queue_request_reply( channel, request, request_desc, write_option, request_body, request_size, reply, hr = queue_request_reply( channel, request, request_desc, write_option, request_body, request_size, reply,
reply_desc, read_option, heap, value, size, ctx ? ctx : &ctx_local ); reply_desc, read_option, heap, value, size, ctx ? ctx : &ctx_local );
......
...@@ -611,9 +611,9 @@ static HRESULT write_relatesto_header( WS_XML_WRITER *writer, const WS_XML_STRIN ...@@ -611,9 +611,9 @@ static HRESULT write_relatesto_header( WS_XML_WRITER *writer, const WS_XML_STRIN
return WsWriteEndElement( writer, NULL ); /* </a:RelatesTo> */ return WsWriteEndElement( writer, NULL ); /* </a:RelatesTo> */
} }
static HRESULT write_headers( struct msg *msg, WS_XML_WRITER *writer, const WS_XML_STRING *prefix_env, static HRESULT write_headers( struct msg *msg, WS_MESSAGE_INITIALIZATION init, WS_XML_WRITER *writer,
const WS_XML_STRING *ns_env, const WS_XML_STRING *prefix_addr, const WS_XML_STRING *prefix_env, const WS_XML_STRING *ns_env,
const WS_XML_STRING *ns_addr ) const WS_XML_STRING *prefix_addr, const WS_XML_STRING *ns_addr )
{ {
static const WS_XML_STRING header = {6, (BYTE *)"Header"}; static const WS_XML_STRING header = {6, (BYTE *)"Header"};
HRESULT hr; HRESULT hr;
...@@ -625,7 +625,7 @@ static HRESULT write_headers( struct msg *msg, WS_XML_WRITER *writer, const WS_X ...@@ -625,7 +625,7 @@ static HRESULT write_headers( struct msg *msg, WS_XML_WRITER *writer, const WS_X
if ((hr = write_action_header( writer, prefix_env, ns_env, prefix_addr, ns_addr, msg->action )) != S_OK) if ((hr = write_action_header( writer, prefix_env, ns_env, prefix_addr, ns_addr, msg->action )) != S_OK)
return hr; return hr;
if (msg->init == WS_REPLY_MESSAGE) if (init == WS_REPLY_MESSAGE)
{ {
if ((hr = write_relatesto_header( writer, prefix_env, ns_env, prefix_addr, ns_addr, &msg->id_req )) != S_OK) if ((hr = write_relatesto_header( writer, prefix_env, ns_env, prefix_addr, ns_addr, &msg->id_req )) != S_OK)
return hr; return hr;
...@@ -637,8 +637,9 @@ static HRESULT write_headers( struct msg *msg, WS_XML_WRITER *writer, const WS_X ...@@ -637,8 +637,9 @@ static HRESULT write_headers( struct msg *msg, WS_XML_WRITER *writer, const WS_X
} }
else else
{ {
if ((hr = write_msgid_header( writer, prefix_env, ns_env, prefix_addr, ns_addr, &msg->id )) != S_OK) if (init == WS_REQUEST_MESSAGE &&
return hr; (hr = write_msgid_header( writer, prefix_env, ns_env, prefix_addr, ns_addr, &msg->id )) != S_OK) return hr;
if (msg->version_addr == WS_ADDRESSING_VERSION_0_9 && if (msg->version_addr == WS_ADDRESSING_VERSION_0_9 &&
(hr = write_replyto_header( writer, prefix_env, ns_env, prefix_addr, ns_addr )) != S_OK) return hr; (hr = write_replyto_header( writer, prefix_env, ns_env, prefix_addr, ns_addr )) != S_OK) return hr;
} }
...@@ -685,7 +686,7 @@ static HRESULT write_headers_transport( struct msg *msg, WS_XML_WRITER *writer, ...@@ -685,7 +686,7 @@ static HRESULT write_headers_transport( struct msg *msg, WS_XML_WRITER *writer,
return hr; return hr;
} }
static HRESULT write_envelope_start( struct msg *msg, WS_XML_WRITER *writer ) static HRESULT write_envelope_start( struct msg *msg, WS_MESSAGE_INITIALIZATION init, WS_XML_WRITER *writer )
{ {
static const WS_XML_STRING envelope = {8, (BYTE *)"Envelope"}, body = {4, (BYTE *)"Body"}; static const WS_XML_STRING envelope = {8, (BYTE *)"Envelope"}, body = {4, (BYTE *)"Body"};
static const WS_XML_STRING prefix_s = {1, (BYTE *)"s"}, prefix_a = {1, (BYTE *)"a"}; static const WS_XML_STRING prefix_s = {1, (BYTE *)"s"}, prefix_a = {1, (BYTE *)"a"};
...@@ -700,7 +701,7 @@ static HRESULT write_envelope_start( struct msg *msg, WS_XML_WRITER *writer ) ...@@ -700,7 +701,7 @@ static HRESULT write_envelope_start( struct msg *msg, WS_XML_WRITER *writer )
if (msg->version_addr == WS_ADDRESSING_VERSION_TRANSPORT) if (msg->version_addr == WS_ADDRESSING_VERSION_TRANSPORT)
hr = write_headers_transport( msg, writer, prefix_env, ns_env ); hr = write_headers_transport( msg, writer, prefix_env, ns_env );
else else
hr = write_headers( msg, writer, prefix_env, ns_env, prefix_addr, ns_addr ); hr = write_headers( msg, init, writer, prefix_env, ns_env, prefix_addr, ns_addr );
if (hr != S_OK) return hr; if (hr != S_OK) return hr;
return WsWriteStartElement( writer, prefix_env, &body, ns_env, NULL ); /* <s:Body> */ return WsWriteStartElement( writer, prefix_env, &body, ns_env, NULL ); /* <s:Body> */
...@@ -713,13 +714,13 @@ static HRESULT write_envelope_end( WS_XML_WRITER *writer ) ...@@ -713,13 +714,13 @@ static HRESULT write_envelope_end( WS_XML_WRITER *writer )
return WsWriteEndElement( writer, NULL ); /* </s:Envelope> */ return WsWriteEndElement( writer, NULL ); /* </s:Envelope> */
} }
static HRESULT write_envelope( struct msg *msg ) static HRESULT write_envelope( struct msg *msg, WS_MESSAGE_INITIALIZATION init )
{ {
HRESULT hr; HRESULT hr;
if (!msg->writer && (hr = WsCreateWriter( NULL, 0, &msg->writer, NULL )) != S_OK) return hr; if (!msg->writer && (hr = WsCreateWriter( NULL, 0, &msg->writer, NULL )) != S_OK) return hr;
if (!msg->buf && (hr = WsCreateXmlBuffer( msg->heap, NULL, 0, &msg->buf, NULL )) != S_OK) return hr; if (!msg->buf && (hr = WsCreateXmlBuffer( msg->heap, NULL, 0, &msg->buf, NULL )) != S_OK) return hr;
if ((hr = WsSetOutputToBuffer( msg->writer, msg->buf, NULL, 0, NULL )) != S_OK) return hr; if ((hr = WsSetOutputToBuffer( msg->writer, msg->buf, NULL, 0, NULL )) != S_OK) return hr;
if ((hr = write_envelope_start( msg, msg->writer )) != S_OK) return hr; if ((hr = write_envelope_start( msg, init, msg->writer )) != S_OK) return hr;
return write_envelope_end( msg->writer ); return write_envelope_end( msg->writer );
} }
...@@ -751,8 +752,8 @@ HRESULT WINAPI WsWriteEnvelopeStart( WS_MESSAGE *handle, WS_XML_WRITER *writer, ...@@ -751,8 +752,8 @@ HRESULT WINAPI WsWriteEnvelopeStart( WS_MESSAGE *handle, WS_XML_WRITER *writer,
} }
if (msg->state != WS_MESSAGE_STATE_INITIALIZED) hr = WS_E_INVALID_OPERATION; if (msg->state != WS_MESSAGE_STATE_INITIALIZED) hr = WS_E_INVALID_OPERATION;
else if ((hr = write_envelope( msg )) == S_OK && else if ((hr = write_envelope( msg, msg->init )) == S_OK &&
(hr = write_envelope_start( msg, writer )) == S_OK) (hr = write_envelope_start( msg, msg->init, writer )) == S_OK)
{ {
msg->writer_body = writer; msg->writer_body = writer;
msg->state = WS_MESSAGE_STATE_WRITING; msg->state = WS_MESSAGE_STATE_WRITING;
...@@ -1085,7 +1086,7 @@ HRESULT WINAPI WsInitializeMessage( WS_MESSAGE *handle, WS_MESSAGE_INITIALIZATIO ...@@ -1085,7 +1086,7 @@ HRESULT WINAPI WsInitializeMessage( WS_MESSAGE *handle, WS_MESSAGE_INITIALIZATIO
} }
if (msg->state >= WS_MESSAGE_STATE_INITIALIZED) hr = WS_E_INVALID_OPERATION; if (msg->state >= WS_MESSAGE_STATE_INITIALIZED) hr = WS_E_INVALID_OPERATION;
else if ((hr = write_envelope( msg )) == S_OK) else if ((hr = write_envelope( msg, init )) == S_OK)
{ {
msg->init = init; msg->init = init;
msg->state = WS_MESSAGE_STATE_INITIALIZED; msg->state = WS_MESSAGE_STATE_INITIALIZED;
...@@ -1235,7 +1236,7 @@ HRESULT WINAPI WsSetHeader( WS_MESSAGE *handle, WS_HEADER_TYPE type, WS_TYPE val ...@@ -1235,7 +1236,7 @@ HRESULT WINAPI WsSetHeader( WS_MESSAGE *handle, WS_HEADER_TYPE type, WS_TYPE val
else free_header( msg->header[i] ); else free_header( msg->header[i] );
msg->header[i] = header; msg->header[i] = header;
hr = write_envelope( msg ); hr = write_envelope( msg, msg->init );
done: done:
LeaveCriticalSection( &msg->cs ); LeaveCriticalSection( &msg->cs );
...@@ -1353,7 +1354,7 @@ HRESULT WINAPI WsRemoveHeader( WS_MESSAGE *handle, WS_HEADER_TYPE type, WS_ERROR ...@@ -1353,7 +1354,7 @@ HRESULT WINAPI WsRemoveHeader( WS_MESSAGE *handle, WS_HEADER_TYPE type, WS_ERROR
break; break;
} }
} }
if (removed) hr = write_envelope( msg ); if (removed) hr = write_envelope( msg, msg->init );
} }
LeaveCriticalSection( &msg->cs ); LeaveCriticalSection( &msg->cs );
...@@ -1730,7 +1731,7 @@ HRESULT WINAPI WsAddCustomHeader( WS_MESSAGE *handle, const WS_ELEMENT_DESCRIPTI ...@@ -1730,7 +1731,7 @@ HRESULT WINAPI WsAddCustomHeader( WS_MESSAGE *handle, const WS_ELEMENT_DESCRIPTI
if ((hr = build_custom_header( msg, desc->elementLocalName, desc->elementNs, desc->type, if ((hr = build_custom_header( msg, desc->elementLocalName, desc->elementNs, desc->type,
desc->typeDescription, option, value, size, &header )) != S_OK) goto done; desc->typeDescription, option, value, size, &header )) != S_OK) goto done;
msg->header[msg->header_count++] = header; msg->header[msg->header_count++] = header;
hr = write_envelope( msg ); hr = write_envelope( msg, msg->init );
done: done:
LeaveCriticalSection( &msg->cs ); LeaveCriticalSection( &msg->cs );
...@@ -1833,7 +1834,7 @@ HRESULT WINAPI WsRemoveCustomHeader( WS_MESSAGE *handle, const WS_XML_STRING *na ...@@ -1833,7 +1834,7 @@ HRESULT WINAPI WsRemoveCustomHeader( WS_MESSAGE *handle, const WS_XML_STRING *na
i--; i--;
} }
} }
if (removed) hr = write_envelope( msg ); if (removed) hr = write_envelope( msg, msg->init );
} }
LeaveCriticalSection( &msg->cs ); LeaveCriticalSection( &msg->cs );
......
...@@ -164,6 +164,11 @@ static void test_WsCreateMessageForChannel(void) ...@@ -164,6 +164,11 @@ static void test_WsCreateMessageForChannel(void)
hr = WsCreateMessageForChannel( channel, NULL, 0, &msg, NULL ); hr = WsCreateMessageForChannel( channel, NULL, 0, &msg, NULL );
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
state = 0xdeadbeef;
hr = WsGetMessageProperty( msg, WS_MESSAGE_PROPERTY_STATE, &state, sizeof(state), NULL );
ok( hr == S_OK, "got %08x\n", hr );
ok( state == WS_MESSAGE_STATE_EMPTY, "got %u\n", state );
env_version = 0xdeadbeef; env_version = 0xdeadbeef;
hr = WsGetMessageProperty( msg, WS_MESSAGE_PROPERTY_ENVELOPE_VERSION, &env_version, hr = WsGetMessageProperty( msg, WS_MESSAGE_PROPERTY_ENVELOPE_VERSION, &env_version,
sizeof(env_version), NULL ); sizeof(env_version), NULL );
...@@ -393,6 +398,16 @@ static void test_WsWriteEnvelopeStart(void) ...@@ -393,6 +398,16 @@ static void test_WsWriteEnvelopeStart(void)
"xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"><s:Header>" "xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"><s:Header>"
"<a:MessageID>urn:uuid:00000000-0000-0000-0000-000000000000</a:MessageID>" "<a:MessageID>urn:uuid:00000000-0000-0000-0000-000000000000</a:MessageID>"
"</s:Header><s:Body/></s:Envelope>"; "</s:Header><s:Body/></s:Envelope>";
static const char expected6[] =
"<s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"><s:Header/><s:Body/></s:Envelope>";
static const char expected7[] =
"<s:Envelope xmlns:a=\"http://www.w3.org/2005/08/addressing\" "
"xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\"><s:Header>"
"<a:MessageID>urn:uuid:00000000-0000-0000-0000-000000000000</a:MessageID>"
"</s:Header><s:Body/></s:Envelope>";
static const char expected8[] =
"<s:Envelope xmlns:a=\"http://www.w3.org/2005/08/addressing\" "
"xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\"><s:Header/><s:Body/></s:Envelope>";
HRESULT hr; HRESULT hr;
WS_MESSAGE *msg; WS_MESSAGE *msg;
WS_XML_WRITER *writer; WS_XML_WRITER *writer;
...@@ -407,8 +422,7 @@ static void test_WsWriteEnvelopeStart(void) ...@@ -407,8 +422,7 @@ static void test_WsWriteEnvelopeStart(void)
hr = WsWriteEnvelopeStart( NULL, writer, NULL, NULL, NULL ); hr = WsWriteEnvelopeStart( NULL, writer, NULL, NULL, NULL );
ok( hr == E_INVALIDARG, "got %08x\n", hr ); ok( hr == E_INVALIDARG, "got %08x\n", hr );
hr = WsCreateMessage( WS_ENVELOPE_VERSION_SOAP_1_1, WS_ADDRESSING_VERSION_0_9, NULL, 0, &msg, hr = WsCreateMessage( WS_ENVELOPE_VERSION_SOAP_1_1, WS_ADDRESSING_VERSION_0_9, NULL, 0, &msg, NULL );
NULL );
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
hr = WsWriteEnvelopeStart( msg, writer, NULL, NULL, NULL ); hr = WsWriteEnvelopeStart( msg, writer, NULL, NULL, NULL );
...@@ -429,8 +443,7 @@ static void test_WsWriteEnvelopeStart(void) ...@@ -429,8 +443,7 @@ static void test_WsWriteEnvelopeStart(void)
ok( state == WS_MESSAGE_STATE_WRITING, "got %u\n", state ); ok( state == WS_MESSAGE_STATE_WRITING, "got %u\n", state );
WsFreeMessage( msg ); WsFreeMessage( msg );
hr = WsCreateMessage( WS_ENVELOPE_VERSION_SOAP_1_1, WS_ADDRESSING_VERSION_TRANSPORT, NULL, 0, &msg, hr = WsCreateMessage( WS_ENVELOPE_VERSION_SOAP_1_1, WS_ADDRESSING_VERSION_TRANSPORT, NULL, 0, &msg, NULL );
NULL );
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
hr = WsInitializeMessage( msg, WS_REQUEST_MESSAGE, NULL, NULL ); hr = WsInitializeMessage( msg, WS_REQUEST_MESSAGE, NULL, NULL );
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
...@@ -441,8 +454,7 @@ static void test_WsWriteEnvelopeStart(void) ...@@ -441,8 +454,7 @@ static void test_WsWriteEnvelopeStart(void)
check_output_header( msg, expected3, -1, 0, 0, __LINE__ ); check_output_header( msg, expected3, -1, 0, 0, __LINE__ );
WsFreeMessage( msg ); WsFreeMessage( msg );
hr = WsCreateMessage( WS_ENVELOPE_VERSION_NONE, WS_ADDRESSING_VERSION_TRANSPORT, NULL, 0, &msg, hr = WsCreateMessage( WS_ENVELOPE_VERSION_NONE, WS_ADDRESSING_VERSION_TRANSPORT, NULL, 0, &msg, NULL );
NULL );
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
hr = WsInitializeMessage( msg, WS_REQUEST_MESSAGE, NULL, NULL ); hr = WsInitializeMessage( msg, WS_REQUEST_MESSAGE, NULL, NULL );
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
...@@ -453,8 +465,7 @@ static void test_WsWriteEnvelopeStart(void) ...@@ -453,8 +465,7 @@ static void test_WsWriteEnvelopeStart(void)
check_output_header( msg, expected4, -1, 0, 0, __LINE__ ); check_output_header( msg, expected4, -1, 0, 0, __LINE__ );
WsFreeMessage( msg ); WsFreeMessage( msg );
hr = WsCreateMessage( WS_ENVELOPE_VERSION_SOAP_1_2, WS_ADDRESSING_VERSION_1_0, NULL, 0, &msg, hr = WsCreateMessage( WS_ENVELOPE_VERSION_SOAP_1_2, WS_ADDRESSING_VERSION_1_0, NULL, 0, &msg, NULL );
NULL );
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
hr = WsInitializeMessage( msg, WS_REQUEST_MESSAGE, NULL, NULL ); hr = WsInitializeMessage( msg, WS_REQUEST_MESSAGE, NULL, NULL );
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
...@@ -465,18 +476,48 @@ static void test_WsWriteEnvelopeStart(void) ...@@ -465,18 +476,48 @@ static void test_WsWriteEnvelopeStart(void)
check_output_header( msg, expected5, -1, strstr(expected5, "urn:uuid:") - expected5, 46, __LINE__ ); check_output_header( msg, expected5, -1, strstr(expected5, "urn:uuid:") - expected5, 46, __LINE__ );
WsFreeMessage( msg ); WsFreeMessage( msg );
hr = WsCreateMessage( WS_ENVELOPE_VERSION_SOAP_1_2, WS_ADDRESSING_VERSION_1_0, NULL, 0, &msg, hr = WsCreateMessage( WS_ENVELOPE_VERSION_SOAP_1_2, WS_ADDRESSING_VERSION_TRANSPORT, NULL, 0, &msg, NULL );
NULL );
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
hr = WsInitializeMessage( msg, WS_REQUEST_MESSAGE, NULL, NULL ); hr = WsInitializeMessage( msg, WS_REQUEST_MESSAGE, NULL, NULL );
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
hr = set_output( writer );
ok( hr == S_OK, "got %08x\n", hr );
hr = WsWriteEnvelopeStart( msg, writer, NULL, NULL, NULL );
ok( hr == S_OK, "got %08x\n", hr );
check_output_header( msg, expected6, -1, 0, 0, __LINE__ );
WsFreeMessage( msg ); WsFreeMessage( msg );
hr = WsCreateMessage( WS_ENVELOPE_VERSION_NONE, WS_ADDRESSING_VERSION_0_9, NULL, 0, &msg, hr = WsCreateMessage( WS_ENVELOPE_VERSION_SOAP_1_1, WS_ADDRESSING_VERSION_1_0, NULL, 0, &msg, NULL );
NULL ); ok( hr == S_OK, "got %08x\n", hr );
hr = WsInitializeMessage( msg, WS_REQUEST_MESSAGE, NULL, NULL );
ok( hr == S_OK, "got %08x\n", hr );
hr = set_output( writer );
ok( hr == S_OK, "got %08x\n", hr );
hr = WsWriteEnvelopeStart( msg, writer, NULL, NULL, NULL );
ok( hr == S_OK, "got %08x\n", hr );
check_output_header( msg, expected7, -1, strstr(expected7, "urn:uuid:") - expected7, 46, __LINE__ );
WsFreeMessage( msg );
hr = WsCreateMessage( WS_ENVELOPE_VERSION_SOAP_1_1, WS_ADDRESSING_VERSION_1_0, NULL, 0, &msg, NULL );
ok( hr == S_OK, "got %08x\n", hr );
hr = WsInitializeMessage( msg, WS_BLANK_MESSAGE, NULL, NULL );
ok( hr == S_OK, "got %08x\n", hr );
hr = set_output( writer );
ok( hr == S_OK, "got %08x\n", hr );
hr = WsWriteEnvelopeStart( msg, writer, NULL, NULL, NULL );
ok( hr == S_OK, "got %08x\n", hr );
check_output_header( msg, expected8, -1, 0, 0, __LINE__ );
WsFreeMessage( msg );
hr = WsCreateMessage( WS_ENVELOPE_VERSION_SOAP_1_2, WS_ADDRESSING_VERSION_1_0, NULL, 0, &msg, NULL );
ok( hr == S_OK, "got %08x\n", hr );
hr = WsInitializeMessage( msg, WS_REQUEST_MESSAGE, NULL, NULL );
ok( hr == S_OK, "got %08x\n", hr );
WsFreeMessage( msg );
hr = WsCreateMessage( WS_ENVELOPE_VERSION_NONE, WS_ADDRESSING_VERSION_0_9, NULL, 0, &msg, NULL );
ok( hr == E_INVALIDARG, "got %08x\n", hr ); ok( hr == E_INVALIDARG, "got %08x\n", hr );
hr = WsCreateMessage( WS_ENVELOPE_VERSION_NONE, WS_ADDRESSING_VERSION_1_0, NULL, 0, &msg, hr = WsCreateMessage( WS_ENVELOPE_VERSION_NONE, WS_ADDRESSING_VERSION_1_0, NULL, 0, &msg, NULL );
NULL );
ok( hr == E_INVALIDARG, "got %08x\n", hr ); ok( hr == E_INVALIDARG, "got %08x\n", hr );
WsFreeWriter( writer ); WsFreeWriter( writer );
} }
...@@ -1197,9 +1238,19 @@ static void test_WsResetMessage(void) ...@@ -1197,9 +1238,19 @@ static void test_WsResetMessage(void)
hr = WsCreateMessage( WS_ENVELOPE_VERSION_SOAP_1_1, WS_ADDRESSING_VERSION_0_9, NULL, 0, &msg, NULL ); hr = WsCreateMessage( WS_ENVELOPE_VERSION_SOAP_1_1, WS_ADDRESSING_VERSION_0_9, NULL, 0, &msg, NULL );
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
state = 0xdeadbeef;
hr = WsGetMessageProperty( msg, WS_MESSAGE_PROPERTY_STATE, &state, sizeof(state), NULL );
ok( hr == S_OK, "got %08x\n", hr );
ok( state == WS_MESSAGE_STATE_EMPTY, "got %u\n", state );
hr = WsInitializeMessage( msg, WS_REQUEST_MESSAGE, NULL, NULL ); hr = WsInitializeMessage( msg, WS_REQUEST_MESSAGE, NULL, NULL );
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
state = 0xdeadbeef;
hr = WsGetMessageProperty( msg, WS_MESSAGE_PROPERTY_STATE, &state, sizeof(state), NULL );
ok( hr == S_OK, "got %08x\n", hr );
ok( state == WS_MESSAGE_STATE_INITIALIZED, "got %u\n", state );
hr = WsResetMessage( msg, NULL ); hr = WsResetMessage( msg, NULL );
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
......
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