Commit 8f1d3e0b authored by El Sayed, Nadim's avatar El Sayed, Nadim
Browse files

working example

parent bb736aeb
......@@ -7,13 +7,17 @@ using namespace std;
int main() {
currentTimeProxy ct_client;
cout << "starting client ..." << endl;
_ns1__currentTime *currt;
_ns1__currentTimeResponse currTimeResp;
time_t resp;
// _ns__currentTime *currt;
// _ns__currentTimeResponse currTimeResp;
int result = ct_client.currentTime(currt,currTimeResp);
// int result = ct_client.currentTime(currt,currTimeResp);
cout << "" << endl;
//int result = ct_client.currentTime("http://localhost:8080", "",resp);
int result = ct_client.currentTime(resp);
if (SOAP_OK == result ) {
cout << "Client Call successfull" << endl;
cout << "Client Call successfull ==>\tTime is:\t"<< resp << endl;
} else {
cout << "Bad request: " << result << endl;
}
......
......@@ -4,10 +4,9 @@
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ns1="urn:currentTime">
xmlns:ns="urn:currentTime">
<SOAP-ENV:Body>
<ns1:currentTime>
</ns1:currentTime>
<ns:currentTime>
</ns:currentTime>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
......@@ -4,10 +4,10 @@
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ns1="urn:currentTime">
xmlns:ns="urn:currentTime">
<SOAP-ENV:Body>
<ns1:currentTimeResponse>
<response>2017-08-17T13:04:27Z</response>
</ns1:currentTimeResponse>
<ns:currentTimeResponse>
<response>2017-08-17T15:36:18Z</response>
</ns:currentTimeResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
......@@ -6,6 +6,6 @@ SOAP_NMAC struct Namespace namespaces[] =
{"SOAP-ENC", "http://schemas.xmlsoap.org/soap/encoding/", "http://www.w3.org/*/soap-encoding", NULL},
{"xsi", "http://www.w3.org/2001/XMLSchema-instance", "http://www.w3.org/*/XMLSchema-instance", NULL},
{"xsd", "http://www.w3.org/2001/XMLSchema", "http://www.w3.org/*/XMLSchema", NULL},
{"ns1", "urn:currentTime", NULL, NULL},
{"ns", "urn:currentTime", NULL, NULL},
{NULL, NULL, NULL, NULL}
};
<?xml version="1.0" encoding="UTF-8"?>
<definitions name="currentTime"
targetNamespace="urn:currentTime"
xmlns:tns="urn:currentTime"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ns="urn:currentTime"
xmlns:SOAP="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:HTTP="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:MIME="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:DIME="http://schemas.xmlsoap.org/ws/2002/04/dime/wsdl/"
xmlns:WSDL="http://schemas.xmlsoap.org/wsdl/"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
<schema targetNamespace="urn:currentTime"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ns="urn:currentTime"
xmlns="http://www.w3.org/2001/XMLSchema"
elementFormDefault="unqualified"
attributeFormDefault="unqualified">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<!-- operation request element -->
<element name="currentTime">
<complexType>
<sequence>
</sequence>
</complexType>
</element>
<!-- operation response element -->
<element name="currentTimeResponse">
<complexType>
<sequence>
<element name="response" type="xsd:dateTime" minOccurs="1" maxOccurs="1"/><!-- ns__currentTime::response -->
</sequence>
</complexType>
</element>
</schema>
</types>
<message name="currentTimeRequest">
<part name="Body" element="ns:currentTime"/><!-- ns__currentTime::ns__currentTime -->
</message>
<message name="currentTimeResponse">
<part name="Body" element="ns:currentTimeResponse"/>
</message>
<portType name="currentTimePortType">
<operation name="currentTime">
<documentation>Service definition of function ns__currentTime</documentation>
<input message="tns:currentTimeRequest"/>
<output message="tns:currentTimeResponse"/>
</operation>
</portType>
<binding name="currentTime" type="tns:currentTimePortType">
<SOAP:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="currentTime">
<SOAP:operation soapAction=""/>
<input>
<SOAP:body parts="Body" use="literal"/>
</input>
<output>
<SOAP:body parts="Body" use="literal"/>
</output>
</operation>
</binding>
<service name="currentTime">
<documentation>gSOAP 2.8.28 generated service definition</documentation>
<port name="currentTime" binding="tns:currentTime">
<SOAP:address location="http://localhost:8080/"/>
</port>
</service>
</definitions>
// Reminder: Modify typemap.dat to customize the header file generated by wsdl2h
/* curretTime.h
Generated by wsdl2h 2.8.28 from ../server/currentTime.wsdl and typemap.dat
2017-08-17 13:03:41 GMT
DO NOT INCLUDE THIS FILE DIRECTLY INTO YOUR PROJECT BUILDS
USE THE soapcpp2-GENERATED SOURCE CODE FILES FOR YOUR PROJECT BUILDS
gSOAP XML Web services tools
Copyright (C) 2000-2016, Robert van Engelen, Genivia Inc. All Rights Reserved.
This program is released under the GPL with the additional exemption that
compiling, linking, and/or using OpenSSL is allowed.
--------------------------------------------------------------------------------
A commercial use license is available from Genivia Inc., contact@genivia.com
--------------------------------------------------------------------------------
*/
/** @page page_notes Notes
@note HINTS:
- Run soapcpp2 on curretTime.h to generate the SOAP/XML processing logic.
Use soapcpp2 -I to specify paths for #import
To build with STL, 'stlvector.h' is imported from 'import' dir in package.
Use soapcpp2 -j to generate improved proxy and server classes.
- Use wsdl2h -c and -s to generate pure C code or C++ code without STL.
- Use 'typemap.dat' to control namespace bindings and type mappings.
It is strongly recommended to customize the names of the namespace prefixes
generated by wsdl2h. To do so, modify the prefix bindings in the Namespaces
section below and add the modified lines to 'typemap.dat' to rerun wsdl2h.
- Use Doxygen (www.doxygen.org) on this file to generate documentation.
- Use wsdl2h -R to generate REST operations.
- Use wsdl2h -nname to use name as the base namespace prefix instead of 'ns'.
- Use wsdl2h -Nname for service prefix and produce multiple service bindings
- Use wsdl2h -d to enable DOM support for xsd:anyType.
- Use wsdl2h -g to auto-generate readers and writers for root elements.
- Use wsdl2h -b to auto-generate bi-directional operations (duplex ops).
- Use wsdl2h -U to map XML names to C++ Unicode identifiers instead of _xNNNN.
- Use wsdl2h -u to disable the generation of unions.
- Struct/class members serialized as XML attributes are annotated with a '@'.
- Struct/class members that have a special role are annotated with a '$'.
@warning
DO NOT INCLUDE THIS ANNOTATED FILE DIRECTLY IN YOUR PROJECT SOURCE CODE.
USE THE FILES GENERATED BY soapcpp2 FOR YOUR PROJECT'S SOURCE CODE:
THE soapStub.h FILE CONTAINS THIS CONTENT WITHOUT ANNOTATIONS.
@copyright LICENSE:
@verbatim
--------------------------------------------------------------------------------
gSOAP XML Web services tools
Copyright (C) 2000-2016, Robert van Engelen, Genivia Inc. All Rights Reserved.
The wsdl2h tool and its generated software are released under the GPL.
This software is released under the GPL with the additional exemption that
compiling, linking, and/or using OpenSSL is allowed.
--------------------------------------------------------------------------------
GPL license.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
Author contact information:
engelen@genivia.com / engelen@acm.org
This program is released under the GPL with the additional exemption that
compiling, linking, and/or using OpenSSL is allowed.
--------------------------------------------------------------------------------
A commercial-use license is available from Genivia, Inc., contact@genivia.com
--------------------------------------------------------------------------------
@endverbatim
*/
//gsoapopt c++,w
/******************************************************************************\
* *
* Definitions *
* urn:currentTime *
* *
\******************************************************************************/
/******************************************************************************\
* *
* Import *
* *
\******************************************************************************/
/******************************************************************************\
* *
* Schema Namespaces *
* *
\******************************************************************************/
/* NOTE:
It is strongly recommended to customize the names of the namespace prefixes
generated by wsdl2h. To do so, modify the prefix bindings below and add the
modified lines to typemap.dat to rerun wsdl2h:
ns1 = "urn:currentTime"
*/
#define SOAP_NAMESPACE_OF_ns1 "urn:currentTime"
//gsoap ns1 schema namespace: urn:currentTime
//gsoap ns1 schema form: unqualified
/******************************************************************************\
* *
* Built-in Schema Types and Top-Level Elements and Attributes *
* *
\******************************************************************************/
/******************************************************************************\
* *
* Forward Declarations *
* *
\******************************************************************************/
// Forward declaration of class _ns1__currentTime.
class _ns1__currentTime;
// Forward declaration of class _ns1__currentTimeResponse.
class _ns1__currentTimeResponse;
/******************************************************************************\
* *
* Schema Types and Top-Level Elements and Attributes *
* urn:currentTime *
* *
\******************************************************************************/
/******************************************************************************\
* *
* Schema Complex Types and Top-Level Elements *
* urn:currentTime *
* *
\******************************************************************************/
/// @brief Top-level root element "urn:currentTime":currentTime
/// @brief "urn:currentTime":currentTime is a complexType.
///
/// class _ns1__currentTime operations:
/// - _ns1__currentTime* soap_new__ns1__currentTime(soap*) allocate
/// - _ns1__currentTime* soap_new__ns1__currentTime(soap*, int num) allocate array
/// - _ns1__currentTime* soap_new_req__ns1__currentTime(soap*, ...) allocate, set required members
/// - _ns1__currentTime* soap_new_set__ns1__currentTime(soap*, ...) allocate, set all public members
/// - _ns1__currentTime::soap_default(soap*) reset members to default
/// - int soap_read__ns1__currentTime(soap*, _ns1__currentTime*) deserialize from a stream
/// - int soap_write__ns1__currentTime(soap*, _ns1__currentTime*) serialize to a stream
/// - _ns1__currentTime* _ns1__currentTime::soap_dup(soap*) returns deep copy of _ns1__currentTime, copies the (cyclic) graph structure when a context is provided, or (cycle-pruned) tree structure with soap_set_mode(soap, SOAP_XML_TREE) (use soapcpp2 -Ec)
/// - _ns1__currentTime::soap_del() deep deletes _ns1__currentTime data members, use only after _ns1__currentTime::soap_dup(NULL) (use soapcpp2 -Ed)
class _ns1__currentTime
{ public:
/// A handle to the soap struct context that manages this instance when instantiated by a context or NULL otherwise (automatically set).
struct soap *soap ;
};
/// @brief Top-level root element "urn:currentTime":currentTimeResponse
/// @brief "urn:currentTime":currentTimeResponse is a complexType.
///
/// class _ns1__currentTimeResponse operations:
/// - _ns1__currentTimeResponse* soap_new__ns1__currentTimeResponse(soap*) allocate
/// - _ns1__currentTimeResponse* soap_new__ns1__currentTimeResponse(soap*, int num) allocate array
/// - _ns1__currentTimeResponse* soap_new_req__ns1__currentTimeResponse(soap*, ...) allocate, set required members
/// - _ns1__currentTimeResponse* soap_new_set__ns1__currentTimeResponse(soap*, ...) allocate, set all public members
/// - _ns1__currentTimeResponse::soap_default(soap*) reset members to default
/// - int soap_read__ns1__currentTimeResponse(soap*, _ns1__currentTimeResponse*) deserialize from a stream
/// - int soap_write__ns1__currentTimeResponse(soap*, _ns1__currentTimeResponse*) serialize to a stream
/// - _ns1__currentTimeResponse* _ns1__currentTimeResponse::soap_dup(soap*) returns deep copy of _ns1__currentTimeResponse, copies the (cyclic) graph structure when a context is provided, or (cycle-pruned) tree structure with soap_set_mode(soap, SOAP_XML_TREE) (use soapcpp2 -Ec)
/// - _ns1__currentTimeResponse::soap_del() deep deletes _ns1__currentTimeResponse data members, use only after _ns1__currentTimeResponse::soap_dup(NULL) (use soapcpp2 -Ed)
class _ns1__currentTimeResponse
{ public:
/// Element "response" of XSD type xs:dateTime.
time_t response 1; ///< Required element.
/// A handle to the soap struct context that manages this instance when instantiated by a context or NULL otherwise (automatically set).
struct soap *soap ;
};
/******************************************************************************\
* *
* Additional Top-Level Elements *
* urn:currentTime *
* *
\******************************************************************************/
/******************************************************************************\
* *
* Additional Top-Level Attributes *
* urn:currentTime *
* *
\******************************************************************************/
/******************************************************************************\
* *
* Services *
* *
\******************************************************************************/
//gsoap ns1 service name: currentTime
//gsoap ns1 service type: currentTimePortType
//gsoap ns1 service port: http://localhost:8080/
//gsoap ns1 service namespace: urn:currentTime
//gsoap ns1 service transport: http://schemas.xmlsoap.org/soap/http
/** @mainpage currentTime Definitions
@section currentTime_bindings Service Bindings
- @ref currentTime
@section currentTime_more More Information
- @ref page_notes "Notes"
- @ref page_XMLDataBinding "XML Data Binding"
- @ref SOAP_ENV__Header "SOAP Header Content" (when applicable)
- @ref SOAP_ENV__Detail "SOAP Fault Detail Content" (when applicable)
*/
/**
@page currentTime Binding "currentTime"
@section currentTime_service Service Documentation "currentTime"
gSOAP 2.8.28 generated service definition
@section currentTime_operations Operations of Binding "currentTime"
- @ref __ns1__currentTime
@section currentTime_ports Endpoints of Binding "currentTime"
- http://localhost:8080/
@note Use wsdl2h option -Nname to change the service binding prefix name
*/
/******************************************************************************\
* *
* Service Binding *
* currentTime *
* *
\******************************************************************************/
/******************************************************************************\
* *
* Service Operation *
* __ns1__currentTime *
* *
\******************************************************************************/
/** Operation "__ns1__currentTime" of service binding "currentTime".
Service definition of function ns__currentTime
- SOAP document/literal style messaging
- Addressing input action: ""
- Addressing output action: "Response"
C stub function (defined in soapClient.c[pp] generated by soapcpp2):
@code
int soap_call___ns1__currentTime(
struct soap *soap,
NULL, // char *endpoint = NULL selects default endpoint for this operation
NULL, // char *action = NULL selects default action for this operation
// input parameters:
_ns1__currentTime* ns1__currentTime,
// output parameters:
_ns1__currentTimeResponse &ns1__currentTimeResponse
);
@endcode
C server function (called from the service dispatcher defined in soapServer.c[pp]):
@code
int __ns1__currentTime(
struct soap *soap,
// input parameters:
_ns1__currentTime* ns1__currentTime,
// output parameters:
_ns1__currentTimeResponse &ns1__currentTimeResponse
);
@endcode
C++ proxy class (defined in soapcurrentTimeProxy.h):
@code
class currentTimeProxy;
@endcode
Important: use soapcpp2 option '-j' (or '-i') to generate improved and easy-to-use proxy classes;
C++ service class (defined in soapcurrentTimeService.h):
@code
class currentTimeService;
@endcode
Important: use soapcpp2 option '-j' (or '-i') to generate improved and easy-to-use service classes;
*/
//gsoap ns1 service method-protocol: currentTime SOAP
//gsoap ns1 service method-style: currentTime document
//gsoap ns1 service method-encoding: currentTime literal
//gsoap ns1 service method-action: currentTime ""
//gsoap ns1 service method-output-action: currentTime Response
int __ns1__currentTime(
_ns1__currentTime* ns1__currentTime, ///< Input parameter
_ns1__currentTimeResponse &ns1__currentTimeResponse ///< Output parameter
);
/**
@page currentTime Binding "currentTime"
@section currentTime_policy_enablers Policy Enablers of Binding "currentTime"
None specified.
*/
/******************************************************************************\
* *
* XML Data Binding *
* *
\******************************************************************************/
/**
@page page_XMLDataBinding XML Data Binding
SOAP/XML services use data bindings contractually bound by WSDL and auto-
generated by wsdl2h and soapcpp2 (see Service Bindings). Plain data bindings
are adopted from XML schemas as part of the WSDL types section or when running
wsdl2h on a set of schemas to produce non-SOAP-based XML data bindings.
The following readers and writers are C/C++ data type (de)serializers auto-
generated by wsdl2h and soapcpp2. Run soapcpp2 on this file to generate the
(de)serialization code, which is stored in soapC.c[pp]. Include "soapH.h" in
your code to import these data type and function declarations. Only use the
soapcpp2-generated files in your project build. Do not include the wsdl2h-
generated .h file in your code.
Data can be read and deserialized from:
- an int file descriptor, using soap->recvfd = fd
- a socket, using soap->socket = (int)...
- a C++ stream (istream, stringstream), using soap->is = (istream*)...
- a C string, using soap->is = (const char*)...
- any input, using the soap->frecv() callback
Data can be serialized and written to:
- an int file descriptor, using soap->sendfd = (int)...
- a socket, using soap->socket = (int)...
- a C++ stream (ostream, stringstream), using soap->os = (ostream*)...
- a C string, using soap->os = (const char**)...
- any output, using the soap->fsend() callback
The following options are available for (de)serialization control:
- soap->encodingStyle = NULL; to remove SOAP 1.1/1.2 encodingStyle
- soap_mode(soap, SOAP_XML_TREE); XML without id-ref (no cycles!)
- soap_mode(soap, SOAP_XML_GRAPH); XML with id-ref (including cycles)
- soap_set_namespaces(soap, struct Namespace *nsmap); to set xmlns bindings
@section ns1 Top-level root elements of schema "urn:currentTime"
- <ns1:currentTime> @ref _ns1__currentTime
@code
// Reader (returns SOAP_OK on success):
soap_read__ns1__currentTime(struct soap*, _ns1__currentTime*);
// Writer (returns SOAP_OK on success):
soap_write__ns1__currentTime(struct soap*, _ns1__currentTime*);
@endcode
- <ns1:currentTimeResponse> @ref _ns1__currentTimeResponse
@code
// Reader (returns SOAP_OK on success):
soap_read__ns1__currentTimeResponse(struct soap*, _ns1__currentTimeResponse*);
// Writer (returns SOAP_OK on success):
soap_write__ns1__currentTimeResponse(struct soap*, _ns1__currentTimeResponse*);
@endcode
*/
/* End of curretTime.h */
<?xml version="1.0" encoding="UTF-8"?>
<schema targetNamespace="urn:currentTime"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ns="urn:currentTime"
xmlns="http://www.w3.org/2001/XMLSchema"
elementFormDefault="unqualified"
attributeFormDefault="unqualified">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<!-- operation request element -->
<element name="currentTime">
<complexType>
<sequence>
</sequence>
</complexType>
</element>
<!-- operation response element -->
<element name="currentTimeResponse">
<complexType>
<sequence>
<element name="response" type="xsd:dateTime" minOccurs="1" maxOccurs="1"/><!-- ns__currentTime::response -->
</sequence>
</complexType>
</element>
</schema>
This diff is collapsed.
/* soapH.h
Generated by gSOAP 2.8.28 from curretTime.h
Generated by gSOAP 2.8.28 from ../server/currentTime.h
gSOAP XML Web services tools
Copyright (C) 2000-2016, Robert van Engelen, Genivia Inc. All Rights Reserved.
......@@ -84,7 +84,7 @@ SOAP_FMAC3 int * SOAP_FMAC4 soap_get_int(struct soap*, int *, const char*, const
#ifndef SOAP_TYPE_dateTime
#define SOAP_TYPE_dateTime (10)
#define SOAP_TYPE_dateTime (7)
#endif
SOAP_FMAC3 void SOAP_FMAC4 soap_default_dateTime(struct soap*, time_t *);
SOAP_FMAC3 int SOAP_FMAC4 soap_out_dateTime(struct soap*, const char*, int, const time_t *, const char*);
......@@ -102,90 +102,10 @@ SOAP_FMAC3 time_t * SOAP_FMAC4 soap_get_dateTime(struct soap*, time_t *, const c
#endif
#ifndef SOAP_TYPE__ns1__currentTimeResponse
#define SOAP_TYPE__ns1__currentTimeResponse (8)
#endif
SOAP_FMAC3 int SOAP_FMAC4 soap_out__ns1__currentTimeResponse(struct soap*, const char*, int, const _ns1__currentTimeResponse *, const char*);
SOAP_FMAC3 _ns1__currentTimeResponse * SOAP_FMAC4 soap_in__ns1__currentTimeResponse(struct soap*, const char*, _ns1__currentTimeResponse *, const char*);
SOAP_FMAC1 _ns1__currentTimeResponse * SOAP_FMAC2 soap_instantiate__ns1__currentTimeResponse(struct soap*, int, const char*, const char*, size_t*);
inline _ns1__currentTimeResponse * soap_new__ns1__currentTimeResponse(struct soap *soap, int n = -1) { return soap_instantiate__ns1__currentTimeResponse(soap, n, NULL, NULL, NULL); }
inline _ns1__currentTimeResponse * soap_new_req__ns1__currentTimeResponse(