webservices: Implement WsInitializeMessage.

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:35 +02:00 committed by Alexandre Julliard
parent dc8033d371
commit d91a7d2e4b
3 changed files with 80 additions and 1 deletions

View File

@ -44,6 +44,7 @@ static const struct prop_desc msg_props[] =
struct msg
{
WS_MESSAGE_INITIALIZATION init;
WS_MESSAGE_STATE state;
WS_ENVELOPE_VERSION version_env;
WS_ADDRESSING_VERSION version_addr;
@ -143,6 +144,30 @@ HRESULT WINAPI WsCreateMessageForChannel( WS_CHANNEL *channel_handle, const WS_M
return create_msg( version_env, version_addr, properties, count, handle );
}
/**************************************************************************
* WsInitializeMessage [webservices.@]
*/
HRESULT WINAPI WsInitializeMessage( WS_MESSAGE *handle, WS_MESSAGE_INITIALIZATION init,
WS_MESSAGE *src_handle, WS_ERROR *error )
{
struct msg *msg = (struct msg *)handle;
TRACE( "%p %u %p %p\n", handle, init, src_handle, error );
if (error) FIXME( "ignoring error parameter\n" );
if (src_handle)
{
FIXME( "src message not supported\n" );
return E_NOTIMPL;
}
if (!handle || init > WS_FAULT_MESSAGE) return E_INVALIDARG;
if (msg->state >= WS_MESSAGE_STATE_INITIALIZED) return WS_E_INVALID_OPERATION;
msg->init = init;
msg->state = WS_MESSAGE_STATE_INITIALIZED;
return S_OK;
}
/**************************************************************************
* WsFreeMessage [webservices.@]
*/

View File

@ -156,8 +156,62 @@ static void test_WsCreateMessageForChannel(void)
WsFreeMessage( msg );
}
static void test_WsInitializeMessage(void)
{
HRESULT hr;
WS_MESSAGE *msg;
WS_MESSAGE_STATE state;
WS_ENVELOPE_VERSION env_version;
WS_ADDRESSING_VERSION addr_version;
BOOL addressed;
return;
hr = WsInitializeMessage( NULL, WS_REQUEST_MESSAGE, NULL, NULL );
ok( hr == E_INVALIDARG, "got %08x\n", hr );
hr = WsCreateMessage( WS_ADDRESSING_VERSION_0_9, WS_ENVELOPE_VERSION_SOAP_1_1, NULL,
0, &msg, NULL );
ok( hr == S_OK, "got %08x\n", hr );
hr = WsInitializeMessage( msg, 0xdeadbeef, NULL, NULL );
ok( hr == E_INVALIDARG, "got %08x\n", hr );
hr = WsInitializeMessage( msg, WS_REQUEST_MESSAGE, NULL, NULL );
ok( hr == S_OK, "got %08x\n", hr );
hr = WsInitializeMessage( msg, WS_REQUEST_MESSAGE, NULL, NULL );
ok( hr == WS_E_INVALID_OPERATION, "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 );
addressed = -1;
hr = WsGetMessageProperty( msg, WS_MESSAGE_PROPERTY_IS_ADDRESSED, &addressed, sizeof(addressed),
NULL );
ok( hr == S_OK, "got %08x\n", hr );
ok( !addressed, "unexpected value %d\n", addressed );
state = WS_MESSAGE_STATE_EMPTY;
hr = WsSetMessageProperty( msg, WS_MESSAGE_PROPERTY_STATE, &state, sizeof(state), NULL );
ok( hr == E_INVALIDARG, "got %08x\n", hr );
env_version = WS_ENVELOPE_VERSION_SOAP_1_1;
hr = WsSetMessageProperty( msg, WS_MESSAGE_PROPERTY_ENVELOPE_VERSION, &env_version,
sizeof(env_version), NULL );
ok( hr == E_INVALIDARG, "got %08x\n", hr );
addr_version = WS_ADDRESSING_VERSION_0_9;
hr = WsSetMessageProperty( msg, WS_MESSAGE_PROPERTY_ADDRESSING_VERSION, &addr_version,
sizeof(addr_version), NULL );
ok( hr == E_INVALIDARG, "got %08x\n", hr );
WsFreeMessage( msg );
}
START_TEST(msg)
{
test_WsCreateMessage();
test_WsCreateMessageForChannel();
test_WsInitializeMessage();
}

View File

@ -90,7 +90,7 @@
@ stdcall WsGetWriterPosition(ptr ptr ptr)
@ stdcall WsGetWriterProperty(ptr long ptr long ptr)
@ stdcall WsGetXmlAttribute(ptr ptr ptr ptr ptr ptr)
@ stub WsInitializeMessage
@ stdcall WsInitializeMessage(ptr long ptr ptr)
@ stub WsMarkHeaderAsUnderstood
@ stub WsMatchPolicyAlternative
@ stdcall WsMoveReader(ptr long ptr ptr)