00001 /*** Copyright (c), The Regents of the University of California *** 00002 *** For more information please refer to files in the COPYRIGHT directory ***/ 00003 00004 /** 00005 * @file nedMS.c 00006 * 00007 * @brief Access to web services from NVO for NASA/IPAC Extragalactic Database (NED) 00008 * 00009 * These microservices handle communication with http://voservices.net/NED/ws_v2_0/NED.asmx 00010 * and provide answers to queries to the NED database. 00011 * 00012 * @author Arcot Rajasekar / University of California, San Diego, Jan 2008 00013 */ 00014 00015 #include "rsApiHandler.h" 00016 #include "nedMS.h" 00017 #include "nedH.h" 00018 #include "ned.nsmap" 00019 00020 00021 /** 00022 * \fn msiObjByName(msParam_t* inObjByNameParam, msParam_t* outRaParam, msParam_t* outDecParam, msParam_t* outTypParam, ruleExecInfo_t* rei ) 00023 * 00024 * \brief This microservice executes a web service to retrieve astronomy image by name. 00025 * 00026 * \module webservices 00027 * 00028 * \since pre-2.1 00029 * 00030 * \author Arcot Rajasekar 00031 * \date 2008-05 00032 * 00033 * \note It returns position and type of an astronomical object given a 00034 * name from the NASA/IPAC Extragalactic Database (NED) using web service at 00035 * http://voservices.net/NED/ws_v2_0/NED.asmx 00036 * 00037 * \usage See clients/icommands/test/rules3.0/ 00038 * 00039 * \param[in] inObjByNameParam - a msParam of type STR_MS_T which is an astronomical object name. 00040 * \param[out] outRaParam - a msParam of type STR_MS_T which is a Right Ascension as float as string. 00041 * \param[out] outDecParam - a msParam of type STR_MS_T which is a Declination as float as string. 00042 * \param[out] outTypParam - a msParam of type STR_MS_T which is a type of object (eg star, galaxy,...). 00043 * \param[in,out] rei - The RuleExecInfo structure that is automatically 00044 * handled by the rule engine. The user does not include rei as a 00045 * parameter in the rule invocation. 00046 * 00047 * \DolVarDependence none 00048 * \DolVarModified none 00049 * \iCatAttrDependence none 00050 * \iCatAttrModified none 00051 * \sideeffect none 00052 * 00053 * \return integer 00054 * \retval 0 on success 00055 * \pre none 00056 * \post none 00057 * \sa none 00058 **/ 00059 int 00060 msiObjByName(msParam_t* inObjByNameParam, 00061 msParam_t* outRaParam, 00062 msParam_t* outDecParam, 00063 msParam_t* outTypParam, 00064 ruleExecInfo_t* rei ) 00065 { 00066 00067 struct soap *soap = soap_new(); 00068 struct _ns1__ObjByName objByName; 00069 struct _ns1__ObjByNameResponse objByNameResponse; 00070 char response [1000]; 00071 00072 00073 00074 RE_TEST_MACRO( " Calling msiObjByName" ); 00075 00076 objByName.objname = (char *) inObjByNameParam->inOutStruct; 00077 00078 soap_init(soap); 00079 soap_set_namespaces(soap, ned_namespaces); 00080 00081 if (soap_call___ns2__ObjByName(soap, NULL, NULL, &objByName, &objByNameResponse) == SOAP_OK) { 00082 sprintf(response,"%f",objByNameResponse.ObjByNameResult->ra); 00083 fillMsParam( outRaParam, NULL, STR_MS_T, response, NULL ); 00084 sprintf(response,"%f",objByNameResponse.ObjByNameResult->dec); 00085 fillMsParam( outDecParam, NULL, STR_MS_T, response, NULL ); 00086 fillMsParam( outTypParam, NULL, 00087 STR_MS_T, objByNameResponse.ObjByNameResult->objtype, NULL ); 00088 return(0); 00089 } 00090 else { 00091 snprintf(response,999, "Error in execution of msiObjByName::%s\n",soap->buf); 00092 fillMsParam( outTypParam, NULL, 00093 STR_MS_T, response, NULL ); 00094 return(0); 00095 } 00096 } 00097