• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/ap/gpl/gsoap/source_build_platform/gsoap/samples/wsa/
1/*
2	wsademo.h
3
4	WS-Addressing demo service. See usage comments below.
5
6gSOAP XML Web services tools
7Copyright (C) 2000-2008, Robert van Engelen, Genivia Inc., All Rights Reserved.
8This part of the software is released under one of the following licenses:
9GPL, the gSOAP public license, or Genivia's license for commercial use.
10--------------------------------------------------------------------------------
11gSOAP public license.
12
13The contents of this file are subject to the gSOAP Public License Version 1.3
14(the "License"); you may not use this file except in compliance with the
15License. You may obtain a copy of the License at
16http://www.cs.fsu.edu/~engelen/soaplicense.html
17Software distributed under the License is distributed on an "AS IS" basis,
18WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
19for the specific language governing rights and limitations under the License.
20
21The Initial Developer of the Original Code is Robert A. van Engelen.
22Copyright (C) 2000-2008, Robert van Engelen, Genivia Inc., All Rights Reserved.
23--------------------------------------------------------------------------------
24GPL license.
25
26This program is free software; you can redistribute it and/or modify it under
27the terms of the GNU General Public License as published by the Free Software
28Foundation; either version 2 of the License, or (at your option) any later
29version.
30
31This program is distributed in the hope that it will be useful, but WITHOUT ANY
32WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
33PARTICULAR PURPOSE. See the GNU General Public License for more details.
34
35You should have received a copy of the GNU General Public License along with
36this program; if not, write to the Free Software Foundation, Inc., 59 Temple
37Place, Suite 330, Boston, MA 02111-1307 USA
38
39Author contact information:
40engelen@genivia.com / engelen@acm.org
41--------------------------------------------------------------------------------
42A commercial use license is available from Genivia, Inc., contact@genivia.com
43--------------------------------------------------------------------------------
44
45This application demonstrates server-side and client-side logic for services
46based on WS-Addressing. At the server side, WS-Addressing enables
47forwarding/relaying of service responses and faults to other services. At the
48client side, a relayed response or fault will not be received and an HTTP
49ACCEPTED (code 202) is delivered instead, assuming that the relay was
50successful.
51
52This header file illustrates two gSOAP soapcpp2 tooling tricks to enable
53services to accept SOAP Fault messages and to create a one-way service
54operation to handle responses.
55
56	Usage:
57
58	After compilation, start the main server at port 11001:
59	> ./wsademo 11001
60
61	In a new window, start a return service at port 11002:
62	> ./wsademo 11002
63	This service handles response messages from the main service.
64
65	In a new window, start a fault service at port 11003:
66	> ./wsademo 11003
67	This service handles faults from the main service.
68
69	In a new window, run the client:
70	> ./wsademo hello
71	This example shows the server returning "hello" to the client.
72
73	> ./wsademo fault
74	This example shows the server returning a SOAP fault to the client.
75
76	> ./wsademo hello r
77	This example shows the server returning "hello" to the return service.
78
79	> ./wsademo hello n
80	This example shows the server accepting the message without reply.
81
82	> ./wsademo error e
83	This example shows the server returning a wsa fault to fault service.
84
85	> ./wsademo fault e
86	This example shows the server returning a SOAP fault to fault service.
87
88	Note: when the response service is down, the response cannot be relayed
89	and the client (or fault service) will be informed about the failure.
90*/
91
92#import "soap12.h"
93#import "wsa5.h"
94
95//gsoap ns service name:	wsademo demonstrates WS-Addressing capabilities
96//gsoap ns service port:	http://localhost:11001
97//gsoap ns service type:	wsademoPort
98//gsoap ns service namespace:	urn:wsademo
99
100struct SOAP_ENV__Header
101{
102                 _wsa5__MessageID  wsa5__MessageID 0;
103                 _wsa5__RelatesTo *wsa5__RelatesTo 0;
104                 _wsa5__From      *wsa5__From      0;
105  mustUnderstand _wsa5__ReplyTo   *wsa5__ReplyTo   0;
106  mustUnderstand _wsa5__FaultTo   *wsa5__FaultTo   0;
107  mustUnderstand _wsa5__To         wsa5__To        0;
108  mustUnderstand _wsa5__Action     wsa5__Action    0;
109};
110
111/* STEP 1: generate SOAP-ENV:Fault struct via a one-way service operation.
112 * This allows us to implement a one-way service operation that accepts Faults.
113 * Because a service operation input parameters has a corresponding struct, we
114 * automatically generate the (original) SOAP_ENV__Fault struct on the fly!
115 * Note: it is important to associate the wsa fault action with this operation
116 * as defined below.
117 */
118
119//gsoap SOAP_ENV service method-action: Fault http://schemas.xmlsoap.org/ws/2004/08/addressing/fault
120int SOAP_ENV__Fault
121(       _QName			 faultcode,		// SOAP 1.1
122        char			*faultstring,		// SOAP 1.1
123        char			*faultactor,		// SOAP 1.1
124        struct SOAP_ENV__Detail	*detail,		// SOAP 1.1
125        struct SOAP_ENV__Code	*SOAP_ENV__Code,	// SOAP 1.2
126        struct SOAP_ENV__Reason	*SOAP_ENV__Reason,	// SOAP 1.2
127        char			*SOAP_ENV__Node,	// SOAP 1.2
128        char			*SOAP_ENV__Role,	// SOAP 1.2
129        struct SOAP_ENV__Detail	*SOAP_ENV__Detail,	// SOAP 1.2
130	void
131);
132
133/* STEP 2: for the server side we need to generate a response struct for each
134 * operation to implement one-way service response operations that can be
135 * relayed. Because the service operation has a corresponding struct, we can
136 * use that struct as a response parameter for the second two-way service
137 * operation. This step is required to implement a wsa-capable server.
138 */
139
140//gsoap ns service method-header-part: wsademoResult wsa5__MessageID
141//gsoap ns service method-header-part: wsademoResult wsa5__RelatesTo
142//gsoap ns service method-header-part: wsademoResult wsa5__From
143//gsoap ns service method-header-part: wsademoResult wsa5__ReplyTo
144//gsoap ns service method-header-part: wsademoResult wsa5__FaultTo
145//gsoap ns service method-header-part: wsademoResult wsa5__To
146//gsoap ns service method-header-part: wsademoResult wsa5__Action
147//gsoap ns service method-action: wsademoResult urn:wsademo/wsademoPort/wsademoResult
148//gsoap ns service method-documentation: wsademoResult accepts a string value from a relayed response
149int ns__wsademoResult(char *out, void);
150
151//gsoap ns service method-header-part: wsademo wsa5__MessageID
152//gsoap ns service method-header-part: wsademo wsa5__RelatesTo
153//gsoap ns service method-header-part: wsademo wsa5__From
154//gsoap ns service method-header-part: wsademo wsa5__ReplyTo
155//gsoap ns service method-header-part: wsademo wsa5__FaultTo
156//gsoap ns service method-header-part: wsademo wsa5__To
157//gsoap ns service method-header-part: wsademo wsa5__Action
158//gsoap ns service method-action: wsademo urn:wsademo/wsademoPort/wsademo
159//gsoap ns service method-documentation: wsademo echos a string value and relays the response to the wsa replyTo address (if present)
160int ns__wsademo(char *in, struct ns__wsademoResult *result);
161