diff --git a/dlls/webservices/msg.c b/dlls/webservices/msg.c
index ffe19f9cb89..a27ddbd77b5 100644
--- a/dlls/webservices/msg.c
+++ b/dlls/webservices/msg.c
@@ -962,3 +962,35 @@ HRESULT WINAPI WsAddCustomHeader( WS_MESSAGE *handle, const WS_ELEMENT_DESCRIPTI
msg->header[i] = header;
return write_envelope( msg );
}
+
+/**************************************************************************
+ * WsRemoveCustomHeader [webservices.@]
+ */
+HRESULT WINAPI WsRemoveCustomHeader( WS_MESSAGE *handle, const WS_XML_STRING *name, const WS_XML_STRING *ns,
+ WS_ERROR *error )
+{
+ struct msg *msg = (struct msg *)handle;
+ BOOL removed = FALSE;
+ ULONG i;
+
+ TRACE( "%p %s %s %p\n", handle, debugstr_xmlstr(name), debugstr_xmlstr(ns), error );
+ if (error) FIXME( "ignoring error parameter\n" );
+
+ if (!handle || !name || !ns) 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 &&
+ WsXmlStringEquals( ns, &msg->header[i]->ns, NULL ) == S_OK)
+ {
+ remove_header( msg, i );
+ removed = TRUE;
+ break;
+ }
+ }
+
+ if (removed) return write_envelope( msg );
+ return S_OK;
+}
diff --git a/dlls/webservices/tests/msg.c b/dlls/webservices/tests/msg.c
index a038d668f84..af7f6093356 100644
--- a/dlls/webservices/tests/msg.c
+++ b/dlls/webservices/tests/msg.c
@@ -803,6 +803,62 @@ static void test_WsAddCustomHeader(void)
WsFreeMessage( msg );
}
+static void test_WsRemoveCustomHeader(void)
+{
+ static const char expected[] =
+ ""
+ "urn:uuid:00000000-0000-0000-0000-000000000000"
+ "value";
+ static const char expected2[] =
+ ""
+ "urn:uuid:00000000-0000-0000-0000-000000000000"
+ "";
+ static WS_XML_STRING localname = {4, (BYTE *)"test"}, ns = {2, (BYTE *)"ns"};
+ static const WS_XML_STRING value = {5, (BYTE *)"value"};
+ HRESULT hr;
+ WS_MESSAGE *msg;
+ WS_ELEMENT_DESCRIPTION desc;
+
+ hr = WsRemoveCustomHeader( NULL, 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 = WsRemoveCustomHeader( msg, &localname, &ns, 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 );
+ check_output_header( msg, expected2, -1, strstr(expected2, "urn:uuid:") - expected2, 46, __LINE__ );
+
+ desc.elementLocalName = &localname;
+ desc.elementNs = &ns;
+ desc.type = WS_XML_STRING_TYPE;
+ desc.typeDescription = NULL;
+ hr = WsAddCustomHeader( msg, &desc, WS_WRITE_REQUIRED_VALUE, &value, sizeof(value), 0, NULL );
+ ok( hr == S_OK, "got %08x\n", hr );
+ check_output_header( msg, expected, -1, strstr(expected, "urn:uuid:") - expected, 46, __LINE__ );
+
+ hr = WsRemoveCustomHeader( msg, NULL, NULL, NULL );
+ ok( hr == E_INVALIDARG, "got %08x\n", hr );
+
+ hr = WsRemoveCustomHeader( msg, &localname, NULL, NULL );
+ ok( hr == E_INVALIDARG, "got %08x\n", hr );
+
+ hr = WsRemoveCustomHeader( msg, &localname, &ns, NULL );
+ ok( hr == S_OK, "got %08x\n", hr );
+ check_output_header( msg, expected2, -1, strstr(expected2, "urn:uuid:") - expected2, 46, __LINE__ );
+
+ /* again */
+ hr = WsRemoveCustomHeader( msg, &localname, &ns, NULL );
+ ok( hr == S_OK, "got %08x\n", hr );
+
+ WsFreeMessage( msg );
+}
+
START_TEST(msg)
{
test_WsCreateMessage();
@@ -817,4 +873,5 @@ START_TEST(msg)
test_WsAddMappedHeader();
test_WsRemoveMappedHeader();
test_WsAddCustomHeader();
+ test_WsRemoveCustomHeader();
}
diff --git a/dlls/webservices/webservices.spec b/dlls/webservices/webservices.spec
index 1ac3b750eed..863e92633c1 100644
--- a/dlls/webservices/webservices.spec
+++ b/dlls/webservices/webservices.spec
@@ -127,7 +127,7 @@
@ stub WsReadXmlBufferFromBytes
@ stub WsReceiveMessage
@ stub WsRegisterOperationForCancel
-@ stub WsRemoveCustomHeader
+@ stdcall WsRemoveCustomHeader(ptr ptr ptr ptr)
@ stdcall WsRemoveHeader(ptr long ptr)
@ stdcall WsRemoveMappedHeader(ptr ptr ptr)
@ stub WsRemoveNode