[7/8] webservices: Implement WsReadEnvelopeEnd.
Hans Leidekker
hans at codeweavers.com
Wed Aug 31 07:35:33 CDT 2016
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
---
dlls/webservices/msg.c | 27 ++++++++++++++++++++++
dlls/webservices/tests/msg.c | 47 +++++++++++++++++++++++++++++++++++++++
dlls/webservices/webservices.spec | 2 +-
include/webservices.h | 1 +
4 files changed, 76 insertions(+), 1 deletion(-)
diff --git a/dlls/webservices/msg.c b/dlls/webservices/msg.c
index 2004c70..27dbddd 100644
--- a/dlls/webservices/msg.c
+++ b/dlls/webservices/msg.c
@@ -588,6 +588,33 @@ HRESULT WINAPI WsReadEnvelopeStart( WS_MESSAGE *handle, WS_XML_READER *reader, W
return S_OK;
}
+static HRESULT read_envelope_end( WS_XML_READER *reader )
+{
+ HRESULT hr;
+ if ((hr = WsReadEndElement( reader, NULL )) != S_OK) return hr; /* </s:Body> */
+ return WsReadEndElement( reader, NULL ); /* </s:Envelope> */
+}
+
+/**************************************************************************
+ * WsReadEnvelopeEnd [webservices.@]
+ */
+HRESULT WINAPI WsReadEnvelopeEnd( WS_MESSAGE *handle, WS_ERROR *error )
+{
+ struct msg *msg = (struct msg *)handle;
+ HRESULT hr;
+
+ TRACE( "%p %p\n", handle, error );
+ if (error) FIXME( "ignoring error parameter\n" );
+
+ if (!handle) return E_INVALIDARG;
+ if (msg->state != WS_MESSAGE_STATE_READING) return WS_E_INVALID_OPERATION;
+
+ if ((hr = read_envelope_end( msg->reader_body )) != S_OK) return hr;
+
+ msg->state = WS_MESSAGE_STATE_DONE;
+ return S_OK;
+}
+
/**************************************************************************
* WsInitializeMessage [webservices.@]
*/
diff --git a/dlls/webservices/tests/msg.c b/dlls/webservices/tests/msg.c
index 4725dbd..910e353 100644
--- a/dlls/webservices/tests/msg.c
+++ b/dlls/webservices/tests/msg.c
@@ -916,6 +916,52 @@ static void test_WsReadEnvelopeStart(void)
WsFreeReader( reader );
}
+static void test_WsReadEnvelopeEnd(void)
+{
+ static const char xml[] =
+ "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\"><s:Body></s:Body></s:Envelope>";
+ WS_MESSAGE *msg, *msg2;
+ WS_XML_READER *reader;
+ WS_MESSAGE_STATE state;
+ HRESULT hr;
+
+ hr = WsReadEnvelopeEnd( 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 = WsCreateReader( NULL, 0, &reader, 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 = WsCreateMessage( WS_ADDRESSING_VERSION_0_9, WS_ENVELOPE_VERSION_SOAP_1_1, NULL, 0, &msg2, NULL );
+ ok( hr == S_OK, "got %08x\n", hr );
+
+ hr = set_input( reader, xml, strlen(xml) );
+ ok( hr == S_OK, "got %08x\n", hr );
+
+ hr = WsReadEnvelopeEnd( msg2, NULL );
+ ok( hr == WS_E_INVALID_OPERATION, "got %08x\n", hr );
+
+ hr = WsReadEnvelopeStart( msg2, reader, NULL, NULL, NULL );
+ ok( hr == S_OK, "got %08x\n", hr );
+
+ hr = WsReadEnvelopeEnd( msg2, NULL );
+ ok( hr == S_OK, "got %08x\n", hr );
+
+ state = 0xdeadbeef;
+ hr = WsGetMessageProperty( msg2, WS_MESSAGE_PROPERTY_STATE, &state, sizeof(state), NULL );
+ ok( hr == S_OK, "got %08x\n", hr );
+ ok( state == WS_MESSAGE_STATE_DONE, "got %u\n", state );
+
+ WsFreeMessage( msg );
+ WsFreeMessage( msg2 );
+ WsFreeReader( reader );
+}
+
START_TEST(msg)
{
test_WsCreateMessage();
@@ -932,4 +978,5 @@ START_TEST(msg)
test_WsAddCustomHeader();
test_WsRemoveCustomHeader();
test_WsReadEnvelopeStart();
+ test_WsReadEnvelopeEnd();
}
diff --git a/dlls/webservices/webservices.spec b/dlls/webservices/webservices.spec
index 6354243..a0f88ac 100644
--- a/dlls/webservices/webservices.spec
+++ b/dlls/webservices/webservices.spec
@@ -111,7 +111,7 @@
@ stdcall WsReadEndAttribute(ptr ptr)
@ stdcall WsReadEndElement(ptr ptr)
@ stub WsReadEndpointAddressExtension
-@ stub WsReadEnvelopeEnd
+@ stdcall WsReadEnvelopeEnd(ptr ptr)
@ stdcall WsReadEnvelopeStart(ptr ptr ptr ptr ptr)
@ stub WsReadMessageEnd
@ stub WsReadMessageStart
diff --git a/include/webservices.h b/include/webservices.h
index 3a06ab5..dbaa5d1 100644
--- a/include/webservices.h
+++ b/include/webservices.h
@@ -1444,6 +1444,7 @@ HRESULT WINAPI WsReadElement(WS_XML_READER*, const WS_ELEMENT_DESCRIPTION*, WS_R
WS_HEAP*, void*, ULONG, WS_ERROR*);
HRESULT WINAPI WsReadEndAttribute(WS_XML_READER*, WS_ERROR*);
HRESULT WINAPI WsReadEndElement(WS_XML_READER*, WS_ERROR*);
+HRESULT WINAPI WsReadEnvelopeEnd(WS_MESSAGE*, WS_ERROR*);
HRESULT WINAPI WsReadEnvelopeStart(WS_MESSAGE*, WS_XML_READER*, WS_MESSAGE_DONE_CALLBACK, void*,
WS_ERROR*);
HRESULT WINAPI WsReadNode(WS_XML_READER*, WS_ERROR*);
--
2.1.4
More information about the wine-patches
mailing list