public Get_SimpleSmResult WTB_Get_PIDSimpleSmInfoEC(string midSiteId, string ISOwebsite, List <string> productId) { Get_SimpleSmResult result = new Get_SimpleSmResult(); var requestData = new List <Get_PIDSimpleSmObjRequest>(); requestData.Add(new Get_PIDSimpleSmObjRequest() { websiteid = midSiteId, ISOwebsite = ISOwebsite, pid = productId }); string responseJsonStr = ""; string responseXML = ""; try { string strPostData = JsonConvert.SerializeObject(requestData); var header = new WtbHeader() { apiId = this.WhereToBuySystem_apiid, apikey = WhereToBuySystem_apikey }; var body = new WtbBody_Get_WTB() { Data = strPostData }; string strHeader = AOCC_ApiHelper.SetXMLString(header); string strBody = AOCC_ApiHelper.SetXMLString(body, true, "Get_PIDSimpleSmInfoEC"); DateTime requestStartTime = DateTime.Now; responseXML = AOCC_ApiHelper.ToPostSoapRequestWithXML(WTB_Host, strHeader, strBody); responseJsonStr = AOCC_ApiHelper.GetXmlStringData(responseXML, "Get_PIDSimpleSmInfoECResult"); var tmpResult = JsonConvert.DeserializeObject <Get_SimpleSmResponseResult>(responseJsonStr); oLogService.InsertExternalAPILog(MethodBase.GetCurrentMethod().Name, requestStartTime, DateTime.Now, Get_WTB_Url, "", $"strHeader : {strHeader}; strBody : {strBody}", responseJsonStr); if (tmpResult != null && tmpResult.Status == "1") { throw new Exception("WTB System Error : " + tmpResult.Message); } if (tmpResult != null && tmpResult.Status == "0") { result = tmpResult.lists; } } catch (Exception ex) { oLogService.InsertExternalApiErrorLog(MethodBase.GetCurrentMethod().Name, Get_WTB_Url, responseXML, responseJsonStr, ex.Message); } return(result); }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public List <Get_WtbResponseObj> WTB_Get_WTB(string website, string type, List <string> partNo) { DateTime requestStartTime = DateTime.Now; Get_WtbRootResponseResult result = new Get_WtbRootResponseResult(); var requestData = new List <Get_WtbObjRequest>(); requestData.Add(new Get_WtbObjRequest() { website = website, type = type, sku_member = partNo }); string responseJsonStr = ""; string responseXML = ""; try { string strPostData = JsonConvert.SerializeObject(requestData); var header = new WtbHeader() { apiId = this.WhereToBuySystem_apiid, apikey = WhereToBuySystem_apikey }; var body = new WtbBody_Get_WTB() { Data = strPostData }; string strHeader = AOCC_ApiHelper.SetXMLString(header); string strBody = AOCC_ApiHelper.SetXMLString(body, true, "Get_WTB"); responseXML = AOCC_ApiHelper.ToPostSoapRequestWithXML(WTB_Host, strHeader, strBody); responseJsonStr = AOCC_ApiHelper.GetXmlStringData(responseXML, "Get_WTBResult"); result = JsonConvert.DeserializeObject <List <Get_WtbRootResponseResult> >(responseJsonStr)?.FirstOrDefault(); if (result != null) { if (result.Status == "1") { throw new Exception("WTB System Error : " + result.Message); } oLogService.InsertExternalAPILog(MethodBase.GetCurrentMethod().Name, requestStartTime, DateTime.Now, Get_WTB_Url, "", $"strHeader : {strHeader}; strBody : {strBody}", responseJsonStr); } } catch (Exception ex) { oLogService.InsertExternalApiErrorLog(MethodBase.GetCurrentMethod().Name, Get_WTB_Url, responseXML, responseJsonStr, ex.Message); } return(result.lists); }