Skip to content
Snippets Groups Projects
Commit fc8c35d8 authored by Erik Alexandre Pucci's avatar Erik Alexandre Pucci Committed by Danilo K. S. Yorinori
Browse files

client.c: Created inventory() that sends the XML data to the server


inventory() calls read_xml_file() to read the XML data file and contacts the
webservice server, sending the XML data string.

Signed-off-by: default avatarErik Alexandre Pucci <eap08@c3sl.ufpr.br>
Acked-by: default avatarDiego Giovane Pasqualin <dgp06@c3sl.ufpr.br>
Acked-by: default avatarJosiney de Souza <josineys@c3sl.ufpr.br>
Acked-by: default avatarRicardo Tavares de Oliveira <rto07@c3sl.ufpr.br>
Signed-off-by: default avatarDanilo K. S. Yorinori <danilok@c3sl.ufpr.br>
parent aa38a6f4
Branches
Tags
No related merge requests found
...@@ -298,3 +298,47 @@ char *read_xml_file(char *basedir) ...@@ -298,3 +298,47 @@ char *read_xml_file(char *basedir)
fclose(xmlFile); fclose(xmlFile);
return xmlInventory; return xmlInventory;
} }
/*----------------------------------------------------------------------------
* Summary: Contact webservice server, sending the collected XML data.
* Parameters:
* soap SOAP struct
* url URL of the contacted webservice server
* basedir String with basedir path
* Return: void
*/
void inventory(struct soap *soap, char *url, char *basedir)
{
char *invResult, *xmlInventory;
xmlInventory = read_xml_file(basedir);
if (soap_call_ns1__setInventory(soap, url, "", xmlInventory, &invResult)
!= SOAP_OK)
{
soap_print_fault(soap, stderr);
exit(2);
}
/* Get inventory result from response */
if (DEBUG)
{
printf("InvResult: %s\n", invResult);
}
/* Verify response and print appropriate message */
if (strcmp(invResult, "Success") == 0)
{
fprintf(stdout, "XML data sent successful\n");
}
else if (strcmp(invResult, "Error") == 0)
{
fprintf(stdout, "XML data sent error\n");
exit(5);
}
else
{
fprintf(stdout, "%s\nUnexpected result from server\n", invResult);
exit(6);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment