Changeset 576 for trunk/zoo-project/zoo-kernel/zoo_service_loader.c
- Timestamp:
- Feb 11, 2015, 11:29:35 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/zoo-kernel/zoo_service_loader.c
r557 r576 609 609 #endif 610 610 sprintf (tmps, _("C Library can't be loaded %s"), errstr); 611 map *tmps1 = createMap ("text", tmps); 612 printExceptionReportResponse (m, tmps1); 611 errorException(m,tmps,"InternalError",NULL); 613 612 *eres = -1; 614 freeMap (&tmps1);615 free (tmps1);616 613 } 617 614 } … … 697 694 ("Programming Language (%s) set in ZCFG file is not currently supported by ZOO Kernel.\n"), 698 695 r_inputs->value); 699 map *tmps = createMap ("text", tmpv); 700 printExceptionReportResponse (m, tmps); 696 errorException (m, tmpv, "InternalError", NULL); 701 697 *eres = -1; 702 698 } … … 986 982 * Check for minimum inputs 987 983 */ 984 map* err=NULL; 985 const char *vvr[]={ 986 "GetCapabilities", 987 "DescribeProcess", 988 "Execute", 989 NULL 990 }; 991 checkValidValue(request_inputs,&err,"Request",(const char**)vvr,1); 992 const char *vvs[]={ 993 "WPS", 994 NULL 995 }; 996 if(err!=NULL){ 997 checkValidValue(request_inputs,&err,"service",(const char**)vvs,1); 998 printExceptionReportResponse (m, err); 999 freeMap(&err); 1000 free(err); 1001 if (count (request_inputs) == 1) 1002 { 1003 freeMap (&request_inputs); 1004 free (request_inputs); 1005 } 1006 freeMaps (&m); 1007 free (m); 1008 return 1; 1009 } 1010 checkValidValue(request_inputs,&err,"service",(const char**)vvs,1); 1011 const char *vvv[]={ 1012 "1.0.0", 1013 NULL 1014 }; 988 1015 r_inputs = getMap (request_inputs, "Request"); 989 if (request_inputs == NULL || r_inputs == NULL) 990 { 991 errorException (m, _("Parameter <request> was not specified"), 992 "MissingParameterValue", "request"); 993 if (count (request_inputs) == 1) 994 { 995 freeMap (&request_inputs); 996 free (request_inputs); 997 } 998 freeMaps (&m); 999 free (m); 1000 return 1; 1001 } 1002 else 1003 { 1004 REQUEST = zStrdup (r_inputs->value); 1005 if (strncasecmp (r_inputs->value, "GetCapabilities", 15) != 0 1006 && strncasecmp (r_inputs->value, "DescribeProcess", 15) != 0 1007 && strncasecmp (r_inputs->value, "Execute", 7) != 0) 1008 { 1009 errorException (m, 1010 _ 1011 ("Unenderstood <request> value. Please check that it was set to GetCapabilities, DescribeProcess or Execute."), 1012 "OperationNotSupported", r_inputs->value); 1013 freeMaps (&m); 1014 free (m); 1015 free (REQUEST); 1016 return 1; 1017 } 1018 } 1019 r_inputs = NULL; 1020 r_inputs = getMap (request_inputs, "Service"); 1021 if (r_inputs == NULLMAP) 1022 { 1023 errorException (m, _("Parameter <service> was not specified"), 1024 "MissingParameterValue", "service"); 1025 freeMaps (&m); 1026 free (m); 1027 free (REQUEST); 1028 return 1; 1029 } 1030 else 1031 { 1032 if (strcasecmp (r_inputs->value, "WPS") != 0) 1033 { 1034 errorException (m, 1035 _ 1036 ("Unenderstood <service> value, WPS is the only acceptable value."), 1037 "InvalidParameterValue", "service"); 1038 freeMaps (&m); 1039 free (m); 1040 free (REQUEST); 1041 return 1; 1042 } 1043 } 1044 if (strncasecmp (REQUEST, "GetCapabilities", 15) != 0) 1045 { 1046 r_inputs = getMap (request_inputs, "Version"); 1047 if (r_inputs == NULL) 1048 { 1049 errorException (m, _("Parameter <version> was not specified"), 1050 "MissingParameterValue", "version"); 1051 freeMaps (&m); 1052 free (m); 1053 free (REQUEST); 1054 return 1; 1055 } 1056 else 1057 { 1058 if (strcasecmp (r_inputs->value, "1.0.0") != 0) 1059 { 1060 errorException (m, 1061 _ 1062 ("Unenderstood <version> value, 1.0.0 is the only acceptable value."), 1063 "InvalidParameterValue", "service"); 1064 freeMaps (&m); 1065 free (m); 1066 free (REQUEST); 1067 return 1; 1068 } 1069 } 1070 } 1071 else 1072 { 1073 r_inputs = getMap (request_inputs, "AcceptVersions"); 1074 if (r_inputs != NULL) 1075 { 1076 if (strncmp (r_inputs->value, "1.0.0", 5) != 0) 1077 { 1078 errorException (m, 1079 _ 1080 ("Unenderstood <AcceptVersions> value, 1.0.0 is the only acceptable value."), 1081 "VersionNegotiationFailed", NULL); 1082 freeMaps (&m); 1083 free (m); 1084 free (REQUEST); 1085 return 1; 1086 } 1087 } 1088 } 1016 REQUEST = zStrdup (r_inputs->value); 1017 if (strncasecmp (REQUEST, "GetCapabilities", 15) != 0){ 1018 checkValidValue(request_inputs,&err,"version",(const char**)vvv,1); 1019 checkValidValue(request_inputs,&err,"identifier",NULL,1); 1020 }else{ 1021 checkValidValue(request_inputs,&err,"AcceptVersions",(const char**)vvv,-1); 1022 } 1023 if(err!=NULL){ 1024 printExceptionReportResponse (m, err); 1025 freeMap(&err); 1026 free(err); 1027 if (count (request_inputs) == 1) 1028 { 1029 freeMap (&request_inputs); 1030 free (request_inputs); 1031 } 1032 free(REQUEST); 1033 freeMaps (&m); 1034 free (m); 1035 return 1; 1036 } 1089 1037 1090 1038 r_inputs = getMap (request_inputs, "serviceprovider"); … … 1093 1041 addToMap (request_inputs, "serviceprovider", ""); 1094 1042 } 1043 1095 1044 1096 1045 maps *request_output_real_format = NULL; … … 1124 1073 xmlDocPtr doc = xmlNewDoc (BAD_CAST "1.0"); 1125 1074 r_inputs = NULL; 1126 r_inputs = getMap (request_inputs, "ServiceProvider"); 1127 xmlNodePtr n; 1128 if (r_inputs != NULL) 1129 n = printGetCapabilitiesHeader (doc, r_inputs->value, m); 1130 else 1131 n = printGetCapabilitiesHeader (doc, "", m); 1132 /** 1133 * Here we need to close stdout to ensure that not supported chars 1134 * has been found in the zcfg and then printed on stdout 1135 */ 1075 //r_inputs = getMap (request_inputs, "ServiceProvider"); 1076 xmlNodePtr n=printGetCapabilitiesHeader(doc,m); 1077 /** 1078 * Here we need to close stdout to ensure that unsupported chars 1079 * has been found in the zcfg and then printed on stdout 1080 */ 1136 1081 int saved_stdout = dup (fileno (stdout)); 1137 1082 dup2 (fileno (stderr), fileno (stdout)); … … 1159 1104 { 1160 1105 r_inputs = getMap (request_inputs, "Identifier"); 1161 if (r_inputs == NULL1162 || strlen (r_inputs->name) == 0 || strlen (r_inputs->value) == 0)1163 {1164 errorException (m, _("Mandatory <identifier> was not specified"),1165 "MissingParameterValue", "identifier");1166 freeMaps (&m);1167 free (m);1168 free (REQUEST);1169 free (SERVICE_URL);1170 return 0;1171 }1172 1106 1173 1107 struct dirent *dp; … … 1185 1119 if (strncasecmp (REQUEST, "DescribeProcess", 15) == 0) 1186 1120 { 1187 1188 1189 1121 /** 1122 * Loop over Identifier list 1123 */ 1190 1124 xmlDocPtr doc = xmlNewDoc (BAD_CAST "1.0"); 1191 1125 r_inputs = NULL; 1192 r_inputs = getMap (request_inputs, "ServiceProvider"); 1193 1194 xmlNodePtr n; 1195 if (r_inputs != NULL) 1196 n = printDescribeProcessHeader (doc, r_inputs->value, m); 1197 else 1198 n = printDescribeProcessHeader (doc, "", m); 1126 xmlNodePtr n = printWPSHeader(doc,m,"DescribeProcess", 1127 "ProcessDescriptions"); 1199 1128 1200 1129 r_inputs = getMap (request_inputs, "Identifier"); … … 1460 1389 sprintf (tmpMsg, 1461 1390 _ 1462 ("The value for <i ndetifier> seems to be wrong (%s). Please, ensure that the process exist using the GetCapabilities request."),1391 ("The value for <identifier> seems to be wrong (%s). Please, ensure that the process exist using the GetCapabilities request."), 1463 1392 r_inputs->value); 1464 1393 errorException (m, tmpMsg, "InvalidParameterValue", "identifier"); … … 1640 1569 #endif 1641 1570 char cursor_input[40960]; 1642 if (r_inputs != NULL) 1571 if (r_inputs != NULL){ 1643 1572 snprintf (cursor_input, 40960, "%s", r_inputs->value); 1644 else 1645 { 1646 errorException (m, _("Parameter <DataInputs> was not specified"), 1647 "MissingParameterValue", "DataInputs"); 1648 freeMaps (&m); 1649 free (m); 1650 free (REQUEST); 1651 free (SERVICE_URL); 1652 InternetCloseHandle (&hInternet); 1653 freeService (&s1); 1654 free (s1); 1655 return 0; 1656 } 1657 j = 0; 1658 1659 /** 1660 * Put each DataInputs into the inputs_as_text array 1661 */ 1662 char *tmp1 = zStrdup (cursor_input); 1663 char *pToken; 1664 pToken = strtok (cursor_input, ";"); 1665 if (pToken != NULL && strncasecmp (pToken, tmp1, strlen (tmp1)) == 0) 1666 { 1667 char *tmp2 = url_decode (tmp1); 1668 snprintf (cursor_input, (strlen (tmp2) + 1) * sizeof (char), "%s", 1669 tmp2); 1670 free (tmp2); 1671 pToken = strtok (cursor_input, ";"); 1672 } 1673 free (tmp1); 1674 1675 char **inputs_as_text = (char **) malloc (100 * sizeof (char *)); 1676 if (inputs_as_text == NULL) 1677 { 1678 return errorException (m, _("Unable to allocate memory."), 1679 "InternalError", NULL); 1680 } 1681 i = 0; 1682 while (pToken != NULL) 1683 { 1684 #ifdef DEBUG 1685 fprintf (stderr, "***%s***\n", pToken); 1686 #endif 1687 fflush (stderr); 1688 #ifdef DEBUG 1689 fprintf (stderr, "***%s***\n", pToken); 1690 #endif 1691 inputs_as_text[i] = 1692 (char *) malloc ((strlen (pToken) + 1) * sizeof (char)); 1693 snprintf (inputs_as_text[i], strlen (pToken) + 1, "%s", pToken); 1694 if (inputs_as_text[i] == NULL) 1695 { 1696 return errorException (m, _("Unable to allocate memory."), 1697 "InternalError", NULL); 1698 } 1699 pToken = strtok (NULL, ";"); 1700 i++; 1701 } 1702 1703 for (j = 0; j < i; j++) 1704 { 1705 char *tmp = zStrdup (inputs_as_text[j]); 1706 free (inputs_as_text[j]); 1707 char *tmpc; 1708 tmpc = strtok (tmp, "@"); 1709 while (tmpc != NULL) 1710 { 1711 #ifdef DEBUG 1712 fprintf (stderr, "***\n***%s***\n", tmpc); 1713 #endif 1714 char *tmpv = strstr (tmpc, "="); 1715 char tmpn[256]; 1716 memset (tmpn, 0, 256); 1717 if (tmpv != NULL) 1718 { 1719 strncpy (tmpn, tmpc, 1720 (strlen (tmpc) - strlen (tmpv)) * sizeof (char)); 1721 tmpn[strlen (tmpc) - strlen (tmpv)] = 0; 1722 } 1723 else 1724 { 1725 strncpy (tmpn, tmpc, strlen (tmpc) * sizeof (char)); 1726 tmpn[strlen (tmpc)] = 0; 1727 } 1728 #ifdef DEBUG 1729 fprintf (stderr, "***\n*** %s = %s ***\n", tmpn, tmpv + 1); 1730 #endif 1731 if (tmpmaps == NULL) 1732 { 1733 tmpmaps = (maps *) malloc (MAPS_SIZE); 1734 if (tmpmaps == NULL) 1735 { 1736 return errorException (m, 1737 _("Unable to allocate memory."), 1738 "InternalError", NULL); 1739 } 1740 tmpmaps->name = zStrdup (tmpn); 1741 if (tmpv != NULL) 1742 { 1743 char *tmpvf = url_decode (tmpv + 1); 1744 tmpmaps->content = createMap ("value", tmpvf); 1745 free (tmpvf); 1746 } 1747 else 1748 tmpmaps->content = createMap ("value", "Reference"); 1749 tmpmaps->next = NULL; 1750 } 1751 tmpc = strtok (NULL, "@"); 1752 while (tmpc != NULL) 1753 { 1754 #ifdef DEBUG 1755 fprintf (stderr, "*** KVP NON URL-ENCODED \n***%s***\n", 1756 tmpc); 1757 #endif 1758 char *tmpv1 = strstr (tmpc, "="); 1759 #ifdef DEBUG 1760 fprintf (stderr, "*** VALUE NON URL-ENCODED \n***%s***\n", 1761 tmpv1 + 1); 1762 #endif 1763 char tmpn1[1024]; 1764 memset (tmpn1, 0, 1024); 1765 if (tmpv1 != NULL) 1766 { 1767 strncpy (tmpn1, tmpc, strlen (tmpc) - strlen (tmpv1)); 1768 tmpn1[strlen (tmpc) - strlen (tmpv1)] = 0; 1769 addToMap (tmpmaps->content, tmpn1, tmpv1 + 1); 1770 } 1771 else 1772 { 1773 strncpy (tmpn1, tmpc, strlen (tmpc)); 1774 tmpn1[strlen (tmpc)] = 0; 1775 map *lmap = getLastMap (tmpmaps->content); 1776 char *tmpValue = 1777 (char *) malloc ((strlen (tmpv) + strlen (tmpc) + 1) * 1778 sizeof (char)); 1779 sprintf (tmpValue, "%s@%s", tmpv + 1, tmpc); 1780 free (lmap->value); 1781 lmap->value = zStrdup (tmpValue); 1782 free (tmpValue); 1783 tmpc = strtok (NULL, "@"); 1784 continue; 1785 } 1786 #ifdef DEBUG 1787 fprintf (stderr, "*** NAME NON URL-ENCODED \n***%s***\n", 1788 tmpn1); 1789 fprintf (stderr, "*** VALUE NON URL-ENCODED \n***%s***\n", 1790 tmpv1 + 1); 1791 #endif 1792 if (strcmp (tmpn1, "xlink:href") != 0) 1793 addToMap (tmpmaps->content, tmpn1, tmpv1 + 1); 1794 else if (tmpv1 != NULL) 1795 { 1796 char *tmpx2 = url_decode (tmpv1 + 1); 1797 if (strncasecmp (tmpx2, "http://", 7) != 0 && 1798 strncasecmp (tmpx2, "ftp://", 6) != 0 && 1799 strncasecmp (tmpx2, "https://", 8) != 0) 1800 { 1801 char emsg[1024]; 1802 sprintf (emsg, 1803 _ 1804 ("Unable to find a valid protocol to download the remote file %s"), 1805 tmpv1 + 1); 1806 errorException (m, emsg, "InternalError", NULL); 1807 freeMaps (&m); 1808 free (m); 1809 free (REQUEST); 1810 free (SERVICE_URL); 1811 InternetCloseHandle (&hInternet); 1812 freeService (&s1); 1813 free (s1); 1814 return 0; 1815 } 1816 #ifdef DEBUG 1817 fprintf (stderr, 1818 "REQUIRE TO DOWNLOAD A FILE FROM A SERVER : url(%s)\n", 1819 tmpv1 + 1); 1820 #endif 1821 addToMap (tmpmaps->content, tmpn1, tmpx2); 1573 j = 0; 1574 1575 /** 1576 * Put each DataInputs into the inputs_as_text array 1577 */ 1578 char *tmp1 = zStrdup (cursor_input); 1579 char *pToken; 1580 pToken = strtok (cursor_input, ";"); 1581 if (pToken != NULL && strncasecmp (pToken, tmp1, strlen (tmp1)) == 0) 1582 { 1583 char *tmp2 = url_decode (tmp1); 1584 snprintf (cursor_input, (strlen (tmp2) + 1) * sizeof (char), "%s", 1585 tmp2); 1586 free (tmp2); 1587 pToken = strtok (cursor_input, ";"); 1588 } 1589 free (tmp1); 1590 1591 char **inputs_as_text = (char **) malloc (100 * sizeof (char *)); 1592 if (inputs_as_text == NULL) 1593 { 1594 return errorException (m, _("Unable to allocate memory."), 1595 "InternalError", NULL); 1596 } 1597 i = 0; 1598 while (pToken != NULL) 1599 { 1600 #ifdef DEBUG 1601 fprintf (stderr, "***%s***\n", pToken); 1602 fflush (stderr); 1603 fprintf (stderr, "***%s***\n", pToken); 1604 #endif 1605 inputs_as_text[i] = 1606 (char *) malloc ((strlen (pToken) + 1) * sizeof (char)); 1607 if (inputs_as_text[i] == NULL) 1608 { 1609 return errorException (m, _("Unable to allocate memory."), 1610 "InternalError", NULL); 1611 } 1612 snprintf (inputs_as_text[i], strlen (pToken) + 1, "%s", pToken); 1613 pToken = strtok (NULL, ";"); 1614 i++; 1615 } 1616 1617 for (j = 0; j < i; j++) 1618 { 1619 char *tmp = zStrdup (inputs_as_text[j]); 1620 free (inputs_as_text[j]); 1621 char *tmpc; 1622 tmpc = strtok (tmp, "@"); 1623 while (tmpc != NULL) 1624 { 1625 #ifdef DEBUG 1626 fprintf (stderr, "***\n***%s***\n", tmpc); 1627 #endif 1628 char *tmpv = strstr (tmpc, "="); 1629 char tmpn[256]; 1630 memset (tmpn, 0, 256); 1631 if (tmpv != NULL) 1632 { 1633 strncpy (tmpn, tmpc, 1634 (strlen (tmpc) - strlen (tmpv)) * sizeof (char)); 1635 tmpn[strlen (tmpc) - strlen (tmpv)] = 0; 1636 } 1637 else 1638 { 1639 strncpy (tmpn, tmpc, strlen (tmpc) * sizeof (char)); 1640 tmpn[strlen (tmpc)] = 0; 1641 } 1642 #ifdef DEBUG 1643 fprintf (stderr, "***\n*** %s = %s ***\n", tmpn, tmpv + 1); 1644 #endif 1645 if (tmpmaps == NULL) 1646 { 1647 tmpmaps = (maps *) malloc (MAPS_SIZE); 1648 if (tmpmaps == NULL) 1649 { 1650 return errorException (m, 1651 _("Unable to allocate memory."), 1652 "InternalError", NULL); 1653 } 1654 tmpmaps->name = zStrdup (tmpn); 1655 if (tmpv != NULL) 1656 { 1657 char *tmpvf = url_decode (tmpv + 1); 1658 tmpmaps->content = createMap ("value", tmpvf); 1659 free (tmpvf); 1660 } 1661 else 1662 tmpmaps->content = createMap ("value", "Reference"); 1663 tmpmaps->next = NULL; 1664 } 1665 tmpc = strtok (NULL, "@"); 1666 while (tmpc != NULL) 1667 { 1668 #ifdef DEBUG 1669 fprintf (stderr, "*** KVP NON URL-ENCODED \n***%s***\n", 1670 tmpc); 1671 #endif 1672 char *tmpv1 = strstr (tmpc, "="); 1673 #ifdef DEBUG 1674 fprintf (stderr, "*** VALUE NON URL-ENCODED \n***%s***\n", 1675 tmpv1 + 1); 1676 #endif 1677 char tmpn1[1024]; 1678 memset (tmpn1, 0, 1024); 1679 if (tmpv1 != NULL) 1680 { 1681 strncpy (tmpn1, tmpc, strlen (tmpc) - strlen (tmpv1)); 1682 tmpn1[strlen (tmpc) - strlen (tmpv1)] = 0; 1683 addToMap (tmpmaps->content, tmpn1, tmpv1 + 1); 1684 } 1685 else 1686 { 1687 strncpy (tmpn1, tmpc, strlen (tmpc)); 1688 tmpn1[strlen (tmpc)] = 0; 1689 map *lmap = getLastMap (tmpmaps->content); 1690 char *tmpValue = 1691 (char *) malloc ((strlen (tmpv) + strlen (tmpc) + 1) * 1692 sizeof (char)); 1693 sprintf (tmpValue, "%s@%s", tmpv + 1, tmpc); 1694 free (lmap->value); 1695 lmap->value = zStrdup (tmpValue); 1696 free (tmpValue); 1697 tmpc = strtok (NULL, "@"); 1698 continue; 1699 } 1700 #ifdef DEBUG 1701 fprintf (stderr, "*** NAME NON URL-ENCODED \n***%s***\n", 1702 tmpn1); 1703 fprintf (stderr, "*** VALUE NON URL-ENCODED \n***%s***\n", 1704 tmpv1 + 1); 1705 #endif 1706 if (strcmp (tmpn1, "xlink:href") != 0) 1707 addToMap (tmpmaps->content, tmpn1, tmpv1 + 1); 1708 else if (tmpv1 != NULL) 1709 { 1710 char *tmpx2 = url_decode (tmpv1 + 1); 1711 if (strncasecmp (tmpx2, "http://", 7) != 0 && 1712 strncasecmp (tmpx2, "ftp://", 6) != 0 && 1713 strncasecmp (tmpx2, "https://", 8) != 0) 1714 { 1715 char emsg[1024]; 1716 sprintf (emsg, 1717 _ 1718 ("Unable to find a valid protocol to download the remote file %s"), 1719 tmpv1 + 1); 1720 errorException (m, emsg, "InternalError", NULL); 1721 freeMaps (&m); 1722 free (m); 1723 free (REQUEST); 1724 free (SERVICE_URL); 1725 InternetCloseHandle (&hInternet); 1726 freeService (&s1); 1727 free (s1); 1728 return 0; 1729 } 1730 #ifdef DEBUG 1731 fprintf (stderr, 1732 "REQUIRE TO DOWNLOAD A FILE FROM A SERVER : url(%s)\n", 1733 tmpv1 + 1); 1734 #endif 1735 addToMap (tmpmaps->content, tmpn1, tmpx2); 1822 1736 #ifndef WIN32 1823 if (CHECK_INET_HANDLE (hInternet)) 1824 #endif 1825 { 1826 if (loadRemoteFile 1827 (&m, &tmpmaps->content, &hInternet, tmpx2) < 0) 1828 { 1829 freeMaps (&m); 1830 free (m); 1831 free (REQUEST); 1832 free (SERVICE_URL); 1833 InternetCloseHandle (&hInternet); 1834 freeService (&s1); 1835 free (s1); 1836 return 0; 1837 } 1838 } 1839 free (tmpx2); 1840 addToMap (tmpmaps->content, "Reference", tmpv1 + 1); 1841 } 1842 tmpc = strtok (NULL, "@"); 1843 } 1844 #ifdef DEBUG 1845 dumpMaps (tmpmaps); 1846 fflush (stderr); 1847 #endif 1848 if (request_input_real_format == NULL) 1849 request_input_real_format = dupMaps (&tmpmaps); 1850 else 1851 { 1852 maps *testPresence = 1853 getMaps (request_input_real_format, tmpmaps->name); 1854 if (testPresence != NULL) 1855 { 1856 elements *elem = 1857 getElements (s1->inputs, tmpmaps->name); 1858 if (elem != NULL) 1859 { 1860 if (appendMapsToMaps 1861 (m, request_input_real_format, tmpmaps, 1862 elem) < 0) 1863 { 1864 freeMaps (&m); 1865 free (m); 1866 free (REQUEST); 1867 free (SERVICE_URL); 1868 InternetCloseHandle (&hInternet); 1869 freeService (&s1); 1870 free (s1); 1871 return 0; 1872 } 1873 } 1874 } 1875 else 1876 addMapsToMaps (&request_input_real_format, tmpmaps); 1877 } 1878 freeMaps (&tmpmaps); 1879 free (tmpmaps); 1880 tmpmaps = NULL; 1881 free (tmp); 1882 } 1883 } 1884 free (inputs_as_text); 1737 if (CHECK_INET_HANDLE (hInternet)) 1738 #endif 1739 { 1740 if (loadRemoteFile 1741 (&m, &tmpmaps->content, &hInternet, tmpx2) < 0) 1742 { 1743 freeMaps (&m); 1744 free (m); 1745 free (REQUEST); 1746 free (SERVICE_URL); 1747 InternetCloseHandle (&hInternet); 1748 freeService (&s1); 1749 free (s1); 1750 return 0; 1751 } 1752 } 1753 free (tmpx2); 1754 addToMap (tmpmaps->content, "Reference", tmpv1 + 1); 1755 } 1756 tmpc = strtok (NULL, "@"); 1757 } 1758 #ifdef DEBUG 1759 dumpMaps (tmpmaps); 1760 fflush (stderr); 1761 #endif 1762 if (request_input_real_format == NULL) 1763 request_input_real_format = dupMaps (&tmpmaps); 1764 else 1765 { 1766 maps *testPresence = 1767 getMaps (request_input_real_format, tmpmaps->name); 1768 if (testPresence != NULL) 1769 { 1770 elements *elem = 1771 getElements (s1->inputs, tmpmaps->name); 1772 if (elem != NULL) 1773 { 1774 if (appendMapsToMaps 1775 (m, request_input_real_format, tmpmaps, 1776 elem) < 0) 1777 { 1778 freeMaps (&m); 1779 free (m); 1780 free (REQUEST); 1781 free (SERVICE_URL); 1782 InternetCloseHandle (&hInternet); 1783 freeService (&s1); 1784 free (s1); 1785 return 0; 1786 } 1787 } 1788 } 1789 else 1790 addMapsToMaps (&request_input_real_format, tmpmaps); 1791 } 1792 freeMaps (&tmpmaps); 1793 free (tmpmaps); 1794 tmpmaps = NULL; 1795 free (tmp); 1796 } 1797 } 1798 free (inputs_as_text); 1799 } 1885 1800 } 1886 1801 else … … 2580 2495 while (cur2 != NULL && cur2->type != XML_ELEMENT_NODE) 2581 2496 cur2 = cur2->next; 2582 int cur1cnt = 0;2583 2497 while (cur2 != NULL) 2584 2498 { … … 2928 2842 * DataInputs and ResponseDocument / RawDataOutput 2929 2843 */ 2930 char *dfv = addDefaultValues (&request_input_real_format, s1->inputs, m, 0); 2844 map* errI=NULL; 2845 dumpMaps(request_input_real_format); 2846 char *dfv = addDefaultValues (&request_input_real_format, s1->inputs, m, 0,&errI); 2847 dumpMaps(request_input_real_format); 2931 2848 maps *ptr = request_input_real_format; 2932 2849 while (ptr != NULL) … … 2968 2885 } 2969 2886 2887 map* errO=NULL; 2970 2888 char *dfv1 = 2971 addDefaultValues (&request_output_real_format, s1->outputs, m, 1 );2889 addDefaultValues (&request_output_real_format, s1->outputs, m, 1,&errO); 2972 2890 if (strcmp (dfv1, "") != 0 || strcmp (dfv, "") != 0) 2973 2891 { 2974 2892 char tmps[1024]; 2975 map *tmpe = createMap ("code", "MissingParameterValue");2893 map *tmpe = NULL; 2976 2894 if (strcmp (dfv, "") != 0) 2977 2895 { 2978 snprintf (tmps, 1024, 2979 _ 2980 ("The <%s> argument was not specified in DataInputs but defined as requested in ZOO ServicesProvider configuration file, please correct your query or the ZOO Configuration file."), 2981 dfv); 2982 addToMap (tmpe, "locator", dfv); 2983 } 2984 else if (strcmp (dfv1, "") != 0) 2896 tmpe = createMap ("code", "MissingParameterValue"); 2897 int nb=0; 2898 int length=1; 2899 map* len=getMap(errI,"length"); 2900 if(len!=NULL) 2901 length=atoi(len->value); 2902 for(nb=0;nb<length;nb++){ 2903 map* errp=getMapArray(errI,"value",nb); 2904 snprintf (tmps, 1024, 2905 _ 2906 ("The <%s> argument was not specified in DataInputs but defined as requested in ZOO ServicesProvider configuration file, please correct your query or the ZOO Configuration file."), 2907 errp->value); 2908 setMapArray (tmpe, "locator", nb , errp->value); 2909 setMapArray (tmpe, "text", nb , tmps); 2910 setMapArray (tmpe, "code", nb , "MissingParameterValue"); 2911 } 2912 } 2913 if (strcmp (dfv1, "") != 0) 2985 2914 { 2986 snprintf (tmps, 1024, 2987 _ 2988 ("The <%s> argument was specified as Output identifier but not defined in the ZOO Configuration File. Please, correct your query or the ZOO Configuration File."), 2989 dfv1); 2990 addToMap (tmpe, "locator", dfv1); 2991 } 2992 addToMap (tmpe, "text", tmps); 2915 int ilength=0; 2916 if(tmpe==NULL) 2917 tmpe = createMap ("code", "InvalidParameterValue"); 2918 else{ 2919 map* len=getMap(tmpe,"length"); 2920 if(len!=NULL) 2921 ilength=atoi(len->value); 2922 } 2923 int nb=0; 2924 int length=1; 2925 map* len=getMap(errO,"length"); 2926 if(len!=NULL) 2927 length=atoi(len->value); 2928 for(nb=0;nb<length;nb++){ 2929 map* errp=getMapArray(errO,"value",nb); 2930 snprintf (tmps, 1024, 2931 _ 2932 ("The <%s> argument was specified as %s identifier but not defined in the ZOO Configuration File. Please, correct your query or the ZOO Configuration File."), 2933 errp->value, 2934 ((getMap(request_inputs,"RawDataOutput")!=NULL)?"RawDataOutput":"ResponseDocument")); 2935 setMapArray (tmpe, "locator", nb+ilength , errp->value); 2936 setMapArray (tmpe, "text", nb+ilength , tmps); 2937 setMapArray (tmpe, "code", nb+ilength , "InvalidParameterValue"); 2938 } 2939 } 2993 2940 printExceptionReportResponse (m, tmpe); 2994 2941 freeService (&s1); … … 3006 2953 freeMaps (&tmpmaps); 3007 2954 free (tmpmaps); 2955 if(errI!=NULL){ 2956 freeMap(&errI); 2957 free(errI); 2958 } 2959 if(errO!=NULL){ 2960 freeMap(&errO); 2961 free(errO); 2962 } 3008 2963 return 1; 3009 2964 }
Note: See TracChangeset
for help on using the changeset viewer.