프로젝트

일반

사용자정보

통계
| 브랜치(Branch): | 개정판:

markus / KCOM_API_AutoStamping / AutoApprovalTest.aspx.cs @ e1c892f7

이력 | 보기 | 이력해설 | 다운로드 (2.38 KB)

1
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
using System.Net;
5
using System.Web;
6
using System.Web.UI;
7
using System.Web.UI.WebControls;
8
using System.Xml;
9

    
10
namespace KCOM_API_AutoStamping
11
{
12
    public partial class AutoApprovalTest : System.Web.UI.Page
13
    {
14
        protected void Page_Load(object sender, EventArgs e)
15
        {
16
        }
17

    
18
        protected void Button1_Click(object sender, EventArgs e)
19
        {
20
            string project_no = this.txtproject_no.Text.Trim().ToString();
21
            string slip_no = this.txtslip_no.Text.Trim().ToString();
22
            string user_id = this.txtuser_id.Text.Trim().ToString();
23

    
24
            WebClient client = new WebClient();
25
            string reqstr = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">"
26
                            + "<soapenv:Header/>"
27
                            + "<soapenv:Body>"
28
                            + "<AutoStamping>"
29
                            + "<project_no>" + project_no + "</project_no>"
30
                            + "<slip_no>" + slip_no + "</slip_no>"
31
                            + "<user_id>" + user_id + "</user_id>"
32
                            + "</AutoStamping>"
33
                            + "</soapenv:Body>"
34
                            + "</soapenv:Envelope>";
35
            client.Headers.Add(HttpRequestHeader.ContentType, "text/xml");
36
            client.Headers.Add("SOAPAction", "urn:Common/AutoStamping");
37

    
38
             
39

    
40
            string _result = client.UploadString(new Uri($"http://{Request.Url.Host.ToString()}:{Request.Url.Port}/AutoStamping.svc"), reqstr);
41
            XmlTextReader reader = new XmlTextReader(new System.IO.StringReader(_result));
42
            string msg = "Success";
43

    
44
            while (reader.Read())
45
            {
46
                switch (reader.NodeType)
47
                {
48
                    case XmlNodeType.Element:
49
                        if (reader.Name == "AutoStampingResult")
50
                        {
51
                            reader.Read();
52
                            if (!string.IsNullOrEmpty(reader.Value))
53
                                msg = "Error:" + reader.Value;
54
                        }
55
                        break;
56
                }
57
            }
58

    
59
            Response.Write("<script language='Javascript'> ");
60
            Response.Write("alert('" + msg + "'); ");
61
            Response.Write("</script>");
62
        }
63
    }
64
}
클립보드 이미지 추가 (최대 크기: 500 MB)