wsdlpull
1.23
Toggle main menu visibility
Loading...
Searching...
No Matches
src
wsdlparser
Soap.h
Go to the documentation of this file.
1
/*
2
* wsdlpull - A C++ parser for WSDL (Web services description language)
3
* Copyright (C) 2005-2007 Vivek Krishna
4
*
5
* This library is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU Library General Public
7
* License as published by the Free Software Foundation; either
8
* version 2 of the License, or (at your option) any later version.
9
*
10
* This library is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* Library General Public License for more details.
14
*
15
* You should have received a copy of the GNU Library General Public
16
* License along with this library; if not, write to the Free
17
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
*
19
*
20
*/
21
22
23
#ifndef _SOAPEXTH
24
#define _SOAPEXTH
25
26
#include <iostream>
27
#include <fstream>
28
29
#include "
wsdlparser/WsdlExtension.h
"
30
#include "
wsdlparser/WsdlParser.h
"
31
#include "
schemaparser/SchemaValidator.h
"
32
#include "
xmlpull/wsdlpull_export.h
"
33
34
namespace
WsdlPull
{
35
36
37
38
class
WSDLPULL_EXPORT
Soap
:
public
WsdlExtension
39
{
40
public
:
41
42
static
const
std::string
httpTransport
;
43
static
const
std::string
httpBinding
;
44
static
const
std::string
soapEncUri11
;
45
static
const
std::string
soapEnvUri11
;
46
static
const
std::string
soapEncUri12
;
47
static
const
std::string
soapEnvUri12
;
48
static
const
std::string
soapBindingUri11
;
49
static
const
std::string
soapBindingUri12
;
50
51
typedef
enum
{
52
SOAP11
,
53
SOAP12
54
} SoapVersion;
55
56
typedef
enum
57
{
58
LITERAL
,
59
ENCODED
60
} Encoding;
61
62
typedef
enum
63
{
64
RPC
,
65
DOC
66
} Style;
67
68
typedef
enum
69
{
70
NONE
,
71
HTTP
,
72
SMTP
73
} Transport;
74
75
Soap
(
const
std::string & schemaPath =
""
, SoapVersion a_soapVersion = SOAP11);
76
virtual
~Soap
();
77
81
void
setSchemaPath(
const
std::string & schemaPath);
82
83
Transport getTransportMethod()
const
;
84
Style getStyle()
const
;
85
/*
86
Returns the namespace URI of the wsdl
87
extensibility elements that it can handle.
88
*/
89
std::string getNamespace()
const
;
90
void
setNamespacePrefix(std::string pre);
91
std::string getNamespacePrefix()
const
;
92
bool
isNamespaceHandler(
const
std::string & ns)
const
;
93
std::string getExtensibilitySchema(
void
)
const
;
94
std::string getEncodingSchema(
void
)
const
;
95
std::string getEncodingUri(
void
)
const
;
96
std::string getEnvelopeUri(
void
)
const
;
97
void
setSchemaParser(
SchemaParser
* spe);
98
99
// parent is the Wsdl parent element type under which the extensibility element has come
100
int
handleElement(
int
parent,
XmlPullParser
*);
101
//attName is the extensibility attribute
102
int
handleAttribute(
int
parent, std::string attName,
XmlPullParser
*);
103
//returns a valid extensibilty element
104
int
getElementName(
int
id
)
const
;
105
int
getElemAttribute
(
int
id
,
int
att_num);
106
int
getElemAttributeValue
(
int
id
,
int
att_num);
107
//returns a valid extensibility attribute
108
int
getAttributeName
(
int
id
)
const
;
109
110
//this is the start of all ids that must be used for elems/attributes in this namespace
111
void
setStartId
(
int
id
);
112
int
getStartId
()
const
;
113
114
void
setWsdlParser
(
WsdlParser
* wp);
115
WsdlParser
*
wsdlParser
()
const
;
116
bool
wasUsed
()
const
;
117
118
void
serialize
(std::ostream & out);
119
void
getSoapOperationInfo
(
int
elemId, std::string & soapAction,
Soap::Style
& style);
120
void
getSoapBodyInfo
(
int
elemId, std::string &ns,
Soap::Encoding
&use, std::string &encodingStyle);
121
void
getSoapHeaderInfo
(
int
elemId, std::string &ns,
int
&partId,
const
Message
* & m);
122
bool
getServiceLocation
(
int
elemId, std::string &location);
123
124
SoapVersion
getSoapVersion
()
const
{
return
soapVersion_; }
125
126
//TODO add more methods like this
127
bool
isSoapBody(
int
id
);
128
bool
isSoapHeader(
int
id
);
129
130
/*
131
Enums used in soap
132
*/
133
134
private
:
135
void
error(std::string);
136
int
processBinding(
TypeContainer
* t);
137
int
processOp(
int
,
TypeContainer
* t);
138
int
processBody(
int
,
TypeContainer
* t);
139
int
processHeader(
int
,
TypeContainer
* t);
140
int
processFault(
int
,
TypeContainer
* t);
141
int
processAddress(
int
parent,
TypeContainer
* t);
142
std::string sNamespace, sNsPrefix, sTitle;
143
int
startId;
144
SchemaParser
*mySchemaParser;
145
SchemaValidator
*mySchemaValidator;
146
WsdlParser
*wParser_;
147
148
typedef
struct
149
{
150
int
typeId;
151
int
index;
152
}IDTableIndex ;
153
154
std::vector<IDTableIndex> idTable;
155
int
idCounter;
156
157
typedef
struct
158
{
159
int
wsdlOpId;
160
std::string soapAction;
161
Style style;
162
} SoapOperationBinding;
163
std::vector<SoapOperationBinding> ops_;
164
165
typedef
struct
166
{
167
int
messageId;
168
Encoding use;
169
std::string encodingStyle;
170
std::string urn;
171
} SoapMessageBinding;
172
std::vector<SoapMessageBinding> body_;
173
// int nMsgs;
174
175
typedef
struct
176
{
177
std::string urn;
178
int
partId_;
179
const
Message* message_;
180
}SoapHeaderBinding;
181
std::vector<SoapHeaderBinding> header_;
182
// int nHeader;
183
184
Transport transport_;
185
Style style_;
186
std::vector<std::string> location_;
187
std::string schemaPath_;
188
189
SoapVersion soapVersion_;
//The SOAP version to use
190
};
191
192
inline
193
int
194
Soap::getElementName
(
int
id
)
const
195
{
196
if
(id < startId || id > (startId + idCounter - 1))
197
return
0;
198
return
idTable[
id
- startId].typeId;
199
}
200
201
202
inline
203
int
204
Soap::getAttributeName
(
int
id
)
const
205
{
206
if
(id < startId || id > (startId + idCounter - 1))
207
return
0;
208
return
idTable[
id
- startId].typeId;
209
}
210
211
inline
212
std::string
213
Soap::getNamespace
()
const
214
{
215
return
sNamespace;
216
}
217
218
inline
219
void
220
Soap::setNamespacePrefix
(std::string pre)
221
{
222
sNsPrefix = pre;
223
}
224
225
inline
226
std::string
227
Soap::getNamespacePrefix
()
const
228
{
229
return
sNsPrefix;
230
}
231
232
inline
233
bool
234
Soap::isNamespaceHandler
(
const
std::string & ns)
const
235
{
236
return
(ns == sNamespace);
237
}
238
239
inline
240
void
241
Soap::setSchemaParser
(
SchemaParser
* spe)
242
{
243
mySchemaParser = spe;
244
mySchemaValidator =
new
SchemaValidator
(mySchemaParser);
245
}
246
247
inline
248
void
249
Soap::setStartId
(
int
id
)
250
{
251
startId = id;
252
}
253
254
inline
255
int
256
Soap:: getStartId
()
const
257
{
258
return
startId;
259
}
260
261
inline
262
void
263
Soap::setWsdlParser
(
WsdlParser
* wp)
264
{
265
wParser_ = wp;
266
}
267
268
inline
269
bool
270
Soap::wasUsed
()
const
271
{
272
return
(wParser_ != 0);
273
}
274
275
inline
276
Soap::Transport
277
Soap::getTransportMethod
()
const
278
{
279
return
transport_;
280
}
281
282
inline
283
Soap::Style
284
Soap::getStyle
()
const
285
{
286
return
style_;
287
}
288
289
inline
290
WsdlParser
*
291
Soap::wsdlParser
()
const
292
{
293
return
wParser_;
294
}
295
296
}
297
#endif
/* */
SchemaValidator.h
WsdlExtension.h
WsdlParser.h
Schema::SchemaParser
Definition
SchemaParser.h:43
Schema::SchemaValidator
Definition
SchemaValidator.h:35
Schema::TypeContainer
Definition
TypeContainer.h:44
WsdlPull::Message
Definition
Message.h:64
WsdlPull::Soap
Definition
Soap.h:39
WsdlPull::Soap::getServiceLocation
bool getServiceLocation(int elemId, std::string &location)
Definition
Soap.cpp:450
WsdlPull::Soap::setSchemaParser
void setSchemaParser(SchemaParser *spe)
Definition
Soap.h:241
WsdlPull::Soap::wasUsed
bool wasUsed() const
Definition
Soap.h:270
WsdlPull::Soap::getSoapOperationInfo
void getSoapOperationInfo(int elemId, std::string &soapAction, Soap::Style &style)
Definition
Soap.cpp:415
WsdlPull::Soap::getSoapBodyInfo
void getSoapBodyInfo(int elemId, std::string &ns, Soap::Encoding &use, std::string &encodingStyle)
Definition
Soap.cpp:426
WsdlPull::Soap::getSoapHeaderInfo
void getSoapHeaderInfo(int elemId, std::string &ns, int &partId, const Message *&m)
Definition
Soap.cpp:438
WsdlPull::Soap::soapEncUri12
static const std::string soapEncUri12
Definition
Soap.h:46
WsdlPull::Soap::soapBindingUri11
static const std::string soapBindingUri11
Definition
Soap.h:48
WsdlPull::Soap::Transport
Transport
Definition
Soap.h:69
WsdlPull::Soap::NONE
@ NONE
Definition
Soap.h:70
WsdlPull::Soap::HTTP
@ HTTP
Definition
Soap.h:71
WsdlPull::Soap::SMTP
@ SMTP
Definition
Soap.h:72
WsdlPull::Soap::isNamespaceHandler
bool isNamespaceHandler(const std::string &ns) const
Definition
Soap.h:234
WsdlPull::Soap::soapEncUri11
static const std::string soapEncUri11
Definition
Soap.h:44
WsdlPull::Soap::Encoding
Encoding
Definition
Soap.h:57
WsdlPull::Soap::LITERAL
@ LITERAL
Definition
Soap.h:58
WsdlPull::Soap::ENCODED
@ ENCODED
Definition
Soap.h:59
WsdlPull::Soap::getElemAttribute
int getElemAttribute(int id, int att_num)
WsdlPull::Soap::getTransportMethod
Transport getTransportMethod() const
Definition
Soap.h:277
WsdlPull::Soap::Soap
Soap(const std::string &schemaPath="", SoapVersion a_soapVersion=SOAP11)
Definition
Soap.cpp:48
WsdlPull::Soap::SoapVersion
SoapVersion
Definition
Soap.h:51
WsdlPull::Soap::SOAP11
@ SOAP11
Definition
Soap.h:52
WsdlPull::Soap::SOAP12
@ SOAP12
Definition
Soap.h:53
WsdlPull::Soap::getStartId
int getStartId() const
Definition
Soap.h:256
WsdlPull::Soap::getNamespace
std::string getNamespace() const
Definition
Soap.h:213
WsdlPull::Soap::setNamespacePrefix
void setNamespacePrefix(std::string pre)
Definition
Soap.h:220
WsdlPull::Soap::getElementName
int getElementName(int id) const
Definition
Soap.h:194
WsdlPull::Soap::getNamespacePrefix
std::string getNamespacePrefix() const
Definition
Soap.h:227
WsdlPull::Soap::setStartId
void setStartId(int id)
Definition
Soap.h:249
WsdlPull::Soap::serialize
void serialize(std::ostream &out)
WsdlPull::Soap::httpTransport
static const std::string httpTransport
Definition
Soap.h:42
WsdlPull::Soap::setWsdlParser
void setWsdlParser(WsdlParser *wp)
Definition
Soap.h:263
WsdlPull::Soap::getStyle
Style getStyle() const
Definition
Soap.h:284
WsdlPull::Soap::getAttributeName
int getAttributeName(int id) const
Definition
Soap.h:204
WsdlPull::Soap::Style
Style
Definition
Soap.h:63
WsdlPull::Soap::DOC
@ DOC
Definition
Soap.h:65
WsdlPull::Soap::RPC
@ RPC
Definition
Soap.h:64
WsdlPull::Soap::soapBindingUri12
static const std::string soapBindingUri12
Definition
Soap.h:49
WsdlPull::Soap::httpBinding
static const std::string httpBinding
Definition
Soap.h:43
WsdlPull::Soap::wsdlParser
WsdlParser * wsdlParser() const
Definition
Soap.h:291
WsdlPull::Soap::getElemAttributeValue
int getElemAttributeValue(int id, int att_num)
WsdlPull::Soap::getSoapVersion
SoapVersion getSoapVersion() const
Definition
Soap.h:124
WsdlPull::Soap::soapEnvUri12
static const std::string soapEnvUri12
Definition
Soap.h:47
WsdlPull::Soap::soapEnvUri11
static const std::string soapEnvUri11
Definition
Soap.h:45
WsdlPull::WsdlExtension::WsdlExtension
WsdlExtension()
Definition
WsdlExtension.h:44
WsdlPull::WsdlParser
Definition
WsdlParser.h:44
XmlPullParser
Definition
XmlPullParser.h:47
WsdlPull
Definition
Binding.h:27
wsdlpull_export.h
WSDLPULL_EXPORT
#define WSDLPULL_EXPORT
Definition
wsdlpull_export.h:30
Generated by
1.17.0