webservices: Implement WsCreateMessageForChannel.
Signed-off-by: Hans Leidekker <hans@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
da5c332c92
commit
dc8033d371
|
@ -33,8 +33,8 @@ static const struct prop_desc msg_props[] =
|
|||
{
|
||||
{ sizeof(WS_MESSAGE_STATE), TRUE }, /* WS_MESSAGE_PROPERTY_STATE */
|
||||
{ sizeof(WS_HEAP *), TRUE }, /* WS_MESSAGE_PROPERTY_HEAP */
|
||||
{ sizeof(WS_ENVELOPE_VERSION), FALSE }, /* WS_MESSAGE_PROPERTY_ENVELOPE_VERSION */
|
||||
{ sizeof(WS_ADDRESSING_VERSION), FALSE }, /* WS_MESSAGE_PROPERTY_ADDRESSING_VERSION */
|
||||
{ sizeof(WS_ENVELOPE_VERSION), TRUE }, /* WS_MESSAGE_PROPERTY_ENVELOPE_VERSION */
|
||||
{ sizeof(WS_ADDRESSING_VERSION), TRUE }, /* WS_MESSAGE_PROPERTY_ADDRESSING_VERSION */
|
||||
{ sizeof(WS_XML_BUFFER *), TRUE }, /* WS_MESSAGE_PROPERTY_HEADER_BUFFER */
|
||||
{ sizeof(WS_XML_NODE_POSITION *), TRUE }, /* WS_MESSAGE_PROPERTY_HEADER_POSITION */
|
||||
{ sizeof(WS_XML_READER *), TRUE }, /* WS_MESSAGE_PROPERTY_BODY_READER */
|
||||
|
@ -45,6 +45,9 @@ static const struct prop_desc msg_props[] =
|
|||
struct msg
|
||||
{
|
||||
WS_MESSAGE_STATE state;
|
||||
WS_ENVELOPE_VERSION version_env;
|
||||
WS_ADDRESSING_VERSION version_addr;
|
||||
BOOL is_addressed;
|
||||
ULONG prop_count;
|
||||
struct prop prop[sizeof(msg_props)/sizeof(msg_props[0])];
|
||||
};
|
||||
|
@ -76,11 +79,6 @@ static HRESULT create_msg( WS_ENVELOPE_VERSION env_version, WS_ADDRESSING_VERSIO
|
|||
|
||||
if (!(msg = alloc_msg())) return E_OUTOFMEMORY;
|
||||
|
||||
prop_set( msg->prop, msg->prop_count, WS_MESSAGE_PROPERTY_ENVELOPE_VERSION, &env_version,
|
||||
sizeof(env_version) );
|
||||
prop_set( msg->prop, msg->prop_count, WS_MESSAGE_PROPERTY_ADDRESSING_VERSION, &addr_version,
|
||||
sizeof(addr_version) );
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
if (properties[i].id == WS_MESSAGE_PROPERTY_ENVELOPE_VERSION ||
|
||||
|
@ -98,6 +96,9 @@ static HRESULT create_msg( WS_ENVELOPE_VERSION env_version, WS_ADDRESSING_VERSIO
|
|||
}
|
||||
}
|
||||
|
||||
msg->version_env = env_version;
|
||||
msg->version_addr = addr_version;
|
||||
|
||||
*handle = (WS_MESSAGE *)msg;
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -116,6 +117,32 @@ HRESULT WINAPI WsCreateMessage( WS_ENVELOPE_VERSION env_version, WS_ADDRESSING_V
|
|||
return create_msg( env_version, addr_version, properties, count, handle );
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* WsCreateMessageForChannel [webservices.@]
|
||||
*/
|
||||
HRESULT WINAPI WsCreateMessageForChannel( WS_CHANNEL *channel_handle, const WS_MESSAGE_PROPERTY *properties,
|
||||
ULONG count, WS_MESSAGE **handle, WS_ERROR *error )
|
||||
{
|
||||
WS_ENVELOPE_VERSION version_env;
|
||||
WS_ADDRESSING_VERSION version_addr;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE( "%p %p %u %p %p\n", channel_handle, properties, count, handle, error );
|
||||
if (error) FIXME( "ignoring error parameter\n" );
|
||||
|
||||
if (!channel_handle || !handle) return E_INVALIDARG;
|
||||
|
||||
if ((hr = WsGetChannelProperty( channel_handle, WS_CHANNEL_PROPERTY_ENVELOPE_VERSION, &version_env,
|
||||
sizeof(version_env), NULL )) != S_OK || !version_env)
|
||||
version_env = WS_ENVELOPE_VERSION_SOAP_1_2;
|
||||
|
||||
if ((hr = WsGetChannelProperty( channel_handle, WS_CHANNEL_PROPERTY_ADDRESSING_VERSION, &version_addr,
|
||||
sizeof(version_addr), NULL )) != S_OK || !version_addr)
|
||||
version_addr = WS_ADDRESSING_VERSION_1_0;
|
||||
|
||||
return create_msg( version_env, version_addr, properties, count, handle );
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* WsFreeMessage [webservices.@]
|
||||
*/
|
||||
|
@ -138,7 +165,33 @@ HRESULT WINAPI WsGetMessageProperty( WS_MESSAGE *handle, WS_MESSAGE_PROPERTY_ID
|
|||
TRACE( "%p %u %p %u %p\n", handle, id, buf, size, error );
|
||||
if (error) FIXME( "ignoring error parameter\n" );
|
||||
|
||||
return prop_get( msg->prop, msg->prop_count, id, buf, size );
|
||||
if (!handle) return E_INVALIDARG;
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case WS_MESSAGE_PROPERTY_STATE:
|
||||
if (!buf || size != sizeof(msg->state)) return E_INVALIDARG;
|
||||
*(WS_MESSAGE_STATE *)buf = msg->state;
|
||||
return S_OK;
|
||||
|
||||
case WS_MESSAGE_PROPERTY_ENVELOPE_VERSION:
|
||||
if (!buf || size != sizeof(msg->version_env)) return E_INVALIDARG;
|
||||
*(WS_ENVELOPE_VERSION *)buf = msg->version_env;
|
||||
return S_OK;
|
||||
|
||||
case WS_MESSAGE_PROPERTY_ADDRESSING_VERSION:
|
||||
if (!buf || size != sizeof(msg->version_addr)) return E_INVALIDARG;
|
||||
*(WS_ADDRESSING_VERSION *)buf = msg->version_addr;
|
||||
return S_OK;
|
||||
|
||||
case WS_MESSAGE_PROPERTY_IS_ADDRESSED:
|
||||
if (msg->state < WS_MESSAGE_STATE_INITIALIZED) return WS_E_INVALID_OPERATION;
|
||||
*(BOOL *)buf = msg->is_addressed;
|
||||
return S_OK;
|
||||
|
||||
default:
|
||||
return prop_get( msg->prop, msg->prop_count, id, buf, size );
|
||||
}
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
|
@ -152,5 +205,19 @@ HRESULT WINAPI WsSetMessageProperty( WS_MESSAGE *handle, WS_MESSAGE_PROPERTY_ID
|
|||
TRACE( "%p %u %p %u\n", handle, id, value, size );
|
||||
if (error) FIXME( "ignoring error parameter\n" );
|
||||
|
||||
if (!handle) return E_INVALIDARG;
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case WS_MESSAGE_PROPERTY_STATE:
|
||||
case WS_MESSAGE_PROPERTY_ENVELOPE_VERSION:
|
||||
case WS_MESSAGE_PROPERTY_ADDRESSING_VERSION:
|
||||
case WS_MESSAGE_PROPERTY_IS_ADDRESSED:
|
||||
if (msg->state < WS_MESSAGE_STATE_INITIALIZED) return WS_E_INVALID_OPERATION;
|
||||
return E_INVALIDARG;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return prop_set( msg->prop, msg->prop_count, id, value, size );
|
||||
}
|
||||
|
|
|
@ -25,34 +25,40 @@ static void test_WsCreateMessage(void)
|
|||
{
|
||||
HRESULT hr;
|
||||
WS_MESSAGE *msg;
|
||||
WS_MESSAGE_STATE state;
|
||||
WS_ENVELOPE_VERSION env_version;
|
||||
WS_ADDRESSING_VERSION addr_version;
|
||||
WS_MESSAGE_PROPERTY prop;
|
||||
|
||||
hr = WsCreateMessage( 0, 0, NULL, 0, NULL, NULL ) ;
|
||||
hr = WsCreateMessage( 0, 0, NULL, 0, NULL, NULL );
|
||||
ok( hr == E_INVALIDARG, "got %08x\n", hr );
|
||||
|
||||
hr = WsCreateMessage( 0, 0, NULL, 0, &msg, NULL ) ;
|
||||
hr = WsCreateMessage( 0, 0, NULL, 0, &msg, NULL );
|
||||
ok( hr == E_INVALIDARG, "got %08x\n", hr );
|
||||
|
||||
hr = WsCreateMessage( WS_ADDRESSING_VERSION_0_9, 0, NULL, 0, &msg, NULL ) ;
|
||||
hr = WsCreateMessage( WS_ADDRESSING_VERSION_0_9, 0, NULL, 0, &msg, NULL );
|
||||
ok( hr == E_INVALIDARG, "got %08x\n", hr );
|
||||
|
||||
hr = WsCreateMessage( 0, WS_ENVELOPE_VERSION_SOAP_1_1, NULL, 0, &msg, NULL ) ;
|
||||
hr = WsCreateMessage( 0, WS_ENVELOPE_VERSION_SOAP_1_1, NULL, 0, &msg, NULL );
|
||||
ok( hr == E_INVALIDARG, "got %08x\n", hr );
|
||||
|
||||
env_version = WS_ENVELOPE_VERSION_SOAP_1_1;
|
||||
prop.id = WS_MESSAGE_PROPERTY_ENVELOPE_VERSION;
|
||||
prop.value = &env_version;
|
||||
prop.valueSize = sizeof(env_version);
|
||||
hr = WsCreateMessage( WS_ADDRESSING_VERSION_0_9, WS_ENVELOPE_VERSION_SOAP_1_1, &prop,
|
||||
1, &msg, NULL ) ;
|
||||
hr = WsCreateMessage( WS_ENVELOPE_VERSION_SOAP_1_1, WS_ADDRESSING_VERSION_0_9, &prop,
|
||||
1, &msg, 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 ) ;
|
||||
0, &msg, NULL );
|
||||
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;
|
||||
hr = WsGetMessageProperty( msg, WS_MESSAGE_PROPERTY_ENVELOPE_VERSION, &env_version,
|
||||
sizeof(env_version), NULL );
|
||||
|
@ -65,10 +71,93 @@ static void test_WsCreateMessage(void)
|
|||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
ok( addr_version == WS_ADDRESSING_VERSION_0_9, "got %u\n", addr_version );
|
||||
|
||||
state = WS_MESSAGE_STATE_EMPTY;
|
||||
hr = WsSetMessageProperty( msg, WS_MESSAGE_PROPERTY_STATE, &state, sizeof(state), NULL );
|
||||
ok( hr == WS_E_INVALID_OPERATION, "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 == WS_E_INVALID_OPERATION, "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 == WS_E_INVALID_OPERATION, "got %08x\n", hr );
|
||||
WsFreeMessage( msg );
|
||||
}
|
||||
|
||||
static void test_WsCreateMessageForChannel(void)
|
||||
{
|
||||
HRESULT hr;
|
||||
WS_CHANNEL *channel;
|
||||
WS_MESSAGE *msg;
|
||||
WS_MESSAGE_STATE state;
|
||||
WS_ENVELOPE_VERSION env_version;
|
||||
WS_ADDRESSING_VERSION addr_version;
|
||||
WS_CHANNEL_PROPERTY prop;
|
||||
BOOL addressed;
|
||||
|
||||
hr = WsCreateMessageForChannel( NULL, NULL, 0, NULL, NULL );
|
||||
ok( hr == E_INVALIDARG, "got %08x\n", hr );
|
||||
|
||||
hr = WsCreateMessageForChannel( NULL, NULL, 0, &msg, NULL );
|
||||
ok( hr == E_INVALIDARG, "got %08x\n", hr );
|
||||
|
||||
hr = WsCreateChannel( WS_CHANNEL_TYPE_REQUEST, WS_HTTP_CHANNEL_BINDING, NULL, 0, NULL,
|
||||
&channel, NULL );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
|
||||
hr = WsCreateMessageForChannel( channel, NULL, 0, &msg, NULL );
|
||||
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;
|
||||
hr = WsGetMessageProperty( msg, WS_MESSAGE_PROPERTY_ENVELOPE_VERSION, &env_version,
|
||||
sizeof(env_version), NULL );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
ok( env_version == WS_ENVELOPE_VERSION_SOAP_1_2, "got %u\n", env_version );
|
||||
|
||||
addr_version = 0xdeadbeef;
|
||||
hr = WsGetMessageProperty( msg, WS_MESSAGE_PROPERTY_ADDRESSING_VERSION, &addr_version,
|
||||
sizeof(addr_version), NULL );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
ok( addr_version == WS_ADDRESSING_VERSION_1_0, "got %u\n", addr_version );
|
||||
|
||||
hr = WsGetMessageProperty( msg, WS_MESSAGE_PROPERTY_IS_ADDRESSED, &addressed, sizeof(addressed),
|
||||
NULL );
|
||||
ok( hr == WS_E_INVALID_OPERATION, "got %08x\n", hr );
|
||||
|
||||
WsFreeChannel( channel );
|
||||
WsFreeMessage( msg );
|
||||
|
||||
env_version = WS_ENVELOPE_VERSION_SOAP_1_1;
|
||||
prop.id = WS_CHANNEL_PROPERTY_ENVELOPE_VERSION;
|
||||
prop.value = &env_version;
|
||||
prop.valueSize = sizeof(env_version);
|
||||
hr = WsCreateChannel( WS_CHANNEL_TYPE_REQUEST, WS_HTTP_CHANNEL_BINDING, &prop, 1, NULL,
|
||||
&channel, NULL );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
|
||||
hr = WsCreateMessageForChannel( channel, NULL, 0, &msg, NULL );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
|
||||
env_version = 0xdeadbeef;
|
||||
hr = WsGetMessageProperty( msg, WS_MESSAGE_PROPERTY_ENVELOPE_VERSION, &env_version,
|
||||
sizeof(env_version), NULL );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
ok( env_version == WS_ENVELOPE_VERSION_SOAP_1_1, "got %u\n", env_version );
|
||||
|
||||
WsFreeChannel( channel );
|
||||
WsFreeMessage( msg );
|
||||
}
|
||||
|
||||
START_TEST(msg)
|
||||
{
|
||||
test_WsCreateMessage();
|
||||
test_WsCreateMessageForChannel();
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
@ stdcall WsCreateHeap(long long ptr long ptr ptr)
|
||||
@ stub WsCreateListener
|
||||
@ stdcall WsCreateMessage(long long ptr long ptr ptr)
|
||||
@ stub WsCreateMessageForChannel
|
||||
@ stdcall WsCreateMessageForChannel(ptr ptr long ptr ptr)
|
||||
@ stub WsCreateMetadata
|
||||
@ stdcall WsCreateReader(ptr long ptr ptr)
|
||||
@ stub WsCreateServiceEndpointFromTemplate
|
||||
|
|
Loading…
Reference in New Issue