annotate GEMBASSY-1.0.3/gsoap/wsdl/wsdl.cpp @ 0:8300eb051bea draft

Initial upload
author ktnyt
date Fri, 26 Jun 2015 05:19:29 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1 /*
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
2 wsdl.cpp
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
3
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
4 WSDL 1.1 and WSDL 2.0 binding schema implementation
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
5
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
6 --------------------------------------------------------------------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
7 gSOAP XML Web services tools
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
8 Copyright (C) 2000-2012, Robert van Engelen, Genivia Inc. All Rights Reserved.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
9 This software is released under one of the following licenses:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
10 GPL or Genivia's license for commercial use.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
11 --------------------------------------------------------------------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
12 GPL license.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
13
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
14 This program is free software; you can redistribute it and/or modify it under
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
15 the terms of the GNU General Public License as published by the Free Software
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
16 Foundation; either version 2 of the License, or (at your option) any later
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
17 version.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
18
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
19 This program is distributed in the hope that it will be useful, but WITHOUT ANY
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
20 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
21 PARTICULAR PURPOSE. See the GNU General Public License for more details.
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
22
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
23 You should have received a copy of the GNU General Public License along with
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
24 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
25 Place, Suite 330, Boston, MA 02111-1307 USA
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
26
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
27 Author contact information:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
28 engelen@genivia.com / engelen@acm.org
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
29 --------------------------------------------------------------------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
30 A commercial use license is available from Genivia, Inc., contact@genivia.com
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
31 --------------------------------------------------------------------------------
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
32
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
33 */
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
34
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
35 #include "wsdlH.h"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
36 #include "includes.h"
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
37
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
38 extern struct Namespace namespaces[];
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
39
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
40 const char *qname_token(const char *QName, const char *URI)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
41 { if (QName && QName[0] == '"' && QName[1] == '"' && QName[2] == ':')
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
42 return QName + 3;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
43 if (QName && URI && *QName == '"') // QNames are stored in the format "URI":name, unless the URI is in the nsmap
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
44 { size_t n = strlen(URI);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
45 if (!strncmp(QName + 1, URI, n) && QName[n + 1] == '"')
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
46 return QName + n + 3;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
47 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
48 return NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
49 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
50
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
51 int is_builtin_qname(const char *QName)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
52 { if (iflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
53 return 1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
54 if (QName)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
55 { if (*QName == '#') // reserved QNames
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
56 return 0;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
57 if (*QName != '"')
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
58 return 1; // if the QName does not start with a ", it must be in the nsmap
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
59 const char *s = strchr(QName + 1, '"');
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
60 if (s)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
61 { size_t n = s - QName - 1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
62 for (SetOfString::const_iterator i = exturis.begin(); i != exturis.end(); ++i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
63 if (strlen(*i) == n && !strncmp(QName + 1, *i, n))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
64 return 1; // QName is in exturis
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
65 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
66 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
67 return 0;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
68 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
69
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
70 ////////////////////////////////////////////////////////////////////////////////
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
71 //
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
72 // wsdl
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
73 //
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
74 ////////////////////////////////////////////////////////////////////////////////
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
75
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
76 extern "C" {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
77 int warn_ignore(struct soap*, const char*);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
78 int show_ignore(struct soap*, const char*);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
79 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
80
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
81 wsdl__definitions::wsdl__definitions()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
82 { soap = soap_new1(SOAP_XML_TREE | SOAP_C_UTFSTRING);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
83 #ifdef HTTPDA_H
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
84 soap_register_plugin(soap, http_da);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
85 #endif
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
86 #ifdef WITH_OPENSSL
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
87 soap_ssl_client_context(soap, SOAP_SSL_NO_AUTHENTICATION, NULL, NULL, NULL, NULL, NULL);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
88 #endif
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
89 soap_set_namespaces(soap, namespaces);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
90 soap_default(soap);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
91 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
92 soap->fignore = show_ignore;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
93 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
94 soap->fignore = warn_ignore;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
95 soap->encodingStyle = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
96 soap->proxy_host = proxy_host;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
97 soap->proxy_port = proxy_port;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
98 soap->proxy_userid = proxy_userid;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
99 soap->proxy_passwd = proxy_passwd;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
100 name = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
101 targetNamespace = soap_strdup(soap, "");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
102 documentation = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
103 types = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
104 updated = false;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
105 location = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
106 redirs = 0;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
107 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
108
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
109 wsdl__definitions::wsdl__definitions(struct soap *copy, const char *cwd, const char *loc)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
110 { soap = soap_copy(copy);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
111 soap->socket = SOAP_INVALID_SOCKET;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
112 soap->recvfd = 0;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
113 soap->sendfd = 1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
114 strcpy(soap->host, copy->host);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
115 soap_default(soap);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
116 soap->fignore = warn_ignore;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
117 soap->encodingStyle = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
118 updated = false;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
119 location = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
120 redirs = 0;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
121 read(cwd, loc);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
122 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
123
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
124 wsdl__definitions::~wsdl__definitions()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
125 { soap_destroy(soap);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
126 soap_end(soap);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
127 soap_done(soap);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
128 free(soap);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
129 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
130
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
131 int wsdl__definitions::get(struct soap *soap)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
132 { return preprocess();
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
133 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
134
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
135 int wsdl__definitions::read(int num, char **loc)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
136 { if (num <= 0)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
137 return read((const char*)NULL, (const char*)NULL);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
138 if (num == 1)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
139 return read((const char*)NULL, loc[0]);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
140 wsdl__import im;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
141 im.namespace_ = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
142 name = soap_strdup(soap, "WSDL");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
143 targetNamespace = soap_strdup(soap, "");;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
144 for (int i = 0; i < num; i++)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
145 { im.location = loc[i];
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
146 import.push_back(im);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
147 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
148 return preprocess();
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
149 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
150
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
151 int wsdl__definitions::read(const char *cwd, const char *loc)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
152 { const char *cwd_temp;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
153 if (!cwd)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
154 cwd = cwd_path;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
155 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
156 fprintf(stderr, "\nOpening WSDL/XSD '%s' from '%s'\n", loc?loc:"", cwd?cwd:"");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
157 if (loc)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
158 { if (soap->recvfd > 2)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
159 { soap_end_recv(soap);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
160 close(soap->recvfd);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
161 soap->recvfd = -1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
162 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
163 else if (soap_valid_socket(soap->socket))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
164 { soap_end_recv(soap);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
165 soap_closesock(soap);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
166 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
167 #ifdef WITH_OPENSSL
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
168 if (!strncmp(loc, "http://", 7) || !strncmp(loc, "https://", 8))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
169 #else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
170 if (!strncmp(loc, "https://", 8))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
171 { fprintf(stderr, "\nCannot connect to https site: no SSL support, please rebuild wsdl2h with SSL or download the files and rerun wsdl2h\n");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
172 exit(1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
173 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
174 else if (!strncmp(loc, "http://", 7))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
175 #endif
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
176 { fprintf(stderr, "\nConnecting to '%s' to retrieve WSDL/XSD...\n", loc);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
177 location = soap_strdup(soap, loc);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
178 if (soap_connect_command(soap, SOAP_GET, location, NULL))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
179 { fprintf(stderr, "Connection failed\n");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
180 soap_print_fault(soap, stderr);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
181 exit(1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
182 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
183 fprintf(stderr, "Connected, receiving...\n");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
184 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
185 else if (cwd && (!strncmp(cwd, "http://", 7) || !strncmp(cwd, "https://", 8)))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
186 { char *s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
187 location = (char*)soap_malloc(soap, strlen(cwd) + strlen(loc) + 2);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
188 strcpy(location, cwd);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
189 s = strrchr(location, '/');
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
190 if (s)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
191 *s = '\0';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
192 strcat(location, "/");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
193 strcat(location, loc);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
194 fprintf(stderr, "\nConnecting to '%s' to retrieve relative path '%s' WSDL/XSD...\n", location, loc);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
195 if (soap_connect_command(soap, SOAP_GET, location, NULL))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
196 { fprintf(stderr, "Connection failed\n");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
197 exit(1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
198 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
199 fprintf(stderr, "Connected, receiving...\n");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
200 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
201 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
202 { soap->recvfd = open(loc, O_RDONLY, 0);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
203 if (soap->recvfd < 0)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
204 { if (cwd)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
205 { char *s;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
206 location = (char*)soap_malloc(soap, strlen(cwd) + strlen(loc) + 2);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
207 strcpy(location, cwd);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
208 s = strrchr(location, '/');
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
209 #ifdef WIN32
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
210 if (!s)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
211 s = strrchr(location, '\\');
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
212 #endif
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
213 if (s)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
214 *s = '\0';
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
215 strcat(location, "/");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
216 strcat(location, loc);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
217 if (!strncmp(location, "file://", 7))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
218 location += 7;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
219 soap->recvfd = open(location, O_RDONLY, 0);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
220 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
221 if (soap->recvfd < 0 && import_path)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
222 { location = (char*)soap_malloc(soap, strlen(import_path) + strlen(loc) + 2);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
223 strcpy(location, import_path);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
224 strcat(location, "/");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
225 strcat(location, loc);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
226 if (!strncmp(location, "file://", 7))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
227 location += 7;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
228 soap->recvfd = open(location, O_RDONLY, 0);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
229 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
230 if (soap->recvfd < 0)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
231 { fprintf(stderr, "\nCannot open '%s'\n", loc);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
232 exit(1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
233 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
234 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
235 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
236 location = soap_strdup(soap, loc);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
237 fprintf(stderr, "\nReading file '%s'...\n", location);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
238 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
239 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
240 cwd_temp = cwd_path;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
241 cwd_path = location;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
242 if (!soap_begin_recv(soap))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
243 this->soap_in(soap, "wsdl:", NULL);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
244 if (soap->error)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
245 { // handle sloppy WSDLs that import schemas at the top level rather than
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
246 // importing them in <types>
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
247 if (soap->error == SOAP_TAG_MISMATCH && soap->level == 0)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
248 { soap_retry(soap);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
249 xs__schema *schema = soap_new_xs__schema(soap, -1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
250 schema->soap_in(soap, "xs:schema", NULL);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
251 if (soap->error)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
252 { fprintf(stderr, "\nAn error occurred while parsing WSDL or XSD from '%s'\n", loc?loc:"");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
253 soap_print_fault(soap, stderr);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
254 if (soap->error < 200)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
255 soap_print_fault_location(soap, stderr);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
256 exit(1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
257 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
258 name = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
259 targetNamespace = schema->targetNamespace;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
260 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
261 cerr << "Found schema '" << (targetNamespace?targetNamespace:"") << "' when expecting WSDL" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
262 types = soap_new_wsdl__types(soap, -1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
263 types->documentation = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
264 types->xs__schema_.push_back(schema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
265 types->preprocess(*this);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
266 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
267 // check HTTP redirect (socket was closed)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
268 else if ((soap->error >= 301 && soap->error <= 303) || soap->error == 307)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
269 { int r = SOAP_ERR;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
270 fprintf(stderr, "Redirected to '%s'...\n", soap->endpoint);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
271 if (redirs++ < 10)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
272 r = read(cwd, soap->endpoint);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
273 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
274 fprintf(stderr, "\nMax redirects exceeded\n");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
275 redirs--;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
276 return r;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
277 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
278 else if (soap->error == 401)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
279 { int r = SOAP_ERR;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
280 fprintf(stderr, "Authenticating to '%s' realm '%s'...\n", loc, soap->authrealm);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
281 if (auth_userid && auth_passwd && redirs++ < 1)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
282 {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
283 #ifdef HTTPDA_H
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
284 struct http_da_info info;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
285 http_da_save(soap, &info, soap->authrealm, auth_userid, auth_passwd);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
286 #else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
287 soap->userid = auth_userid;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
288 soap->passwd = auth_passwd;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
289 #endif
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
290 r = read(cwd, loc);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
291 #ifdef HTTPDA_H
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
292 http_da_release(soap, &info);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
293 #endif
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
294 redirs--;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
295 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
296 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
297 fprintf(stderr, "Authentication failed, use option -r:uid:pwd and (re)build with OpenSSL to enable digest authentication\n");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
298 return r;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
299 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
300 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
301 { fprintf(stderr, "\nAn error occurred while parsing WSDL from '%s'\n", loc?loc:"");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
302 soap_print_fault(soap, stderr);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
303 if (soap->error < 200)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
304 soap_print_fault_location(soap, stderr);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
305 exit(1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
306 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
307 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
308 fprintf(stderr, "Done reading '%s'\n", loc?loc:"");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
309 soap_end_recv(soap);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
310 if (soap->recvfd > 2)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
311 { close(soap->recvfd);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
312 soap->recvfd = -1;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
313 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
314 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
315 soap_closesock(soap);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
316 cwd_path = cwd_temp;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
317 return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
318 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
319
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
320 int wsdl__definitions::preprocess()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
321 { if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
322 cerr << "Preprocessing wsdl definitions '" << (location?location:"") << "' namespace '" << (targetNamespace?targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
323 // process import
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
324 for (vector<wsdl__import>::iterator im1 = import.begin(); im1 != import.end(); ++im1)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
325 (*im1).preprocess(*this);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
326 // merge nested imported WSDLs into single import list
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
327 again:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
328 for (vector<wsdl__import>::iterator im2 = import.begin(); im2 != import.end(); ++im2)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
329 { if ((*im2).definitionsPtr())
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
330 { for (vector<wsdl__import>::iterator i = (*im2).definitionsPtr()->import.begin(); i != (*im2).definitionsPtr()->import.end(); ++i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
331 { if ((*i).definitionsPtr())
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
332 { bool found = false;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
333 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
334 cerr << "Import WSDL '" << ((*i).location?(*i).location:"") << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
335 for (vector<wsdl__import>::iterator j = import.begin(); j != import.end(); ++j)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
336 { if ((*i).definitionsPtr() == (*j).definitionsPtr()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
337 || ((*i).location && (*j).location && !strcmp((*i).location, (*j).location)))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
338 { found = true;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
339 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
340 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
341 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
342 if (!found)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
343 { if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
344 cerr << "Adding imported WSDL '" << ((*i).location?(*i).location:"") << "' to '" << (location?location:"") << "' ('" << (name?name:"") << "') namespace '" << (targetNamespace?targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
345 import.push_back(*i);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
346 goto again;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
347 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
348 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
349 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
350 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
351 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
352 // merge <types>
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
353 for (vector<wsdl__import>::iterator im3 = import.begin(); im3 != import.end(); ++im3)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
354 { if ((*im3).definitionsPtr() && (*im3).definitionsPtr()->types)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
355 { if (!types)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
356 { types = soap_new_wsdl__types(soap, -1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
357 types->soap_default(soap);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
358 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
359 // merge <types>, check for duplicates, add namespaces for sloppy imports
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
360 for (vector<xs__schema*>::const_iterator i = (*im3).definitionsPtr()->types->xs__schema_.begin(); i != (*im3).definitionsPtr()->types->xs__schema_.end(); ++i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
361 { bool found = false;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
362 vector<xs__schema*>::const_iterator j;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
363 if (!(*i)->targetNamespace)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
364 { (*i)->targetNamespace = targetNamespace;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
365 if (!Wflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
366 cerr << "Warning: schema without namespace, assigning namespace '" << (targetNamespace?targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
367 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
368 for (j = types->xs__schema_.begin(); j != types->xs__schema_.end(); ++j)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
369 { if ((*j)->targetNamespace && !strcmp((*i)->targetNamespace, (*j)->targetNamespace))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
370 { found = true;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
371 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
372 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
373 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
374 // add new schema only if not already in <types>, otherwise merge schema components
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
375 if (found)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
376 { if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
377 cerr << "Warning: duplicate schema with namespace '" << ((*i)->targetNamespace?(*i)->targetNamespace:"") << "' merged in WSDL '" << (name?name:"") << "' namespace '" << (targetNamespace?targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
378 (*j)->insert(*(*i));
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
379 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
380 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
381 { if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
382 cerr << "Adding schema with namespace '" << ((*i)->targetNamespace?(*i)->targetNamespace:"") << "' to types in WSDL '" << (name?name:"") << "' namespace '" << (targetNamespace?targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
383 types->xs__schema_.push_back(*i);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
384 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
385 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
386 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
387 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
388 // process the types
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
389 if (types)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
390 types->preprocess(*this);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
391 return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
392 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
393
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
394 int wsdl__definitions::traverse()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
395 { if (updated)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
396 return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
397 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
398 cerr << "Analyzing definitions '" << (name?name:"") << "' in wsdl namespace '" << (targetNamespace?targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
399 updated = true;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
400 if (!targetNamespace)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
401 { if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
402 cerr << "Warning: wsdl '" << (name?name:"") << "' has no targetNamespace" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
403 targetNamespace = soap_strdup(soap, "");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
404 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
405 // process import first
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
406 for (vector<wsdl__import>::iterator im = import.begin(); im != import.end(); ++im)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
407 (*im).traverse(*this);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
408 // then process the types
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
409 if (types)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
410 types->traverse(*this);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
411 // process messages before portType
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
412 for (vector<wsdl__message>::iterator mg = message.begin(); mg != message.end(); ++mg)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
413 (*mg).traverse(*this);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
414 // process portType before binding
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
415 for (vector<wsdl__portType>::iterator pt = portType.begin(); pt != portType.end(); ++pt)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
416 (*pt).traverse(*this);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
417 // process interface before binding WSDL 2.0
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
418 for (vector<wsdl__portType>::iterator in = interface_.begin(); in != interface_.end(); ++in)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
419 (*in).traverse(*this);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
420 // process binding
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
421 for (vector<wsdl__binding>::iterator bg = binding.begin(); bg != binding.end(); ++bg)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
422 (*bg).traverse(*this);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
423 // process service
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
424 for (vector<wsdl__service>::iterator sv = service.begin(); sv != service.end(); ++sv)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
425 (*sv).traverse(*this);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
426 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
427 cerr << "End of definitions '" << (name?name:"") << "' namespace '" << (targetNamespace?targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
428 for (std::vector<wsp__Policy>::iterator p = wsp__Policy_.begin(); p != wsp__Policy_.end(); ++p)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
429 (*p).traverse(*this);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
430 return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
431 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
432
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
433 const char *wsdl__definitions::sourceLocation()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
434 { return location;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
435 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
436
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
437 int wsdl__definitions::error()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
438 { return soap->error;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
439 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
440
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
441 void wsdl__definitions::print_fault()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
442 { soap_print_fault(soap, stderr);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
443 if (soap->error < 200)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
444 soap_print_fault_location(soap, stderr);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
445 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
446
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
447 void wsdl__definitions::builtinType(const char *type)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
448 { builtinTypeSet.insert(type);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
449 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
450
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
451 void wsdl__definitions::builtinTypes(const SetOfString& types)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
452 { for (SetOfString::const_iterator tp = types.begin(); tp != types.end(); ++tp)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
453 builtinTypeSet.insert(*tp);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
454 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
455
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
456 void wsdl__definitions::builtinElement(const char *element)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
457 { builtinElementSet.insert(element);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
458 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
459
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
460 void wsdl__definitions::builtinElements(const SetOfString& elements)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
461 { for (SetOfString::const_iterator el = elements.begin(); el != elements.end(); ++el)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
462 builtinElementSet.insert(*el);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
463 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
464
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
465 void wsdl__definitions::builtinAttribute(const char *attribute)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
466 { builtinAttributeSet.insert(attribute);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
467 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
468
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
469 void wsdl__definitions::builtinAttributes(const SetOfString& attributes)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
470 { for (SetOfString::const_iterator at = attributes.begin(); at != attributes.end(); ++at)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
471 builtinAttributeSet.insert(*at);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
472 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
473
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
474 const SetOfString& wsdl__definitions::builtinTypes() const
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
475 { return builtinTypeSet;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
476 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
477
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
478 const SetOfString& wsdl__definitions::builtinElements() const
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
479 { return builtinElementSet;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
480 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
481
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
482 const SetOfString& wsdl__definitions::builtinAttributes() const
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
483 { return builtinAttributeSet;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
484 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
485
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
486 int wsdl__service::traverse(wsdl__definitions& definitions)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
487 { if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
488 cerr << "Analyzing service '" << (name?name:"") << "' in wsdl namespace '" << (definitions.targetNamespace?definitions.targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
489 // process ports
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
490 for (vector<wsdl__port>::iterator pt = port.begin(); pt != port.end(); ++pt)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
491 (*pt).traverse(definitions);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
492 for (vector<wsdl__port>::iterator ep = endpoint.begin(); ep != endpoint.end(); ++ep)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
493 (*ep).traverse(definitions);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
494 for (vector<wsp__Policy>::iterator py = wsp__Policy_.begin(); py != wsp__Policy_.end(); ++py)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
495 (*py).traverse(definitions);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
496 for (vector<wsp__PolicyReference>::iterator pr = wsp__PolicyReference_.begin(); pr != wsp__PolicyReference_.end(); ++pr)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
497 (*pr).traverse(definitions);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
498 return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
499 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
500
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
501 wsdl__port::wsdl__port()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
502 { bindingRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
503 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
504
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
505 int wsdl__port::traverse(wsdl__definitions& definitions)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
506 { if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
507 cerr << " Analyzing service port/endpoint in wsdl namespace '" << (definitions.targetNamespace?definitions.targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
508 // search binding name
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
509 const char *token = qname_token(binding, definitions.targetNamespace);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
510 bindingRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
511 if (token)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
512 { for (vector<wsdl__binding>::iterator binding = definitions.binding.begin(); binding != definitions.binding.end(); ++binding)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
513 { if ((*binding).name && !strcmp((*binding).name, token))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
514 { bindingRef = &(*binding);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
515 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
516 cerr << " Found port/endpoint '" << (name?name:"") << "' binding '" << (token?token:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
517 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
518 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
519 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
520 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
521 if (!bindingRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
522 { for (vector<wsdl__import>::iterator import = definitions.import.begin(); import != definitions.import.end(); ++import)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
523 { wsdl__definitions *importdefinitions = (*import).definitionsPtr();
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
524 if (importdefinitions)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
525 { token = qname_token(binding, importdefinitions->targetNamespace);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
526 if (token)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
527 { for (vector<wsdl__binding>::iterator binding = importdefinitions->binding.begin(); binding != importdefinitions->binding.end(); ++binding)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
528 { if ((*binding).name && !strcmp((*binding).name, token))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
529 { bindingRef = &(*binding);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
530 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
531 cerr << " Found port/endpoint '" << (name?name:"") << "' binding '" << (token?token:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
532 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
533 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
534 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
535 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
536 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
537 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
538 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
539 if (!bindingRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
540 if (!Wflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
541 cerr << "Warning: no port/endpoint '" << (name?name:"") << "' binding '" << (binding?binding:"") << "' in wsdl definitions '" << (definitions.name?definitions.name:"") << "' namespace '" << (definitions.targetNamespace?definitions.targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
542 if (wsp__Policy_)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
543 wsp__Policy_->traverse(definitions);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
544 if (wsp__PolicyReference_)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
545 wsp__PolicyReference_->traverse(definitions);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
546 return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
547 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
548
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
549 void wsdl__port::bindingPtr(wsdl__binding *binding)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
550 { bindingRef = binding;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
551 if (!bindingRef && vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
552 cerr << "Warning: wsdl__port binding set to NULL" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
553 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
554
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
555 wsdl__binding *wsdl__port::bindingPtr() const
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
556 { return bindingRef;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
557 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
558
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
559 wsdl__binding::wsdl__binding()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
560 { portTypeRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
561 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
562
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
563 int wsdl__binding::traverse(wsdl__definitions& definitions)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
564 { const char *token;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
565 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
566 cerr << " Analyzing binding '" << (name?name:"") << "' in wsdl namespace '" << (definitions.targetNamespace?definitions.targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
567 portTypeRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
568 if (interface_) // WSDL 2.0
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
569 token = qname_token(interface_, definitions.targetNamespace);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
570 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
571 token = qname_token(type, definitions.targetNamespace);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
572 if (token)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
573 { for (vector<wsdl__portType>::iterator portType = definitions.portType.begin(); portType != definitions.portType.end(); ++portType)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
574 { if ((*portType).name && !strcmp((*portType).name, token))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
575 { portTypeRef = &(*portType);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
576 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
577 cerr << " Found binding '" << (name?name:"") << "' portType '" << (token?token:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
578 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
579 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
580 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
581 // WSDL 2.0
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
582 for (vector<wsdl__portType>::iterator i = definitions.interface_.begin(); i != definitions.interface_.end(); ++i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
583 { if ((*i).name && !strcmp((*i).name, token))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
584 { portTypeRef = &(*i);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
585 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
586 cerr << " Found binding '" << (name?name:"") << "' interface '" << (token?token:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
587 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
588 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
589 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
590 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
591 if (!portTypeRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
592 { for (vector<wsdl__import>::iterator import = definitions.import.begin(); import != definitions.import.end(); ++import)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
593 { wsdl__definitions *importdefinitions = (*import).definitionsPtr();
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
594 if (importdefinitions)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
595 { if (interface_) // WSDL 2.0
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
596 token = qname_token(interface_, importdefinitions->targetNamespace);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
597 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
598 token = qname_token(type, importdefinitions->targetNamespace);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
599 if (token)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
600 { for (vector<wsdl__portType>::iterator portType = importdefinitions->portType.begin(); portType != importdefinitions->portType.end(); ++portType)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
601 { if ((*portType).name && !strcmp((*portType).name, token))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
602 { portTypeRef = &(*portType);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
603 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
604 cerr << " Found binding '" << (name?name:"") << "' portType '" << (token?token:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
605 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
606 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
607 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
608 // WSDL 2.0
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
609 for (vector<wsdl__portType>::iterator i = importdefinitions->interface_.begin(); i != importdefinitions->interface_.end(); ++i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
610 { if ((*i).name && !strcmp((*i).name, token))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
611 { portTypeRef = &(*i);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
612 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
613 cerr << " Found binding '" << (name?name:"") << "' interface '" << (token?token:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
614 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
615 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
616 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
617 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
618 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
619 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
620 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
621 if (!portTypeRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
622 { if (!Wflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
623 { if (interface_)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
624 cerr << "Warning: no binding '" << (name?name:"") << "' interface '" << (interface_?interface_:"") << "' in wsdl definitions '" << (definitions.name?definitions.name:"") << "' namespace '" << (definitions.targetNamespace?definitions.targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
625 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
626 cerr << "Warning: no binding '" << (name?name:"") << "' portType '" << (type?type:"") << "' in wsdl definitions '" << (definitions.name?definitions.name:"") << "' namespace '" << (definitions.targetNamespace?definitions.targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
627 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
628 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
629 // WSDL 2.0
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
630 for (vector<wsdl__ext_fault>::iterator f = fault.begin(); f != fault.end(); ++f)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
631 (*f).traverse(definitions, portTypeRef);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
632 for (vector<wsdl__ext_operation>::iterator i = operation.begin(); i != operation.end(); ++i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
633 (*i).traverse(definitions, portTypeRef);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
634 for (vector<wsp__Policy>::iterator p = wsp__Policy_.begin(); p != wsp__Policy_.end(); ++p)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
635 (*p).traverse(definitions);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
636 for (vector<wsp__PolicyReference>::iterator r = wsp__PolicyReference_.begin(); r != wsp__PolicyReference_.end(); ++r)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
637 (*r).traverse(definitions);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
638 return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
639 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
640
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
641 void wsdl__binding::portTypePtr(wsdl__portType *portType)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
642 { portTypeRef = portType;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
643 if (!portTypeRef && vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
644 cerr << "Warning: wsdl__binding portType set to NULL" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
645 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
646
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
647 wsdl__portType *wsdl__binding::portTypePtr() const
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
648 { return portTypeRef;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
649 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
650
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
651 wsdl__ext_operation::wsdl__ext_operation()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
652 { operationRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
653 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
654
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
655 int wsdl__ext_operation::traverse(wsdl__definitions& definitions, wsdl__portType *portTypeRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
656 { if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
657 cerr << " Analyzing binding operation '" << (name?name:ref?ref:"") << "' in wsdl namespace '" << (definitions.targetNamespace?definitions.targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
658 if (input)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
659 input->traverse(definitions);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
660 if (output)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
661 output->traverse(definitions);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
662 for (vector<wsdl__ext_fault>::iterator f = fault.begin(); f != fault.end(); ++f)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
663 (*f).traverse(definitions, portTypeRef);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
664 // WSDL 2.0
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
665 for (vector<wsdl__ext_fault>::iterator fi = infault.begin(); fi != infault.end(); ++fi)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
666 (*fi).traverse(definitions, portTypeRef);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
667 for (vector<wsdl__ext_fault>::iterator fo = outfault.begin(); fo != outfault.end(); ++fo)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
668 (*fo).traverse(definitions, portTypeRef);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
669 operationRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
670 if (portTypeRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
671 { // WSDL 2.0, assumption: ref refers to an operation in the interface for this binding
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
672 const char *token = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
673 if (ref)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
674 token = qname_token(ref, portTypeRef->definitionsPtr()->targetNamespace);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
675 for (vector<wsdl__operation>::iterator i = portTypeRef->operation.begin(); i != portTypeRef->operation.end(); ++i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
676 { if (token)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
677 { if ((*i).name && !strcmp((*i).name, token))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
678 { operationRef = &(*i);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
679 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
680 cerr << " Found operation '" << token << "' in interface '" << portTypeRef->name << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
681 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
682 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
683 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
684 else if (name && (*i).name && !strcmp((*i).name, name))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
685 { if ((!input
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
686 || !input->name
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
687 || ((*i).__union1 == SOAP_UNION_wsdl__union_ioput_input && (*i).__ioput1.input->name && !strcmp((*i).__ioput1.input->name, input->name))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
688 || ((*i).__union2 == SOAP_UNION_wsdl__union_ioput_input && (*i).__ioput2.input->name && !strcmp((*i).__ioput2.input->name, input->name))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
689 )
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
690 && (!output
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
691 || !output->name
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
692 || ((*i).__union1 == SOAP_UNION_wsdl__union_ioput_output && (*i).__ioput1.output->name && !strcmp((*i).__ioput1.output->name, output->name))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
693 || ((*i).__union2 == SOAP_UNION_wsdl__union_ioput_output && (*i).__ioput2.output->name && !strcmp((*i).__ioput2.output->name, output->name))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
694 ))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
695 { operationRef = &(*i);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
696 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
697 cerr << " Found operation '" << name << "' in portType '" << portTypeRef->name << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
698 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
699 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
700 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
701 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
702 if (name && !operationRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
703 { for (vector<wsdl__operation>::iterator j = portTypeRef->operation.begin(); j != portTypeRef->operation.end(); ++j)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
704 { if ((*j).name && !strcmp((*j).name, name))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
705 { if (input
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
706 && input->name
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
707 && (((*j).__union1 == SOAP_UNION_wsdl__union_ioput_input && (*j).__ioput1.input->name && !strcmp((*j).__ioput1.input->name, input->name))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
708 || ((*j).__union2 == SOAP_UNION_wsdl__union_ioput_input && (*j).__ioput2.input->name && !strcmp((*j).__ioput2.input->name, input->name))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
709 ))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
710 cerr << "Warning: no matching portType operation input name '" << input->name << "' in wsdl definitions '" << (definitions.name?definitions.name:"") << "' namespace '" << (definitions.targetNamespace?definitions.targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
711 if (output
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
712 && output->name
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
713 && (((*j).__union1 == SOAP_UNION_wsdl__union_ioput_output && (*j).__ioput1.output->name && !strcmp((*j).__ioput1.output->name, output->name))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
714 || ((*j).__union2 == SOAP_UNION_wsdl__union_ioput_output && (*j).__ioput2.output->name && !strcmp((*j).__ioput2.output->name, output->name))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
715 ))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
716 cerr << "Warning: no matching portType operation output name '" << output->name << "' in wsdl definitions '" << (definitions.name?definitions.name:"") << "' namespace '" << (definitions.targetNamespace?definitions.targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
717 operationRef = &(*j);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
718 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
719 cerr << " Found operation '" << name << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
720 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
721 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
722 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
723 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
724 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
725 if (!operationRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
726 { if (!Wflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
727 { if (ref)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
728 cerr << "Warning: no matching interface operation '" << (ref?ref:"") << "' in wsdl definitions '" << (definitions.name?definitions.name:"") << "' namespace '" << (definitions.targetNamespace?definitions.targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
729 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
730 cerr << "Warning: no matching portType operation '" << (name?name:"") << "' in wsdl definitions '" << (definitions.name?definitions.name:"") << "' namespace '" << (definitions.targetNamespace?definitions.targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
731 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
732 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
733 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
734 { for (vector<wsdl__ext_fault>::iterator i = fault.begin(); i != fault.end(); ++i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
735 { if ((*i).name)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
736 { for (vector<wsdl__fault>::iterator j = operationRef->fault.begin(); j != operationRef->fault.end(); ++j)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
737 { if ((*j).name && !strcmp((*j).name, (*i).name))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
738 { (*i).faultPtr(&(*j));
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
739 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
740 cerr << " Found fault '" << (*j).name << "' message" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
741 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
742 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
743 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
744 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
745 else if ((*i).soap__fault_ && (*i).soap__fault_->name) // try the soap:fault name, this is not elegant, but neither is WSDL 1.1
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
746 { for (vector<wsdl__fault>::iterator j = operationRef->fault.begin(); j != operationRef->fault.end(); ++j)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
747 { if ((*j).name && !strcmp((*j).name, (*i).soap__fault_->name))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
748 { (*i).faultPtr(&(*j));
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
749 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
750 cerr << " Found fault '" << ((*j).name?(*j).name:"") << "' message" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
751 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
752 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
753 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
754 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
755 if (!(*i).faultPtr())
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
756 if (!Wflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
757 cerr << "Warning: no soap:fault '" << ((*i).name?(*i).name:"") << "' message in wsdl definitions '" << (definitions.name?definitions.name:"") << "' operation '" << (name?name:"") << "' namespace '" << (definitions.targetNamespace?definitions.targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
758 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
759 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
760 if (wsp__Policy_)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
761 wsp__Policy_->traverse(definitions);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
762 if (wsp__PolicyReference_)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
763 wsp__PolicyReference_->traverse(definitions);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
764 return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
765 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
766
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
767 void wsdl__ext_operation::operationPtr(wsdl__operation *operation)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
768 { operationRef = operation;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
769 if (!operationRef && vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
770 cerr << "Warning: wsdl__ext_operation operation set to NULL" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
771 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
772
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
773 wsdl__operation *wsdl__ext_operation::operationPtr() const
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
774 { return operationRef;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
775 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
776
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
777 int wsdl__ext_ioput::traverse(wsdl__definitions& definitions)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
778 { if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
779 cerr << " Analyzing binding operation input/output in wsdl namespace '" << (definitions.targetNamespace?definitions.targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
780 for (vector<soap__header>::iterator hd = soap__header_.begin(); hd != soap__header_.end(); ++hd)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
781 (*hd).traverse(definitions);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
782 for (vector<wsoap__header>::iterator whd = wsoap__header_.begin(); whd != wsoap__header_.end(); ++whd)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
783 (*whd).traverse(definitions);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
784 if (mime__multipartRelated_)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
785 mime__multipartRelated_->traverse(definitions);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
786 if (wsp__Policy_)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
787 wsp__Policy_->traverse(definitions);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
788 if (wsp__PolicyReference_)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
789 wsp__PolicyReference_->traverse(definitions);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
790 return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
791 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
792
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
793 wsdl__ext_fault::wsdl__ext_fault()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
794 { faultRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
795 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
796
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
797 int wsdl__ext_fault::traverse(wsdl__definitions& definitions, wsdl__portType *portTypeRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
798 { if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
799 cerr << " Analyzing binding operation fault in wsdl namespace '" << (definitions.targetNamespace?definitions.targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
800 if (ref && portTypeRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
801 { // WSDL 2.0, assumption: ref refers to a fault in the interface for this binding
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
802 const char *token = qname_token(ref, portTypeRef->definitionsPtr()->targetNamespace);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
803 if (token)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
804 { for (vector<wsdl__fault>::iterator fault = portTypeRef->fault.begin(); fault != portTypeRef->fault.end(); ++fault)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
805 { if ((*fault).name && !strcmp((*fault).name, token))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
806 { faultRef = &(*fault);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
807 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
808 cerr << " Found fault '" << (*fault).name << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
809 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
810 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
811 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
812 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
813 if (!faultRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
814 if (!Wflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
815 cerr << "Warning: no fault '" << (ref?ref:"") << "' in wsdl definitions '" << (definitions.name?definitions.name:"") << "' interface '" << (portTypeRef->name?portTypeRef->name:"") << "' namespace '" << (definitions.targetNamespace?definitions.targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
816 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
817 if (wsp__Policy_)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
818 wsp__Policy_->traverse(definitions);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
819 if (wsp__PolicyReference_)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
820 wsp__PolicyReference_->traverse(definitions);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
821 return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
822 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
823
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
824 void wsdl__ext_fault::faultPtr(wsdl__fault *fault)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
825 { faultRef = fault;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
826 if (!faultRef && vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
827 cerr << "Warning: wsdl__ext_fault fault ref set to NULL" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
828 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
829
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
830 wsdl__fault *wsdl__ext_fault::faultPtr() const
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
831 { return faultRef;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
832 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
833
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
834 wsdl__portType::wsdl__portType()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
835 { definitionsRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
836 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
837
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
838 int wsdl__portType::traverse(wsdl__definitions& definitions)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
839 { if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
840 cerr << " Analyzing portType/interface '" << (name?name:"") << "' in wsdl namespace '" << (definitions.targetNamespace?definitions.targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
841 definitionsRef = &definitions;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
842 // traverse faults before operations, WSDL 2.0
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
843 for (vector<wsdl__fault>::iterator f = fault.begin(); f != fault.end(); ++f)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
844 (*f).traverse(definitions);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
845 for (vector<wsdl__operation>::iterator i = operation.begin(); i != operation.end(); ++i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
846 (*i).traverse(definitions);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
847 if (wsp__Policy_)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
848 wsp__Policy_->traverse(definitions);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
849 if (wsp__PolicyReference_)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
850 wsp__PolicyReference_->traverse(definitions);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
851 return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
852 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
853
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
854 void wsdl__portType::definitionsPtr(wsdl__definitions *definitions)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
855 { definitionsRef = definitions;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
856 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
857
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
858 wsdl__definitions *wsdl__portType::definitionsPtr() const
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
859 { return definitionsRef;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
860 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
861
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
862 int wsdl__operation::traverse(wsdl__definitions& definitions)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
863 { if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
864 cerr << " Analyzing portType/interface operation '" << (name?name:"") << "' in wsdl namespace '" << (definitions.targetNamespace?definitions.targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
865 if (__union1 == SOAP_UNION_wsdl__union_ioput_input)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
866 if (__ioput1.input)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
867 __ioput1.input->traverse(definitions);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
868 if (__union1 == SOAP_UNION_wsdl__union_ioput_output)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
869 if (__ioput1.output)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
870 __ioput1.output->traverse(definitions);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
871 if (__union2 == SOAP_UNION_wsdl__union_ioput_input)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
872 if (__ioput2.input)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
873 __ioput2.input->traverse(definitions);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
874 if (__union2 == SOAP_UNION_wsdl__union_ioput_output)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
875 if (__ioput2.output)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
876 __ioput2.output->traverse(definitions);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
877 for (vector<wsdl__fault>::iterator i = fault.begin(); i != fault.end(); ++i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
878 (*i).traverse(definitions);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
879 // WSDL 2.0
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
880 for (vector<wsdl__fault>::iterator fi = infault.begin(); fi != infault.end(); ++fi)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
881 (*fi).traverse(definitions);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
882 for (vector<wsdl__fault>::iterator fo = outfault.begin(); fo != outfault.end(); ++fo)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
883 (*fo).traverse(definitions);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
884 if (wsp__Policy_)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
885 wsp__Policy_->traverse(definitions);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
886 if (wsp__PolicyReference_)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
887 wsp__PolicyReference_->traverse(definitions);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
888 return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
889 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
890
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
891 wsdl__ioput::wsdl__ioput()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
892 { messageRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
893 elementRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
894 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
895
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
896 int wsdl__ioput::traverse(wsdl__definitions& definitions)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
897 { if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
898 cerr << " Analyzing portType/interface operation input/output in wsdl namespace '" << (definitions.targetNamespace?definitions.targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
899 messageRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
900 elementRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
901 // WSDL 2.0
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
902 if (element)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
903 { if (definitions.types)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
904 { for (vector<xs__schema*>::iterator schema = definitions.types->xs__schema_.begin(); schema != definitions.types->xs__schema_.end(); ++schema)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
905 { const char *token = qname_token(element, (*schema)->targetNamespace);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
906 if (token)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
907 { for (vector<xs__element>::iterator element = (*schema)->element.begin(); element != (*schema)->element.end(); ++element)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
908 { if ((*element).name && !strcmp((*element).name, token))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
909 { elementRef = &(*element);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
910 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
911 cerr << " Found input/output '" << (messageLabel?messageLabel:"") << "' element '" << (token?token:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
912 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
913 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
914 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
915 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
916 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
917 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
918 if (*element != '#' && !elementRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
919 { if (is_builtin_qname(element))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
920 definitions.builtinElement(element);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
921 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
922 if (!Wflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
923 cerr << "Warning: no input/output '" << (messageLabel?messageLabel:"") << "' element '" << element << "' in wsdl definitions '" << (definitions.name?definitions.name:"") << "' namespace '" << (definitions.targetNamespace?definitions.targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
924 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
925 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
926 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
927 { const char *token = qname_token(message, definitions.targetNamespace);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
928 if (token)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
929 { for (vector<wsdl__message>::iterator message = definitions.message.begin(); message != definitions.message.end(); ++message)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
930 { if ((*message).name && !strcmp((*message).name, token))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
931 { messageRef = &(*message);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
932 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
933 cerr << " Found input/output '" << (name?name:"") << "' message '" << (token?token:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
934 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
935 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
936 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
937 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
938 if (!messageRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
939 { for (vector<wsdl__import>::iterator import = definitions.import.begin(); import != definitions.import.end(); ++import)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
940 { wsdl__definitions *importdefinitions = (*import).definitionsPtr();
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
941 if (importdefinitions)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
942 { token = qname_token(message, importdefinitions->targetNamespace);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
943 if (token)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
944 { for (vector<wsdl__message>::iterator message = importdefinitions->message.begin(); message != importdefinitions->message.end(); ++message)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
945 { if ((*message).name && !strcmp((*message).name, token))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
946 { messageRef = &(*message);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
947 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
948 cerr << " Found input/output '" << (name?name:"") << "' message '" << (token?token:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
949 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
950 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
951 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
952 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
953 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
954 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
955 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
956 if (!messageRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
957 if (!Wflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
958 cerr << "Warning: no input/output '" << (name?name:"") << "' message '" << (message?message:"") << "' in wsdl definitions '" << (definitions.name?definitions.name:"") << "' namespace '" << (definitions.targetNamespace?definitions.targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
959 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
960 if (wsp__Policy_)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
961 wsp__Policy_->traverse(definitions);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
962 if (wsp__PolicyReference_)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
963 wsp__PolicyReference_->traverse(definitions);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
964 return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
965 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
966
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
967 void wsdl__ioput::messagePtr(wsdl__message *message)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
968 { messageRef = message;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
969 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
970
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
971 wsdl__message *wsdl__ioput::messagePtr() const
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
972 { return messageRef;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
973 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
974
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
975 void wsdl__ioput::elementPtr(xs__element *element)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
976 { elementRef = element;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
977 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
978
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
979 xs__element *wsdl__ioput::elementPtr() const
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
980 { return elementRef;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
981 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
982
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
983 wsdl__fault::wsdl__fault()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
984 { messageRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
985 elementRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
986 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
987
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
988 int wsdl__fault::traverse(wsdl__definitions& definitions)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
989 { if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
990 cerr << " Analyzing portType/interface operation faults in wsdl namespace '" << (definitions.targetNamespace?definitions.targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
991 messageRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
992 elementRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
993 // WSDL 2.0
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
994 if (ref)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
995 { const char *token = qname_token(ref, definitions.targetNamespace);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
996 if (token)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
997 { for (vector<wsdl__portType>::iterator i = definitions.interface_.begin(); i != definitions.interface_.end(); ++i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
998 { for (vector<wsdl__fault>::iterator fault = (*i).fault.begin(); fault != (*i).fault.end(); ++fault)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
999 { if ((*fault).name && !strcmp((*fault).name, token))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1000 { elementRef = (*fault).elementPtr();
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1001 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1002 cerr << " Found fault '" << (ref?ref:"") << "' element '" << (token?token:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1003 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1004 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1005 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1006 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1007 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1008 if (!elementRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1009 { for (vector<wsdl__import>::iterator import = definitions.import.begin(); import != definitions.import.end(); ++import)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1010 { wsdl__definitions *importdefinitions = (*import).definitionsPtr();
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1011 if (importdefinitions)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1012 { token = qname_token(message, importdefinitions->targetNamespace);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1013 if (token)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1014 { for (vector<wsdl__portType>::iterator i = importdefinitions->interface_.begin(); i != importdefinitions->interface_.end(); ++i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1015 { for (vector<wsdl__fault>::iterator fault = (*i).fault.begin(); fault != (*i).fault.end(); ++fault)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1016 { if ((*fault).name && !strcmp((*fault).name, token))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1017 { elementRef = (*fault).elementPtr();
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1018 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1019 cerr << " Found fault '" << (ref?ref:"") << "' element '" << (token?token:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1020 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1021 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1022 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1023 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1024 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1025 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1026 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1027 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1028 if (!elementRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1029 { if (is_builtin_qname(element))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1030 definitions.builtinElement(element);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1031 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1032 if (!Wflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1033 cerr << "Warning: no fault '" << (messageLabel?messageLabel:"") << "' ref '" << ref << "' in wsdl definitions '" << (definitions.name?definitions.name:"") << "' namespace '" << (definitions.targetNamespace?definitions.targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1034 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1035 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1036 else if (element)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1037 { if (definitions.types)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1038 { for (vector<xs__schema*>::iterator schema = definitions.types->xs__schema_.begin(); schema != definitions.types->xs__schema_.end(); ++schema)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1039 { const char *token = qname_token(element, (*schema)->targetNamespace);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1040 if (token)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1041 { for (vector<xs__element>::iterator element = (*schema)->element.begin(); element != (*schema)->element.end(); ++element)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1042 { if ((*element).name && !strcmp((*element).name, token))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1043 { elementRef = &(*element);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1044 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1045 cerr << " Found fault '" << (messageLabel?messageLabel:"") << "' element '" << (token?token:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1046 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1047 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1048 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1049 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1050 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1051 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1052 if (!elementRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1053 { if (is_builtin_qname(element))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1054 definitions.builtinElement(element);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1055 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1056 if (!Wflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1057 cerr << "Warning: no fault '" << (messageLabel?messageLabel:"") << "' element '" << element << "' in wsdl definitions '" << (definitions.name?definitions.name:"") << "' namespace '" << (definitions.targetNamespace?definitions.targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1058 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1059 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1060 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1061 { const char *token = qname_token(message, definitions.targetNamespace);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1062 if (token)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1063 { for (vector<wsdl__message>::iterator message = definitions.message.begin(); message != definitions.message.end(); ++message)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1064 { if ((*message).name && !strcmp((*message).name, token))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1065 { messageRef = &(*message);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1066 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1067 cerr << " Found operation fault '" << (name?name:"") << "' message '" << (token?token:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1068 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1069 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1070 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1071 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1072 if (!messageRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1073 { for (vector<wsdl__import>::iterator import = definitions.import.begin(); import != definitions.import.end(); ++import)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1074 { wsdl__definitions *importdefinitions = (*import).definitionsPtr();
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1075 if (importdefinitions)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1076 { token = qname_token(message, importdefinitions->targetNamespace);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1077 if (token)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1078 { for (vector<wsdl__message>::iterator message = importdefinitions->message.begin(); message != importdefinitions->message.end(); ++message)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1079 { if ((*message).name && !strcmp((*message).name, token))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1080 { messageRef = &(*message);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1081 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1082 cerr << " Found operation fault '" << (name?name:"") << "' message '" << (token?token:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1083 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1084 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1085 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1086 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1087 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1088 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1089 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1090 if (!messageRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1091 if (!Wflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1092 cerr << "Warning: no operation fault '" << (name?name:"") << "' message '" << (message?message:"") << "' in wsdl definitions '" << (definitions.name?definitions.name:"") << "' namespace '" << (definitions.targetNamespace?definitions.targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1093 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1094 if (wsp__Policy_)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1095 wsp__Policy_->traverse(definitions);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1096 if (wsp__PolicyReference_)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1097 wsp__PolicyReference_->traverse(definitions);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1098 return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1099 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1100
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1101 void wsdl__fault::messagePtr(wsdl__message *message)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1102 { messageRef = message;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1103 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1104
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1105 wsdl__message *wsdl__fault::messagePtr() const
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1106 { return messageRef;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1107 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1108
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1109 void wsdl__fault::elementPtr(xs__element *element)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1110 { elementRef = element;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1111 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1112
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1113 xs__element *wsdl__fault::elementPtr() const
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1114 { return elementRef;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1115 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1116
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1117 int wsdl__message::traverse(wsdl__definitions& definitions)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1118 { if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1119 cerr << " Analyzing message '" << (name?name:"") << "' in wsdl namespace '" << (definitions.targetNamespace?definitions.targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1120 for (vector<wsdl__part>::iterator i = part.begin(); i != part.end(); ++i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1121 (*i).traverse(definitions);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1122 for (vector<wsp__Policy>::iterator p = wsp__Policy_.begin(); p != wsp__Policy_.end(); ++p)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1123 (*p).traverse(definitions);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1124 for (vector<wsp__PolicyReference>::iterator r = wsp__PolicyReference_.begin(); r != wsp__PolicyReference_.end(); ++r)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1125 (*r).traverse(definitions);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1126 return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1127 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1128
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1129 wsdl__part::wsdl__part()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1130 { elementRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1131 simpleTypeRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1132 complexTypeRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1133 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1134
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1135 int wsdl__part::traverse(wsdl__definitions& definitions)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1136 { if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1137 cerr << " Analyzing message parts in wsdl namespace '" << (definitions.targetNamespace?definitions.targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1138 elementRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1139 simpleTypeRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1140 complexTypeRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1141 if (definitions.types)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1142 { for (vector<xs__schema*>::iterator schema = definitions.types->xs__schema_.begin(); schema != definitions.types->xs__schema_.end(); ++schema)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1143 { const char *token = qname_token(element, (*schema)->targetNamespace);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1144 if (token)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1145 { for (vector<xs__element>::iterator element = (*schema)->element.begin(); element != (*schema)->element.end(); ++element)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1146 { if ((*element).name && !strcmp((*element).name, token))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1147 { elementRef = &(*element);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1148 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1149 cerr << " Found message part '" << (name?name:"") << "' element '" << (token?token:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1150 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1151 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1152 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1153 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1154 token = qname_token(type, (*schema)->targetNamespace);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1155 if (token)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1156 { for (vector<xs__simpleType>::iterator simpleType = (*schema)->simpleType.begin(); simpleType != (*schema)->simpleType.end(); ++simpleType)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1157 { if ((*simpleType).name && !strcmp((*simpleType).name, token))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1158 { simpleTypeRef = &(*simpleType);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1159 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1160 cerr << " Found message part '" << (name?name:"") << "' simpleType '" << (token?token:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1161 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1162 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1163 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1164 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1165 token = qname_token(type, (*schema)->targetNamespace);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1166 if (token)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1167 { for (vector<xs__complexType>::iterator complexType = (*schema)->complexType.begin(); complexType != (*schema)->complexType.end(); ++complexType)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1168 { if ((*complexType).name && !strcmp((*complexType).name, token))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1169 { complexTypeRef = &(*complexType);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1170 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1171 cerr << " Found message part '" << (name?name:"") << "' complexType '" << (token?token:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1172 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1173 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1174 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1175 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1176 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1177 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1178 if (!elementRef && !simpleTypeRef && !complexTypeRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1179 { if (element)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1180 { if (is_builtin_qname(element))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1181 definitions.builtinElement(element);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1182 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1183 if (!Wflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1184 cerr << "Warning: no message part '" << (name?name:"") << "' element '" << element << "' in wsdl definitions '" << (definitions.name?definitions.name:"") << "' namespace '" << (definitions.targetNamespace?definitions.targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1185 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1186 else if (type)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1187 { if (is_builtin_qname(type))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1188 definitions.builtinType(type);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1189 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1190 if (!Wflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1191 cerr << "Warning: no message part '" << (name?name:"") << "' type '" << type << "' in wsdl definitions '" << (definitions.name?definitions.name:"") << "' namespace '" << (definitions.targetNamespace?definitions.targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1192 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1193 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1194 if (!Wflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1195 cerr << "Warning: no message part '" << (name?name:"") << "' element or type in wsdl definitions '" << (definitions.name?definitions.name:"") << "' namespace '" << (definitions.targetNamespace?definitions.targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1196 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1197 return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1198 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1199
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1200 void wsdl__part::elementPtr(xs__element *element)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1201 { elementRef = element;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1202 if (!elementRef && vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1203 cerr << "Warning: wsdl__part element set to NULL" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1204 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1205
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1206 void wsdl__part::simpleTypePtr(xs__simpleType *simpleType)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1207 { simpleTypeRef = simpleType;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1208 if (!simpleTypeRef && vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1209 cerr << "Warning: wsdl__part simpleType set to NULL" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1210 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1211
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1212 void wsdl__part::complexTypePtr(xs__complexType *complexType)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1213 { complexTypeRef = complexType;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1214 if (!complexTypeRef && vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1215 cerr << "Warning: wsdl__part complexType set to NULL" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1216 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1217
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1218 xs__element *wsdl__part::elementPtr() const
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1219 { return elementRef;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1220 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1221
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1222 xs__simpleType *wsdl__part::simpleTypePtr() const
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1223 { return simpleTypeRef;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1224 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1225
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1226 xs__complexType *wsdl__part::complexTypePtr() const
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1227 { return complexTypeRef;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1228 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1229
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1230 int wsdl__types::preprocess(wsdl__definitions& definitions)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1231 { if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1232 cerr << "Preprocessing wsdl types" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1233 if (!empty()) // WSDL 2.0 <types>
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1234 { targetNamespace = definitions.targetNamespace;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1235 xs__schema_.push_back(this);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1236 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1237 // set the location of each schema in <types> to the WSDL's location
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1238 for (vector<xs__schema*>::iterator schema0 = xs__schema_.begin(); schema0 != xs__schema_.end(); ++schema0)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1239 { if (!(*schema0)->sourceLocation())
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1240 (*schema0)->sourceLocation(definitions.sourceLocation());
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1241 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1242 again:
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1243 // link imported schemas, need to repeat when <types> is extended with new imported schema (from inside another schema, etc.)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1244 for (vector<xs__schema*>::iterator schema1 = xs__schema_.begin(); schema1 != xs__schema_.end(); ++schema1)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1245 { for (vector<xs__import>::iterator import = (*schema1)->import.begin(); import != (*schema1)->import.end(); ++import)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1246 { if ((*import).namespace_ && !(*import).schemaPtr() && strcmp((*import).namespace_, targetNamespace))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1247 { for (vector<xs__schema*>::const_iterator schema2 = xs__schema_.begin(); schema2 != xs__schema_.end(); ++schema2)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1248 { if (schema2 != schema1 && (*schema2)->targetNamespace && !strcmp((*import).namespace_, (*schema2)->targetNamespace))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1249 { (*import).schemaPtr(*schema2);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1250 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1251 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1252 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1253 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1254 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1255 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1256 // if a schema is imported but not in <types> then get it
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1257 for (vector<xs__schema*>::iterator schema2 = xs__schema_.begin(); schema2 != xs__schema_.end(); ++schema2)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1258 { for (vector<xs__import>::iterator import = (*schema2)->import.begin(); import != (*schema2)->import.end(); ++import)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1259 { bool found = false;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1260 if ((*import).schemaPtr())
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1261 found = true;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1262 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1263 cerr << "Preprocessing schema '" << (*schema2)->targetNamespace << "' import '" << ((*import).namespace_?(*import).namespace_:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1264 if (!found && (*import).namespace_)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1265 { if ((*import).schemaPtr())
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1266 found = true;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1267 else if (strcmp((*import).namespace_, targetNamespace))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1268 { for (vector<xs__schema*>::const_iterator schema3 = xs__schema_.begin(); schema3 != xs__schema_.end(); ++schema3)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1269 { if (schema3 != schema2 && (*schema3)->targetNamespace && !strcmp((*import).namespace_, (*schema3)->targetNamespace))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1270 { found = true;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1271 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1272 cerr << "Schema '" << (*schema2)->targetNamespace << "' already found and present" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1273 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1274 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1275 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1276 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1277 if (!found)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1278 { for (SetOfString::const_iterator i = exturis.begin(); i != exturis.end(); ++i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1279 { if (!soap_tag_cmp((*import).namespace_, *i))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1280 { found = true;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1281 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1282 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1283 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1284 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1285 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1286 if (!found && !iflag) // don't import any of the schemas in the .nsmap table (or when -i option is used)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1287 { xs__schema *importschema;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1288 importschema = (*import).schemaPtr();
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1289 if (!importschema)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1290 { const char *s = (*import).schemaLocation;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1291 if (!s)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1292 s = (*import).namespace_;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1293 if (!s)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1294 continue;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1295 importschema = new xs__schema(definitions.soap, (*schema2)->sourceLocation(), s);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1296 if (!(*import).namespace_)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1297 { if ((*schema2)->targetNamespace)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1298 (*import).namespace_ = (*schema2)->targetNamespace;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1299 else if (importschema->targetNamespace)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1300 (*import).namespace_ = importschema->targetNamespace;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1301 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1302 (*import).namespace_ = soap_strdup(definitions.soap, "");
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1303 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1304 if (!importschema->targetNamespace || !*importschema->targetNamespace)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1305 importschema->targetNamespace = (*import).namespace_;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1306 else if ((*import).namespace_ && strcmp(importschema->targetNamespace, (*import).namespace_))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1307 cerr << "Schema import namespace '" << ((*import).namespace_?(*import).namespace_:"") << "' does not correspond to imported namespace '" << importschema->targetNamespace << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1308 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1309 if (strcmp((*import).namespace_, targetNamespace))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1310 { for (vector<xs__schema*>::const_iterator schema3 = xs__schema_.begin(); schema3 != xs__schema_.end(); ++schema3)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1311 { if (schema3 != schema2 && (*schema3)->targetNamespace && !strcmp((*import).namespace_, (*schema3)->targetNamespace))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1312 { found = true;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1313 (*import).schemaPtr(*schema3);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1314 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1315 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1316 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1317 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1318 if (!found)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1319 { (*import).schemaPtr(importschema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1320 xs__schema_.push_back(importschema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1321 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1322 cerr << "Adding schema '" << importschema->targetNamespace << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1323 goto again;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1324 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1325 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1326 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1327 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1328 return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1329 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1330
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1331 int wsdl__types::traverse(wsdl__definitions& definitions)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1332 { if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1333 cerr << " Analyzing types in wsdl namespace '" << (definitions.targetNamespace?definitions.targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1334 for (vector<xs__schema*>::iterator schema3 = xs__schema_.begin(); schema3 != xs__schema_.end(); ++schema3)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1335 { // artificially extend the <import> of each schema to include others so when we traverse schemas we can resolve references
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1336 for (vector<xs__schema*>::iterator importschema = xs__schema_.begin(); importschema != xs__schema_.end(); ++importschema)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1337 { if (schema3 != importschema && (*importschema)->targetNamespace)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1338 { xs__import *import = soap_new_xs__import(definitions.soap, -1);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1339 import->namespace_ = (*importschema)->targetNamespace;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1340 import->schemaPtr(*importschema);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1341 (*schema3)->import.push_back(*import);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1342 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1343 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1344 // check and report
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1345 for (vector<xs__import>::iterator import = (*schema3)->import.begin(); import != (*schema3)->import.end(); ++import)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1346 { if ((*import).namespace_)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1347 { bool found = false;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1348 for (vector<xs__schema*>::const_iterator importschema = xs__schema_.begin(); importschema != xs__schema_.end(); ++importschema)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1349 { if ((*importschema)->targetNamespace && !strcmp((*import).namespace_, (*importschema)->targetNamespace))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1350 { found = true;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1351 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1352 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1353 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1354 if (!found && vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1355 cerr << "Schema import namespace '" << (*import).namespace_ << "' refers to an unknown Schema" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1356 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1357 else if (!Wflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1358 cerr << "Warning: schema import '" << ((*import).schemaLocation ? (*import).schemaLocation : "") << "' has no namespace" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1359 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1360 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1361 // traverse the schemas
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1362 for (vector<xs__schema*>::iterator schema4 = xs__schema_.begin(); schema4 != xs__schema_.end(); ++schema4)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1363 (*schema4)->traverse();
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1364 // find all built-in types, elements, and attributes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1365 for (vector<xs__schema*>::iterator schema5 = xs__schema_.begin(); schema5 != xs__schema_.end(); ++schema5)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1366 { if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1367 for (SetOfString::const_iterator i = (*schema5)->builtinTypes().begin(); i != (*schema5)->builtinTypes().end(); ++i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1368 cerr << " Built-in schema type '" << (*i) << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1369 definitions.builtinTypes((*schema5)->builtinTypes());
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1370 definitions.builtinElements((*schema5)->builtinElements());
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1371 definitions.builtinAttributes((*schema5)->builtinAttributes());
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1372 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1373 return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1374 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1375
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1376 int wsdl__import::preprocess(wsdl__definitions& definitions)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1377 { static map<const char*, wsdl__definitions*, ltstr> included;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1378 bool found = false;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1379 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1380 cerr << "Preprocess wsdl import '" << (location?location:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1381 definitionsRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1382 if (namespace_)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1383 { for (SetOfString::const_iterator i = exturis.begin(); i != exturis.end(); ++i)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1384 { if (!soap_tag_cmp(namespace_, *i))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1385 { found = true;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1386 break;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1387 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1388 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1389 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1390 if (!found && location)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1391 { map<const char*, wsdl__definitions*, ltstr>::iterator i = included.find(location);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1392 if (i != included.end())
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1393 { if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1394 fprintf(stderr, "\nWSDL/XSD '%s' already imported\n", location);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1395 found = true;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1396 definitionsRef = (*i).second;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1397 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1398 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1399 if (!found && location)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1400 { // parse imported definitions
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1401 const char *source = definitions.sourceLocation();
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1402 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1403 cerr << "Importing '" << location << "' into '" << (source?source:"(source location not set)") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1404 included[location] = definitionsRef = new wsdl__definitions(definitions.soap, source, location);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1405 if (!definitionsRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1406 return SOAP_EOF;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1407 if (!namespace_)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1408 namespace_ = definitionsRef->targetNamespace;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1409 else if (!definitionsRef->targetNamespace || !*definitionsRef->targetNamespace)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1410 definitionsRef->targetNamespace = namespace_;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1411 else if (strcmp(namespace_, definitionsRef->targetNamespace))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1412 cerr << "Error: wsdl definitions/import '" << location << "' namespace '" << namespace_ << "' does not match imported targetNamespace '" << definitionsRef->targetNamespace << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1413 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1414 else if (!location)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1415 cerr << "Warning: wsdl definitions/import has no location attribute" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1416 return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1417 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1418
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1419 int wsdl__import::traverse(wsdl__definitions& definitions)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1420 { if (definitionsRef)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1421 { if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1422 cerr << " Analyzing imported wsdl namespace '" << (namespace_?namespace_:"") << "' in wsdl namespace '" << (definitions.targetNamespace?definitions.targetNamespace:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1423 // process import first
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1424 for (vector<wsdl__import>::iterator im = definitionsRef->import.begin(); im != definitionsRef->import.end(); ++im)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1425 (*im).traverse(definitions);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1426 // then process the types
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1427 if (definitionsRef->types)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1428 definitionsRef->types->traverse(definitions);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1429 // process messages before portTypes
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1430 for (vector<wsdl__message>::iterator mg = definitionsRef->message.begin(); mg != definitionsRef->message.end(); ++mg)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1431 (*mg).traverse(definitions);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1432 // process portTypes before bindings
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1433 for (vector<wsdl__portType>::iterator pt = definitionsRef->portType.begin(); pt != definitionsRef->portType.end(); ++pt)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1434 (*pt).traverse(definitions);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1435 // process bindings
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1436 for (vector<wsdl__binding>::iterator bg = definitionsRef->binding.begin(); bg != definitionsRef->binding.end(); ++bg)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1437 (*bg).traverse(definitions);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1438 // process services
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1439 for (vector<wsdl__service>::iterator sv = definitionsRef->service.begin(); sv != definitionsRef->service.end(); ++sv)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1440 (*sv).traverse(definitions);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1441 if (vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1442 cerr << " End of imported wsdl namespace '" << (namespace_?namespace_:"") << "'" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1443 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1444 return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1445 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1446
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1447 void wsdl__import::definitionsPtr(wsdl__definitions *definitions)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1448 { definitionsRef = definitions;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1449 if (!definitionsRef && vflag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1450 cerr << "Warning: wsdl__import definitions set to NULL" << endl;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1451 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1452
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1453 wsdl__definitions *wsdl__import::definitionsPtr() const
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1454 { return definitionsRef;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1455 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1456
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1457 wsdl__import::wsdl__import()
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1458 { definitionsRef = NULL;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1459 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1460
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1461 ////////////////////////////////////////////////////////////////////////////////
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1462 //
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1463 // streams
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1464 //
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1465 ////////////////////////////////////////////////////////////////////////////////
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1466
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1467 ostream &operator<<(ostream &o, const wsdl__definitions &e)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1468 { if (!e.soap)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1469 { struct soap soap;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1470 soap_init2(&soap, SOAP_IO_DEFAULT, SOAP_XML_TREE | SOAP_C_UTFSTRING);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1471 soap_set_namespaces(&soap, namespaces);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1472 e.soap_serialize(&soap);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1473 soap_begin_send(&soap);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1474 e.soap_out(&soap, "wsdl:definitions", 0, NULL);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1475 soap_end_send(&soap);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1476 soap_destroy(&soap);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1477 soap_end(&soap);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1478 soap_done(&soap);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1479 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1480 else
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1481 { ostream *os = e.soap->os;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1482 e.soap->os = &o;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1483 e.soap_serialize(e.soap);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1484 soap_begin_send(e.soap);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1485 e.soap_out(e.soap, "wsdl:definitions", 0, NULL);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1486 soap_end_send(e.soap);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1487 e.soap->os = os;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1488 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1489 return o;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1490 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1491
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1492 istream &operator>>(istream &i, wsdl__definitions &e)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1493 { if (!e.soap)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1494 { e.soap = soap_new1(SOAP_XML_TREE | SOAP_C_UTFSTRING);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1495 soap_set_namespaces(e.soap, namespaces);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1496 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1497 istream *is = e.soap->is;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1498 e.soap->is = &i;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1499 if (soap_begin_recv(e.soap)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1500 || !e.soap_in(e.soap, "wsdl:", NULL)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1501 || soap_end_recv(e.soap))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1502 { // handle error? Note: e.soap->error is set and app should check
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1503 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1504 e.soap->is = is;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1505 return i;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1506 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1507
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1508 ////////////////////////////////////////////////////////////////////////////////
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1509 //
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1510 // Miscellaneous
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1511 //
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1512 ////////////////////////////////////////////////////////////////////////////////
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1513
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1514 extern "C" {
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1515
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1516 int warn_ignore(struct soap *soap, const char *tag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1517 { // We don't warn if the omitted element was an annotation or a documentation in an unexpected place
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1518 if (soap->mustUnderstand)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1519 fprintf(stderr, "Error: element '%s' at level %d must be understood\n", tag, soap->level);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1520 if (!Wflag
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1521 && soap_match_tag(soap, tag, "xs:annotation")
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1522 && soap_match_tag(soap, tag, "xs:documentation")
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1523 && soap_match_tag(soap, tag, "xs:appinfo"))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1524 fprintf(stderr, "Warning: unexpected element '%s' at level %d is skipped (safe to ignore)\n", tag, soap->level);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1525 if (soap->body && !soap_string_in(soap, 0, -1, -1))
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1526 return soap->error;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1527 return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1528 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1529
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1530 int show_ignore(struct soap *soap, const char *tag)
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1531 { warn_ignore(soap, tag);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1532 soap_print_fault_location(soap, stderr);
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1533 return SOAP_OK;
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1534 }
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1535
8300eb051bea Initial upload
ktnyt
parents:
diff changeset
1536 } // end extern "C"