public string getLab5Results(int patient_id, ref string test_results) { // create the proxy object so that we can call it later proxy = new WebService4.WebService4Client("BasicHttpBinding_IWebService4"); string strReturnMessage = proxy.getLab4Results(patient_id, ref test_results); strReturnMessage = strReturnMessage + test_results; test_results = "WS5 Test Results are Excellent\n"; return("WS5/getLab5Results\n" + strReturnMessage); }
public bool checkClientCompatWithServiceMethod(int WS_ID, string strTargetMethodName, ref string strOverallCompatibilityMessage, ref Guid gid, ref string strIncentive) { // Check the compatibility between the client and a particular web service. // Note: a check is done on the method name as well as the parameters that are specified (among the 4 optional); // for the parameters, a check is also made for param name + "_PR" and param name "_EXP" to find resources that // are defined for "practice" and "expectation" populateClientAssertionsArray(c_intWebClient_ID, WS_ID, strTargetMethodName); //*********************************************************** // Call web service to get privacy policy for this method // Assumption: service will return a jagged array (which WCF passes via XML) string[][] JaggedArrayAssertions_WebService; JaggedArrayAssertions_WebService = new string[50][]; switch (WS_ID) { case 1: proxy1 = new WebService1.WebService1Client(); JaggedArrayAssertions_WebService = proxy1.getPrivacyPolicyArray(WS_ID, WS_ID, strTargetMethodName, ref gid, ref strIncentive); break; case 2: proxy2 = new WebService2.WebService2Client(); JaggedArrayAssertions_WebService = proxy2.getPrivacyPolicyArray(WS_ID, WS_ID, strTargetMethodName, ref gid, ref strIncentive); break; case 3: proxy3 = new WebService3.WebService3Client(); JaggedArrayAssertions_WebService = proxy3.getPrivacyPolicyArray(WS_ID, WS_ID, strTargetMethodName, ref gid, ref strIncentive); break; case 4: proxy4 = new WebService4.WebService4Client(); JaggedArrayAssertions_WebService = proxy4.getPrivacyPolicyArray(WS_ID, WS_ID, strTargetMethodName, ref gid, ref strIncentive); break; case 5: proxy5 = new WebService5.WebService5Client(); JaggedArrayAssertions_WebService = proxy5.getPrivacyPolicyArray(WS_ID, WS_ID, strTargetMethodName, ref gid, ref strIncentive); break; default: // we should never get here return(false); } // Populate array ArrayAssertions_WebService with Privacy Policy info from web service ArrayAssertions_WebService = new string[50, 16]; for (int i = 0; i < 50; i++) { if (JaggedArrayAssertions_WebService[i][iRule_ID] == null) { // don't put null items in the 2D assertions array break; } ArrayAssertions_WebService[i, iRule_ID] = JaggedArrayAssertions_WebService[i][iRule_ID]; ArrayAssertions_WebService[i, iRule_Item_ID] = JaggedArrayAssertions_WebService[i][iRule_Item_ID]; ArrayAssertions_WebService[i, iResource_ID] = JaggedArrayAssertions_WebService[i][iResource_ID]; ArrayAssertions_WebService[i, iResource_Name] = JaggedArrayAssertions_WebService[i][iResource_Name]; ArrayAssertions_WebService[i, iWeight] = JaggedArrayAssertions_WebService[i][iWeight]; ArrayAssertions_WebService[i, iMandatory_Flag] = JaggedArrayAssertions_WebService[i][iMandatory_Flag]; ArrayAssertions_WebService[i, iDomain_ID] = JaggedArrayAssertions_WebService[i][iDomain_ID]; ArrayAssertions_WebService[i, iDomain_Name] = JaggedArrayAssertions_WebService[i][iDomain_Name]; ArrayAssertions_WebService[i, iScope_ID] = JaggedArrayAssertions_WebService[i][iScope_ID]; ArrayAssertions_WebService[i, iScope] = JaggedArrayAssertions_WebService[i][iScope]; ArrayAssertions_WebService[i, iClientOrSvcName] = JaggedArrayAssertions_WebService[i][iClientOrSvcName]; ArrayAssertions_WebService[i, iPriv_Match_Threshold] = JaggedArrayAssertions_WebService[i][iPriv_Match_Threshold]; ArrayAssertions_WebService[i, iTopic_ID] = JaggedArrayAssertions_WebService[i][iTopic_ID]; ArrayAssertions_WebService[i, iTopic] = JaggedArrayAssertions_WebService[i][iTopic]; ArrayAssertions_WebService[i, iLevel_ID] = JaggedArrayAssertions_WebService[i][iLevel_ID]; ArrayAssertions_WebService[i, iLevel] = JaggedArrayAssertions_WebService[i][iLevel]; intWSAssertCount++; } //******************************************************************************************************** // Now we have Client Assertions as well as Web Service Method Assertions // So we can now compare the two to check compatibility float flWeight = 0; float flTotalWeight = 0; bool blnCompatible = true; bool blnCompatibleOverall = true; if ((intClientAssertCount == 0) || (intWSAssertCount == 0)) { // we should never get here; this would mean there are no assertions in the database for client or web service blnCompatible = false; } else { string strCompatibilityMessage = ""; for (int i = 0; i < intClientAssertCount; i++) { // check each client resource PR against web service method PP blnCompatible = checkClientServiceCompat_ForItem(i, ref flWeight, ref strCompatibilityMessage); strOverallCompatibilityMessage = strOverallCompatibilityMessage + "(" + (i + 1).ToString() + ") " + strCompatibilityMessage + "\n"; if (blnCompatible) { // non-mandatory items are always considered "compatible"; but they have a weight of zero flTotalWeight = flTotalWeight + flWeight; flWeight = 0; // initialize } else { blnCompatibleOverall = false; } } // need to put in form where we drop imprecise last digits of float string strTotalWeight = flTotalWeight.ToString("0.##"); // put back into float bool blnIsFloat = float.TryParse(strTotalWeight, out flTotalWeight); } //********************************************** // if we are compatible overall, check to make sure we have met our threshold number for the sum of weights // of all the matching items if (blnCompatibleOverall) { // Priv_Match_Threshold float flPrivacyMatchingThreshold = 0; bool blnIsFloat = float.TryParse(ArrayAssertions_Client[0, iPriv_Match_Threshold].ToString(), out flPrivacyMatchingThreshold); // we should always get a float back for this value if (blnIsFloat) { if (flTotalWeight >= flPrivacyMatchingThreshold) { // we have met the threshold set by the client; we are still compatible strOverallCompatibilityMessage = strOverallCompatibilityMessage + "We have met threshold set by client: Total Weight (of matched) " + flTotalWeight.ToString() + " >= Threshold " + flPrivacyMatchingThreshold.ToString() + "\nAll mismatched items are non-mandatory. Now calling method..."; } else { // we have not met the threshold set by the client strOverallCompatibilityMessage = strOverallCompatibilityMessage + " Did not meet threshold set by client: Total Weight " + flTotalWeight.ToString() + " < Threshold " + flPrivacyMatchingThreshold.ToString(); blnCompatibleOverall = false; } } else { // we did not get a float back for this threshold value; we should never get here strOverallCompatibilityMessage = strOverallCompatibilityMessage + " Did not get float back for threshold value"; blnCompatibleOverall = false; } } //********************************************** return(blnCompatibleOverall); }