1 /*
2 * Copyright 1999-2006 University of Chicago
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #include "globus_i_service_engine.h"
18 #include "globus_soap_message_markers.h"
19
20 /**
21 * Prepare the response buffer for a SOAP request
22 * @ingroup globus_service_engine
23 * @internal
24 *
25 * @param message
26 * SOAP Message handle to prepare for writing a SOAP response.
27 *
28 * @retval GLOBUS_SUCCESS
29 * @retval GLOBUS_SERVICE_ENGINE_ERROR_TYPE_TRANSPORT_FAILED
30 * @retval GLOBUS_SERVICE_ENGINE_ERROR_TYPE_FAILED_RESPONSE
31 */
32 globus_result_t
33 globus_service_session_begin_response(
34 globus_soap_message_handle_t message)
35 10903 {
36 10903 globus_result_t result = GLOBUS_SUCCESS;
37 GlobusFuncName(globus_service_session_begin_response);
38 10903 GlobusServiceEngineDebugEnter();
39
40 10903 result = globus_soap_message_setup_writer(message);
41 10903 if(result != GLOBUS_SUCCESS)
42 {
43 0 result = GlobusServiceEngineErrorTransportFailed(
44 result, "Failed to setup message writer");
45 0 goto exit;
46 }
47
48 10903 result = globus_soap_message_serialize_envelope(message);
49 10903 if(result != GLOBUS_SUCCESS)
50 {
51 0 result = GlobusServiceEngineErrorFailedResponse(result);
52 0 goto exit;
53 }
54
55 10903 result = globus_soap_message_serialize_header(message);
56 10903 if(result != GLOBUS_SUCCESS)
57 {
58 0 result = GlobusServiceEngineErrorFailedResponse(result);
59 0 goto exit;
60 }
61
62 10903 result = globus_soap_message_serialize_header_begin_close(message);
63 10903 if(result != GLOBUS_SUCCESS)
64 {
65 0 result = GlobusServiceEngineErrorFailedResponse(result);
66 0 goto exit;
67 }
68
69 10903 result = globus_soap_message_set_marker(
70 message,
71 GLOBUS_SOAP_MESSAGE_MARKER_HEADER_CONTENT);
72 10903 if(result != GLOBUS_SUCCESS)
73 {
74 0 result = GlobusServiceEngineErrorFailedResponse(result);
75 0 goto exit;
76 }
77
78 10903 result = globus_soap_message_serialize_header_end(message);
79 10903 if(result != GLOBUS_SUCCESS)
80 {
81 0 result = GlobusServiceEngineErrorFailedResponse(result);
82 0 goto exit;
83 }
84
85 10903 result = globus_soap_message_serialize_body(message);
86 10903 if(result != GLOBUS_SUCCESS)
87 {
88 0 result = GlobusServiceEngineErrorFailedResponse(result);
89 0 goto exit;
90 }
91
92 10903 result = globus_soap_message_serialize_body_begin_close(
93 message);
94 10903 if(result != GLOBUS_SUCCESS)
95 {
96 0 result = GlobusServiceEngineErrorFailedResponse(result);
97 0 goto exit;
98 }
99
100 10903 exit:
101
102 10903 GlobusServiceEngineDebugExit();
103 10903 return result;
104 }