webservices: Implement WsRemoveMappedHeader.
Signed-off-by: Hans Leidekker <hans@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
ecd1fa8f0f
commit
95dd6a8738
|
@ -778,3 +778,32 @@ HRESULT WINAPI WsAddMappedHeader( WS_MESSAGE *handle, const WS_XML_STRING *name,
|
|||
msg->header[i] = header;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* WsRemoveMappedHeader [webservices.@]
|
||||
*/
|
||||
HRESULT WINAPI WsRemoveMappedHeader( WS_MESSAGE *handle, const WS_XML_STRING *name, WS_ERROR *error )
|
||||
{
|
||||
struct msg *msg = (struct msg *)handle;
|
||||
ULONG i;
|
||||
|
||||
TRACE( "%p %s %p\n", handle, debugstr_xmlstr(name), error );
|
||||
if (error) FIXME( "ignoring error parameter\n" );
|
||||
|
||||
if (!handle || !name) return E_INVALIDARG;
|
||||
if (msg->state < WS_MESSAGE_STATE_INITIALIZED) return WS_E_INVALID_OPERATION;
|
||||
|
||||
for (i = 0; i < msg->header_count; i++)
|
||||
{
|
||||
if (msg->header[i]->type || !msg->header[i]->mapped) continue;
|
||||
if (WsXmlStringEquals( name, &msg->header[i]->name, NULL ) == S_OK)
|
||||
{
|
||||
free_header( msg->header[i] );
|
||||
memmove( &msg->header[i], &msg->header[i + 1], (msg->header_count - i) * sizeof(struct header *) );
|
||||
msg->header_count--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
|
|
@ -703,6 +703,40 @@ static void test_WsAddMappedHeader(void)
|
|||
WsFreeMessage( msg );
|
||||
}
|
||||
|
||||
static void test_WsRemoveMappedHeader(void)
|
||||
{
|
||||
static const WS_XML_STRING header = {6, (BYTE *)"Header"}, value = {5, (BYTE *)"value"};
|
||||
WS_MESSAGE *msg;
|
||||
HRESULT hr;
|
||||
|
||||
hr = WsRemoveMappedHeader( NULL, 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 = WsRemoveMappedHeader( msg, NULL, NULL );
|
||||
ok( hr == E_INVALIDARG, "got %08x\n", hr );
|
||||
|
||||
hr = WsRemoveMappedHeader( msg, &header, 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 = WsAddMappedHeader( msg, &header, WS_XML_STRING_TYPE, WS_WRITE_REQUIRED_VALUE, &value, sizeof(value), NULL );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
|
||||
hr = WsRemoveMappedHeader( msg, &header, NULL );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
|
||||
/* again */
|
||||
hr = WsRemoveMappedHeader( msg, &header, NULL );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
|
||||
WsFreeMessage( msg );
|
||||
}
|
||||
|
||||
START_TEST(msg)
|
||||
{
|
||||
test_WsCreateMessage();
|
||||
|
@ -715,4 +749,5 @@ START_TEST(msg)
|
|||
test_WsSetHeader();
|
||||
test_WsRemoveHeader();
|
||||
test_WsAddMappedHeader();
|
||||
test_WsRemoveMappedHeader();
|
||||
}
|
||||
|
|
|
@ -129,7 +129,7 @@
|
|||
@ stub WsRegisterOperationForCancel
|
||||
@ stub WsRemoveCustomHeader
|
||||
@ stdcall WsRemoveHeader(ptr long ptr)
|
||||
@ stub WsRemoveMappedHeader
|
||||
@ stdcall WsRemoveMappedHeader(ptr ptr ptr)
|
||||
@ stub WsRemoveNode
|
||||
@ stub WsRequestReply
|
||||
@ stub WsRequestSecurityToken
|
||||
|
|
Loading…
Reference in New Issue