Commit 0f227b22 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

webservices: Implement WS_ADDRESSING_VERSION_TRANSPORT.

parent ac42d701
...@@ -349,6 +349,11 @@ static HRESULT get_addr_namespace( WS_ADDRESSING_VERSION ver, WS_XML_STRING *str ...@@ -349,6 +349,11 @@ static HRESULT get_addr_namespace( WS_ADDRESSING_VERSION ver, WS_XML_STRING *str
str->length = sizeof(ns_addr_1_0)/sizeof(ns_addr_1_0[0]) - 1; str->length = sizeof(ns_addr_1_0)/sizeof(ns_addr_1_0[0]) - 1;
return S_OK; return S_OK;
case WS_ADDRESSING_VERSION_TRANSPORT:
str->bytes = NULL;
str->length = 0;
return S_OK;
default: default:
ERR( "unhandled addressing version %u\n", ver ); ERR( "unhandled addressing version %u\n", ver );
return E_NOTIMPL; return E_NOTIMPL;
...@@ -409,14 +414,18 @@ static HRESULT write_envelope_start( struct msg *msg, WS_XML_WRITER *writer ) ...@@ -409,14 +414,18 @@ static HRESULT write_envelope_start( struct msg *msg, WS_XML_WRITER *writer )
if ((hr = get_addr_namespace( msg->version_addr, &ns_addr )) != S_OK) return hr; if ((hr = get_addr_namespace( msg->version_addr, &ns_addr )) != S_OK) return hr;
if ((hr = WsWriteStartElement( writer, &prefix_s, &envelope, &ns_env, NULL )) != S_OK) return hr; if ((hr = WsWriteStartElement( writer, &prefix_s, &envelope, &ns_env, NULL )) != S_OK) return hr;
if ((hr = WsWriteXmlnsAttribute( writer, &prefix_a, &ns_addr, FALSE, NULL )) != S_OK) return hr; if (msg->version_addr < WS_ADDRESSING_VERSION_TRANSPORT &&
(hr = WsWriteXmlnsAttribute( writer, &prefix_a, &ns_addr, FALSE, NULL )) != S_OK) return hr;
if ((hr = WsWriteStartElement( writer, &prefix_s, &header, &ns_env, NULL )) != S_OK) return hr; if ((hr = WsWriteStartElement( writer, &prefix_s, &header, &ns_env, NULL )) != S_OK) return hr;
if ((hr = WsWriteStartElement( writer, &prefix_a, &msgid, &ns_addr, NULL )) != S_OK) return hr;
urn.text.textType = WS_XML_TEXT_TYPE_UNIQUE_ID; if (msg->version_addr < WS_ADDRESSING_VERSION_TRANSPORT)
memcpy( &urn.value, &msg->id, sizeof(msg->id) ); {
if ((hr = WsWriteText( writer, &urn.text, NULL )) != S_OK) return hr; if ((hr = WsWriteStartElement( writer, &prefix_a, &msgid, &ns_addr, NULL )) != S_OK) return hr;
if ((hr = WsWriteEndElement( writer, NULL )) != S_OK) return hr; /* </a:MessageID> */ urn.text.textType = WS_XML_TEXT_TYPE_UNIQUE_ID;
memcpy( &urn.value, &msg->id, sizeof(msg->id) );
if ((hr = WsWriteText( writer, &urn.text, NULL )) != S_OK) return hr;
if ((hr = WsWriteEndElement( writer, NULL )) != S_OK) return hr; /* </a:MessageID> */
}
for (i = 0; i < msg->header_count; i++) for (i = 0; i < msg->header_count; i++)
{ {
......
...@@ -339,6 +339,8 @@ static void test_WsWriteEnvelopeStart(void) ...@@ -339,6 +339,8 @@ static void test_WsWriteEnvelopeStart(void)
"<a:MessageID>urn:uuid:00000000-0000-0000-0000-000000000000</a:MessageID>" "<a:MessageID>urn:uuid:00000000-0000-0000-0000-000000000000</a:MessageID>"
"<a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>" "<a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>"
"</a:ReplyTo></s:Header><s:Body/></s:Envelope>"; "</a:ReplyTo></s:Header><s:Body/></s:Envelope>";
static const char expected3[] =
"<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\"><s:Header/><s:Body/></s:Envelope>";
HRESULT hr; HRESULT hr;
WS_MESSAGE *msg; WS_MESSAGE *msg;
WS_XML_WRITER *writer; WS_XML_WRITER *writer;
...@@ -375,6 +377,21 @@ static void test_WsWriteEnvelopeStart(void) ...@@ -375,6 +377,21 @@ static void test_WsWriteEnvelopeStart(void)
hr = WsGetMessageProperty( msg, WS_MESSAGE_PROPERTY_STATE, &state, sizeof(state), NULL ); hr = WsGetMessageProperty( msg, WS_MESSAGE_PROPERTY_STATE, &state, sizeof(state), NULL );
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
ok( state == WS_MESSAGE_STATE_WRITING, "got %u\n", state ); ok( state == WS_MESSAGE_STATE_WRITING, "got %u\n", state );
WsFreeMessage( msg );
hr = WsCreateMessage( WS_ENVELOPE_VERSION_SOAP_1_1, WS_ADDRESSING_VERSION_TRANSPORT, NULL, 0, &msg,
NULL );
ok( hr == S_OK, "got %08x\n", hr );
hr = WsInitializeMessage( msg, WS_REQUEST_MESSAGE, NULL, 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 );
check_output_header( msg, expected3, -1, 0, 0, __LINE__ );
WsFreeMessage( msg ); WsFreeMessage( msg );
WsFreeWriter( writer ); WsFreeWriter( writer );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment