source: branches/PublicaMundi_David_integration_01-devel/zoo-project/zoo-kernel/response_print.h @ 677

Last change on this file since 677 was 677, checked in by david, 9 years ago
  • add add zcfg files loading
  • Property svn:keywords set to Id
File size: 6.6 KB
Line 
1/*
2 * Author : Gérald FENOY
3 *
4 * Copyright (c) 2009-2013 GeoLabs SARL
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
23 */
24
25#ifndef ZOO_RESPONSE_PRINT_H
26#define ZOO_RESPONSE_PRINT_H 1
27
28#pragma once
29
30/**
31 * The default service url (overriden by serverAddress)
32 */
33#define DEFAULT_SERVICE_URL "http://www.zoo-project.org/"
34/**
35 * The time size
36 */
37#define TIME_SIZE 40
38
39#include <libintl.h>
40#include <locale.h>
41/**
42 * ZOO-Kernel internal messages translation function
43 */
44#define _(String) dgettext ("zoo-kernel",String)
45/**
46 * ZOO-Services messages translation function
47 */
48#define _ss(String) dgettext ("zoo-services",String)
49
50/**
51 * ZOO-Kernel was unable to create a lock
52 */
53#define ZOO_LOCK_CREATE_FAILED -4
54/**
55 * ZOO-Kernel was unable to acquire a lock
56 */
57#define ZOO_LOCK_ACQUIRE_FAILED -5
58/**
59 * ZOO-Kernel was unable to release a lock
60 */
61#define ZOO_LOCK_RELEASE_FAILED -6
62#include <sys/stat.h>
63#include <sys/types.h>
64#ifndef WIN32
65#include <sys/ipc.h>
66#include <sys/shm.h>
67#include <sys/sem.h>
68#else
69#include <direct.h>
70#endif
71#include <stdio.h>
72#include <time.h>
73#include <ctype.h>
74#ifdef WIN32
75#ifndef USE_RUBY
76#include <unistd.h>
77#endif
78#endif
79#ifndef WIN32
80#include <xlocale.h>
81#endif
82#include "ulinet.h"
83
84#include "service.h"
85#include <openssl/sha.h>
86#include <openssl/md5.h>
87#include <openssl/hmac.h>
88#include <openssl/evp.h>
89#include <openssl/bio.h>
90#include <openssl/buffer.h>
91
92#ifdef __cplusplus
93extern "C" {
94#endif
95#include <libxml/parser.h>
96#include <libxml/xpath.h>
97
98  /**
99   * Maximum number of XML namespaces
100   */
101#define ZOO_NS_MAX 10
102  /**
103   * Maximum number of XML docs
104   */
105#define ZOO_DOC_MAX 20
106
107  /**
108   * Global char* to store the serverAddress value of the [main] section
109   */
110  static char* SERVICE_URL;
111
112  /**
113   * Array of xmlNsPtr storing all used XML namespace
114   */
115  static xmlNsPtr usedNs[ZOO_NS_MAX];
116  /**
117   * Array storing names of the used XML namespace
118   */
119  static char* nsName[ZOO_NS_MAX];
120  /**
121   * Number of XML namespaces
122   */
123  static int nbNs=0;
124  /**
125   * Array of xmlDocPtr storing XML docs
126   */
127  static xmlDocPtr iDocs[ZOO_DOC_MAX];
128  /**
129   * Number of XML docs
130   */
131  static int nbDocs=0;
132
133  /**
134   * Definitions of acceptable final status
135   */
136  static char wpsStatus[2][11]={
137    "Succeeded",
138    "Failed"
139  };
140  /**
141   * Definitions of schemas depending on the WPS version
142   */
143  static const char* schemas[2][7]={
144    {"1.0.0","http://www.opengis.net/ows/1.1","http://www.opengis.net/wps/1.0.0","http://schemas.opengis.net/wps/1.0.0","%s %s/wps%s_response.xsd","http://schemas.opengis.net/ows/1.1.0/owsExceptionReport.xsd","1.1.0"},
145    {"2.0.0","http://www.opengis.net/ows/2.0","http://www.opengis.net/wps/2.0","http://schemas.opengis.net/wps/2.0","%s %s/wps%s.xsd","http://schemas.opengis.net/ows/2.0/owsExceptionReport.xsd","2.0.2"},
146  };
147  /**
148   * Definitions of support requests (depending on the WPS version)
149   */
150  static int nbSupportedRequests=7;
151  /**
152   * Definitions of requests depending on the WPS version
153   */
154  static const char* requests[2][7]={
155    {"GetCapabilities","DescribeProcess","Execute",NULL},
156    {"GetCapabilities","DescribeProcess","Execute","GetStatus","GetResult","Dismiss",NULL},
157  };
158  /**
159   * Definitions requests requiring identifier (depending on the WPS version)
160   */
161  static int nbReqIdentifier=2;
162  /**
163   * Definitions requests requiring jobid (only for WPS version 2.0.0)
164   */
165  static int nbReqJob=3;
166  /**
167   * Definitions of root node for response depending on the request and the WPS version
168   */
169  static const char root_nodes[2][4][20]={
170    {"ProcessOfferings","ProcessDescriptions","ExecuteResponse",NULL},
171    {"Contents","ProcessOfferings","Result",NULL}
172  };
173
174  /**
175   * Name and corresponding attributes depending on the WPS version
176   */
177  static const char* capabilities[2][7]={
178    {
179      "Process",
180      "processVersion","1",
181      "storeSupported","true",
182      "statusSupported","true"
183    },
184    {
185      "ProcessSummary",
186      "processVersion","1.0.0",
187      "jobControlOptions","sync-execute async-execute dismiss",
188      "outputTransmission","value reference"
189    }
190  };
191
192  void addLangAttr(xmlNodePtr,maps*);
193
194  void printHeaders(maps*);
195
196  int zooXmlSearchForNs(const char*);
197  int zooXmlAddNs(xmlNodePtr,const char*,const char*);
198  void zooXmlCleanupNs();
199
200  int zooXmlAddDoc(xmlNodePtr,const char*,const char*);
201  void zooXmlCleanupDocs();
202 
203  void printExceptionReportResponse(maps*,map*);
204  xmlNodePtr createExceptionReportNode(maps*,map*,int);
205  void printProcessResponse(maps*,map*,int,service*,const char*,int,maps*,maps*);
206  xmlNodePtr printWPSHeader(xmlDocPtr,maps*,const char*,const char*,const char*,int);
207  xmlNodePtr printGetCapabilitiesHeader(xmlDocPtr,maps*,const char*);
208  void printGetCapabilitiesForProcess(maps*,xmlNodePtr,service*);
209  void printDescribeProcessForProcess(maps*,xmlNodePtr,service*);
210  void printFullDescription(int,elements*,const char*,xmlNsPtr,xmlNsPtr,xmlNodePtr,int);
211  void printDocument(maps*,xmlDocPtr,int);
212  void printDescription(xmlNodePtr,xmlNsPtr,const char*,map*,int);
213  void printIOType(xmlDocPtr,xmlNodePtr,xmlNsPtr,xmlNsPtr,xmlNsPtr,elements*,maps*,const char*,int);
214  map* parseBoundingBox(const char*);
215  void printBoundingBox(xmlNsPtr,xmlNodePtr,map*);
216  void printBoundingBoxDocument(maps*,maps*,FILE*);
217  void printOutputDefinitions(xmlDocPtr,xmlNodePtr,xmlNsPtr,xmlNsPtr,elements*,maps*,const char*);
218  void printStatusInfo(maps*,map*,char*);
219
220  void outputResponse(service*,maps*,maps*,map*,int,maps*,int);
221
222  int errorException(maps *, const char *, const char *, const char*);
223
224  xmlNodePtr soapEnvelope(maps*,xmlNodePtr);
225  int checkForSoapEnvelope(xmlDocPtr);
226 
227#ifdef __cplusplus
228}
229#endif
230
231#endif
Note: See TracBrowser for help on using the repository browser.

Search

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png