Esempio n. 1
0
        public frmExample()
        {
            InitializeComponent();

            //초기화
            faxService = new FaxService(LinkID, SecretKey);
            //테스트를 완료한후 아래 변수를 false로 변경하거나, 아래줄을 삭제하여 상업용 환경으로 전환.
            faxService.IsTest = true;
        }
 public FaxServiceTest(MockHttpClientFixture mockHttpClientFixture)
     : base(mockHttpClientFixture)
 {
     _faxService    = new FaxService();
     faxListOptions = new FaxListOptions
     {
         CreatedAtDateGreaterThan = DateTime.UtcNow.ToString()
     };
     faxSendOptions = new FaxSendOptions
     {
         ConnectionId = "222344",
         From         = "3125555555",
         To           = "4432232257",
         MediaUrl     = "Google.com",
     };
 }
Esempio n. 3
0
    public FaxInstance()
    {
        //팩스 서비스 객체 초기화
        faxService = new FaxService(linkID, secretKey);

        //연동환경 설정값, 개발용(true), 상업용(false)
        faxService.IsTest = true;

        //인증토큰의 IP제한기능 사용여부, 권장(true)
        faxService.IPRestrictOnOff = true;

        // 팝빌 API 서비스 고정 IP 사용여부, true-사용, false-미사용, 기본값(false)
        faxService.UseStaticIP = false;

        // 로컬 시스템시간 사용 여부, true(사용) - 기본값, fasle(미사용)
        faxService.UseLocalTimeYN = true;
    }
Esempio n. 4
0
 public FaxController(FaxInstance FAXinstance)
 {
     // 팩스 서비스 객체 생성
     _faxService = FAXinstance.faxService;
 }
    //发送传真
    protected void btnSendFax_Click(object sender, EventArgs e)
    {
        string path = GetImageByWeb();

        if (!File.Exists(path + ".jpg"))
        {
            path = GetImageByWeb();
        }
        //detailMessageContent.InnerHtml = "Message:" + path;
        FaxService fax = new FaxService();
        fax.Timeout = 1200000;
        string xml = ""; //ToServiceXML.getSendFaxToServerXMLStr(path + ".jpg"); //拼装xml数据
        string sendFaxToServerBack = fax.SendFaxToServer(xml); //开始远程调用
        string sendFaxToServerBack1 = sendFaxToServerBack.Replace(">", ">\r\n");
        //tb_XML.Text = sendFaxToServerBack1;

        ///////////////////////////////////解析反馈结果///////////////////////////////////////
        XmlDocument m_XmlDoc = new XmlDocument();
        try
        {
            m_XmlDoc.LoadXml(sendFaxToServerBack);
            XmlNamespaceManager nsmgr = new XmlNamespaceManager(m_XmlDoc.NameTable);
            XmlNodeList nodeList = m_XmlDoc.ChildNodes;
            XmlNode node = nodeList.Item(1);
            string ErrorFlag = node.FirstChild.SelectSingleNode("Header").SelectSingleNode("ErrorFlag").InnerText;
            string ReturnMessage = node.FirstChild.SelectSingleNode("Header").SelectSingleNode("ReturnMessage").InnerText;
            string JobNo = "";
            string JobResult = "";
            string TotalNum = "";
            string ValidNum = "";
            try
            {
                JobNo = node.FirstChild.SelectSingleNode("SendFaxToServerResponse").SelectSingleNode("SendFaxToServerResult").SelectSingleNode("JobNo").InnerText;
                JobResult = node.FirstChild.SelectSingleNode("SendFaxToServerResponse").SelectSingleNode("SendFaxToServerResult").SelectSingleNode("JobResult").InnerText;
                TotalNum = node.FirstChild.SelectSingleNode("SendFaxToServerResponse").SelectSingleNode("SendFaxToServerResult").SelectSingleNode("TotalNum").InnerText;
                ValidNum = node.FirstChild.SelectSingleNode("SendFaxToServerResponse").SelectSingleNode("SendFaxToServerResult").SelectSingleNode("ValidNum").InnerText;
            }
            catch (Exception ex)
            {
                ex.GetBaseException();
            }
            string queryResultS = "";
            queryResultS = queryResultS + "ErrorFlag :" + ErrorFlag + "\r\n" + "ReturnMessage:" + ReturnMessage + "\r\n" + "JobNo :" + JobNo + "\r\n" +
                "JobResult :" + JobResult + "\r\n" + "TotalNum :" + TotalNum + "\r\n" + "ValidNum :" + ValidNum + "\r\n";

            //tb_SendFaxToServer.Text = queryResultS;

            //File.Delete(path);
            detailMessageContent.InnerHtml = "Message:" + ReturnMessage;
        }
        catch (Exception ex)
        {
            ex.GetBaseException();
        }
    }
    public static string SendFax(string type, string orderID, string path, string fileName, string ContentType, string ClientTaskID, string FaxNumber, string faxType)
    {
        string sendFaxToServerBack = "";
        try
        {
            FaxService fax = new FaxService();
            fax.Timeout = 1200000;
            string xml = ToServiceXML.getSendFaxToServerXMLStr(path, fileName, ContentType, ClientTaskID, FaxNumber); //拼装xml数据
            sendFaxToServerBack = fax.SendFaxToServer(xml); //开始远程调用
            string sendFaxToServerBack1 = sendFaxToServerBack.Replace(">", ">\r\n");
        }
        catch (Exception ex)
        {
            ex.GetBaseException();
            return "递交失败,请重试!";
        }

        ///////////////////////////////////解析反馈结果///////////////////////////////////////
        XmlDocument m_XmlDoc = new XmlDocument();
        string queryResultS = "";
        try
        {
            m_XmlDoc.LoadXml(sendFaxToServerBack);
            XmlNamespaceManager nsmgr = new XmlNamespaceManager(m_XmlDoc.NameTable);
            XmlNodeList nodeList = m_XmlDoc.ChildNodes;
            XmlNode node = nodeList.Item(1);
            string ErrorFlag = node.FirstChild.SelectSingleNode("Header").SelectSingleNode("ErrorFlag").InnerText;
            string ReturnMessage = node.FirstChild.SelectSingleNode("Header").SelectSingleNode("ReturnMessage").InnerText;
            string JobNo = "";
            string JobResult = "";
            string TotalNum = "";
            string ValidNum = "";
            try
            {
                JobNo = node.FirstChild.SelectSingleNode("SendFaxToServerResponse").SelectSingleNode("SendFaxToServerResult").SelectSingleNode("JobNo").InnerText;
                JobResult = node.FirstChild.SelectSingleNode("SendFaxToServerResponse").SelectSingleNode("SendFaxToServerResult").SelectSingleNode("JobResult").InnerText;
                TotalNum = node.FirstChild.SelectSingleNode("SendFaxToServerResponse").SelectSingleNode("SendFaxToServerResult").SelectSingleNode("TotalNum").InnerText;
                ValidNum = node.FirstChild.SelectSingleNode("SendFaxToServerResponse").SelectSingleNode("SendFaxToServerResult").SelectSingleNode("ValidNum").InnerText;
            }
            catch (Exception ex)
            {
                ex.GetBaseException();
            }
            queryResultS = queryResultS + "ErrorFlag :" + ErrorFlag + "\r\n" + "ReturnMessage:" + ReturnMessage + "\r\n" + "JobNo :" + JobNo + "\r\n" +
                "JobResult :" + JobResult + "\r\n" + "TotalNum :" + TotalNum + "\r\n" + "ValidNum :" + ValidNum + "\r\n";
            OrderFaxDetialUpdate(type, JobNo, path, ErrorFlag, orderID, ClientTaskID, faxType);
            return ReturnMessage;
        }
        catch (Exception ex)
        {
            ex.GetBaseException();
            return "递交失败,请重试!";
        }
    }
