85 struct soap *soap = soap_new1(SOAP_XML_STRICT | SOAP_XML_INDENT | SOAP_XML_NOTYPE);
92 fs.open(
"address.xml", std::ios::in);
98 std::cerr <<
"Error reading address.xml file" << std::endl;
99 soap_stream_fault(soap, std::cerr);
106 std::cout << std::endl <<
"ADDRESS BOOK - An Example XML Data Binding Application" << std::endl << std::endl;
111 std::cout <<
"Address entry " << (*i)->ID << std::endl;
112 std::cout <<
"Name: " << (*i)->name << std::endl;
113 std::cout <<
"Street: " << (*i)->street << std::endl;
114 std::cout <<
"City: " << (*i)->city << std::endl;
115 std::cout <<
"Zip: " << (*i)->zip << std::endl;
122 std::cout <<
"Phone: " << *(*i)->phone << std::endl;
124 std::cout <<
"Mobile: " << *(*i)->mobile << std::endl;
127 std::cout <<
"DOB: " << soap_dateTime2s(soap, *(*i)->dob) << std::endl;
128 std::cout <<
"---------" << std::endl;
139 std::cout <<
"Enter a new contact:" << std::endl;
149 soap->error = SOAP_OK;
151 std::cerr <<
"Not a valid country code" << std::endl;
168 if (soap_s2dateTime(soap, s, a->
dob) != SOAP_OK)
169 std::cerr <<
"Not a valid ISO 8601 date time (ignored)" << std::endl;
170 soap->error = SOAP_OK;
175 std::cout << std::endl <<
"Contact information added." << std::endl;
178 fs.open(
"address.xml", std::ios::out);
181 std::cerr <<
"Cannot create address.xml file" << std::endl;
187 std::cerr <<
"Error writing address.xml file" << std::endl;
188 soap_stream_fault(soap, std::cerr);
208 printf(
"%-9s> ", prompt);
209 fgets(buf, 80, stdin);
212 for (s = buf + strlen(buf) - 1; s > buf; s--)
220 for (s = buf; *s; s++)
char * user_input(const char *prompt)
A quick-and-dirty user input function: reads string from stdin (up to 80 chars), trims leading and tr...
int main()
Address book application: reads address.xml, displays its content, prompts the user for new contact,...
SOAP_FMAC3S int SOAP_FMAC4S soap_s2a__ISO_country(struct soap *, const char *, enum a__ISO_country *)
SOAP_FMAC3S const char *SOAP_FMAC4S soap_a__ISO_country2s(struct soap *, enum a__ISO_country)
std::string * soap_new_std__string(struct soap *soap, int n=-1)
int soap_write__a__address_book(struct soap *soap, _a__address_book const *p)
a__address * soap_new_a__address(struct soap *soap, int n=-1)
int soap_read__a__address_book(struct soap *soap, _a__address_book *p)
_a__address_book * soap_new__a__address_book(struct soap *soap, int n=-1)
Top-level root element "urn:address-book-example":address-book.
std::vector< a__address * > address
Vector of a__address* of length 0..unbounded.
"urn:address-book-example":address is a complexType.
virtual void soap_default(struct soap *)
(Re)set members to default values
std::string * phone
Element "phone" of type xs:string.
std::string * mobile
Element "mobile" of type xs:string.
std::string zip
Element "zip" of type xs:string.
std::string street
Element "street" of type xs:string.
enum a__ISO_country country
Element "country" of type "":ISO-country.
time_t * dob
Element "dob" of type xs:dateTime.
int ID
Attribute "ID" of type xs:int.
std::string city
Element "city" of type xs:string.
std::string name
Element "name" of type xs:string.