webservices: Implement WsWriteEnvelopeEnd.

Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hans Leidekker 2016-07-08 10:20:38 +02:00 committed by Alexandre Julliard
parent b72c6e6061
commit 485c9722d9
3 changed files with 73 additions and 1 deletions

View File

@ -433,3 +433,23 @@ HRESULT WINAPI WsWriteEnvelopeStart( WS_MESSAGE *handle, WS_XML_WRITER *writer,
msg->state = WS_MESSAGE_STATE_WRITING;
return S_OK;
}
/**************************************************************************
* WsWriteEnvelopeEnd [webservices.@]
*/
HRESULT WINAPI WsWriteEnvelopeEnd( WS_MESSAGE *handle, WS_ERROR *error )
{
struct msg *msg = (struct msg *)handle;
HRESULT hr;
TRACE( "%p %p\n", handle, error );
if (error) FIXME( "ignoring error parameter\n" );
if (!handle) return E_INVALIDARG;
if (msg->state != WS_MESSAGE_STATE_WRITING) return WS_E_INVALID_OPERATION;
if ((hr = write_envelope_end( msg, msg->writer_body )) != S_OK) return hr;
msg->state = WS_MESSAGE_STATE_DONE;
return S_OK;
}

View File

@ -380,6 +380,57 @@ static void test_WsWriteEnvelopeStart(void)
WsFreeWriter( writer );
}
static void test_WsWriteEnvelopeEnd(void)
{
static const char expected[] =
"<s:Envelope xmlns:a=\"http://www.w3.org/2005/08/addressing\" "
"xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"><s:Header>"
"<a:MessageID>urn:uuid:00000000-0000-0000-0000-000000000000</a:MessageID>"
"</s:Header><s:Body/></s:Envelope>";
HRESULT hr;
WS_MESSAGE *msg;
WS_XML_WRITER *writer;
WS_MESSAGE_STATE state;
hr = WsWriteEnvelopeEnd( NULL, NULL );
ok( hr == E_INVALIDARG, "got %08x\n", hr );
hr = WsCreateMessage( WS_ADDRESSING_VERSION_1_0, WS_ENVELOPE_VERSION_SOAP_1_2, NULL, 0, &msg,
NULL );
ok( hr == S_OK, "got %08x\n", hr );
hr = WsWriteEnvelopeEnd( msg, NULL );
ok( hr == WS_E_INVALID_OPERATION, "got %08x\n", hr );
hr = WsInitializeMessage( msg, WS_REQUEST_MESSAGE, NULL, NULL );
ok( hr == S_OK, "got %08x\n", hr );
hr = WsWriteEnvelopeEnd( msg, NULL );
ok( hr == WS_E_INVALID_OPERATION, "got %08x\n", hr );
hr = WsCreateWriter( NULL, 0, &writer, 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 );
hr = WsWriteEnvelopeEnd( msg, NULL );
ok( hr == S_OK, "got %08x\n", hr );
check_output( writer, expected, -1, strstr(expected, "urn:uuid:") - expected, 46, __LINE__ );
check_output_header( msg, expected, -1, strstr(expected, "urn:uuid:") - expected, 46, __LINE__ );
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_DONE, "got %u\n", state );
WsFreeMessage( msg );
WsFreeWriter( writer );
}
START_TEST(msg)
{
test_WsCreateMessage();
@ -387,4 +438,5 @@ START_TEST(msg)
test_WsInitializeMessage();
test_WsAddressMessage();
test_WsWriteEnvelopeStart();
test_WsWriteEnvelopeEnd();
}

View File

@ -175,7 +175,7 @@
@ stdcall WsWriteEndCData(ptr ptr)
@ stdcall WsWriteEndElement(ptr ptr)
@ stdcall WsWriteEndStartElement(ptr ptr)
@ stub WsWriteEnvelopeEnd
@ stdcall WsWriteEnvelopeEnd(ptr ptr)
@ stdcall WsWriteEnvelopeStart(ptr ptr ptr ptr ptr)
@ stub WsWriteMessageEnd
@ stub WsWriteMessageStart