Esempio n. 7
0
        public static int QueryFaxList()
        {
            int iCount = 0;
            /////////////////////////////////////接收传真///////////////////////////////////
            FaxService fax = new FaxService();

            string xml = ToServiceXML.getQueryResultForRecvTaskXMLstr(); //拼装xml数据
            string QueryResultForRecvTaskBack = "";
            //string QueryResultForRecvTaskBack1 = "";
            string filePath = ConfigurationManager.AppSettings["UploadFile"].ToString() + "\\";
            while (!String.IsNullOrEmpty(QueryResultForRecvTaskBack = fax.QueryResultForRecvTask(xml)))
            {
                iCount++;
                ; //开始远程调用
                //QueryResultForRecvTaskBack1 = QueryResultForRecvTaskBack.Replace(">", ">\r\n");
                //tb_XML.Text = QueryResultForRecvTaskBack1;

                ///////////////////////////////////解析反馈结果(只接收一个传真)///////////////////////////////////////

                XmlDocument m_XmlDoc = new XmlDocument();
                try
                {
                    m_XmlDoc.LoadXml(QueryResultForRecvTaskBack);
                    XmlNamespaceManager nsmgr = new XmlNamespaceManager(m_XmlDoc.NameTable);
                    XmlNodeList nodeList = m_XmlDoc.ChildNodes;
                    XmlNode node = nodeList.Item(1);
                    string ErrorFlag = node.FirstChild.SelectSingleNode("Header").SelectSingleNode("ErrorFlag").InnerText;
                    string ReturnMessage = node.FirstChild.SelectSingleNode("Header").SelectSingleNode("ReturnMessage").InnerText;
                    string ServerTaskID = node.FirstChild.SelectSingleNode("QueryResultForRecvTaskResponse").SelectSingleNode("QueryResultForRecvTaskResult").SelectSingleNode("RecvFaxResult").SelectSingleNode("ServerTaskID").InnerText;
                    string FaxNumber = node.FirstChild.SelectSingleNode("QueryResultForRecvTaskResponse").SelectSingleNode("QueryResultForRecvTaskResult").SelectSingleNode("RecvFaxResult").SelectSingleNode("FaxNumber").InnerText;
                    string CallingNumber = node.FirstChild.SelectSingleNode("QueryResultForRecvTaskResponse").SelectSingleNode("QueryResultForRecvTaskResult").SelectSingleNode("RecvFaxResult").SelectSingleNode("CallingNumber").InnerText;
                    string FaxSID = node.FirstChild.SelectSingleNode("QueryResultForRecvTaskResponse").SelectSingleNode("QueryResultForRecvTaskResult").SelectSingleNode("RecvFaxResult").SelectSingleNode("FaxSID").InnerText;
                    string Result = node.FirstChild.SelectSingleNode("QueryResultForRecvTaskResponse").SelectSingleNode("QueryResultForRecvTaskResult").SelectSingleNode("RecvFaxResult").SelectSingleNode("Result").InnerText;
                    string StartTime = node.FirstChild.SelectSingleNode("QueryResultForRecvTaskResponse").SelectSingleNode("QueryResultForRecvTaskResult").SelectSingleNode("RecvFaxResult").SelectSingleNode("StartTime").InnerText;
                    string CostTime = node.FirstChild.SelectSingleNode("QueryResultForRecvTaskResponse").SelectSingleNode("QueryResultForRecvTaskResult").SelectSingleNode("RecvFaxResult").SelectSingleNode("CostTime").InnerText;
                    string NumOfPages = node.FirstChild.SelectSingleNode("QueryResultForRecvTaskResponse").SelectSingleNode("QueryResultForRecvTaskResult").SelectSingleNode("RecvFaxResult").SelectSingleNode("NumOfPages").InnerText;
                    string RecvFileName = node.FirstChild.SelectSingleNode("QueryResultForRecvTaskResponse").SelectSingleNode("QueryResultForRecvTaskResult").SelectSingleNode("RecvFaxResult").SelectSingleNode("RecvFileName").InnerText;
                    string FileSize = node.FirstChild.SelectSingleNode("QueryResultForRecvTaskResponse").SelectSingleNode("QueryResultForRecvTaskResult").SelectSingleNode("RecvFaxResult").SelectSingleNode("FileSize").InnerText;
                    string BillingFee = node.FirstChild.SelectSingleNode("QueryResultForRecvTaskResponse").SelectSingleNode("QueryResultForRecvTaskResult").SelectSingleNode("RecvFaxResult").SelectSingleNode("BillingFee").InnerText;
                    string fileName = node.FirstChild.SelectSingleNode("QueryResultForRecvTaskResponse").SelectSingleNode("QueryResultForRecvTaskResult").SelectSingleNode("Document").Attributes.GetNamedItem("FileName").Value;
                    string ContentType = node.FirstChild.SelectSingleNode("QueryResultForRecvTaskResponse").SelectSingleNode("QueryResultForRecvTaskResult").SelectSingleNode("Document").Attributes.GetNamedItem("ContentType").Value;
                    string EncodingType = node.FirstChild.SelectSingleNode("QueryResultForRecvTaskResponse").SelectSingleNode("QueryResultForRecvTaskResult").SelectSingleNode("Document").Attributes.GetNamedItem("EncodingType").Value;
                    string DocumentExtension = node.FirstChild.SelectSingleNode("QueryResultForRecvTaskResponse").SelectSingleNode("QueryResultForRecvTaskResult").SelectSingleNode("Document").Attributes.GetNamedItem("DocumentExtension").Value;
                    string filestr = node.FirstChild.SelectSingleNode("QueryResultForRecvTaskResponse").SelectSingleNode("QueryResultForRecvTaskResult").SelectSingleNode("Document").InnerText;
                    string fileUrl = "";
                    filestr = filestr == null ? "" : filestr.Trim();
                    if (!filestr.Equals(""))
                    {
                        ToBase64.SaveDecodingToFile(filestr, filePath + fileName);
                        //file = "文件存放在:" + "d:\\35fax\\" + fileName;
                        fileUrl = UploadFile(filePath + fileName);
                    }

                    AutoReciveFaxDA.SaveAutoReciveFax(fileUrl, "CMSJOB", ServerTaskID, CallingNumber);
                    //string queryResultS = "";
                    //queryResultS = queryResultS + "ErrorFlag :" + ErrorFlag + "\r\n" + "ReturnMessage:" + ReturnMessage + "\r\n" + "ServerTaskID :" + ServerTaskID + "\r\n" +
                    //    "FaxNumber :" + FaxNumber + "\r\n" + "CallingNumber :" + CallingNumber + "\r\n" + "FaxSID :" + FaxSID + "\r\n" + "Result :" + Result + "\r\n" +
                    //    "StartTime :" + StartTime + "\r\n" + "CostTime :" + CostTime + "\r\n" + "NumOfPages :" + NumOfPages + "\r\n" + "RecvFileName :" + RecvFileName + "\r\n" +
                    //    "FileSize :" + FileSize + "\r\n" + "BillingFee :" + BillingFee + "\r\n" + file + "\r\n";
                    //tb_QueryResultForRecvTask.Text = queryResultS;
                }
                catch (Exception ex)
                {
                    ex.GetBaseException();
                }
            }

            return iCount;
        }
Esempio n. 8
0
 public FaxExample()
 {
     _faxService = new FaxService();
 }