WebMethodCommon.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #region Copyright © 2015 CLIPSOFT Co.,Ltd. All Rights Reserved.
  2. //
  3. // All rights are reserved. Reproduction or transmission in whole or in part,
  4. // in any form or by any means, electronic, mechanical or otherwise, is
  5. // prohibited without the prior written consent of the copyright owner.
  6. //
  7. // Filename:PatientInfoCtrl.cs
  8. //
  9. #endregion
  10. using System;
  11. using System.Collections.Generic;
  12. using System.Linq;
  13. using System.Text;
  14. using System.ServiceModel;
  15. using System.ServiceModel.Description;
  16. namespace CLIP.eForm.Consent.Dfh.UI
  17. {
  18. /// <summary>
  19. /// 웹서비스 연결 관련 클래스
  20. /// </summary>
  21. /// <remarks>
  22. /// <p>[설계자]</p>
  23. /// <p> 클립소프트 연구소 홍지철 (jchong@clipsoft.co.kr)</p>
  24. /// <p>[원본 작성자]</p>
  25. /// <p> 클립소프트 기술부 이창훈 (chlee@clipsoft.co.kr)</p>
  26. /// <p>[수정 작성자]</p>
  27. /// <p> 클립소프트 기술부 이인희</p>
  28. /// <p>----------------------------------------------------------------------------------------</p>
  29. /// <p>[HISTORY]</p>
  30. /// <p> 2015-07-30 : 최초작성</p>
  31. /// <p>----------------------------------------------------------------------------------------</p>
  32. /// </remarks>
  33. class WebMethodCommon
  34. {
  35. /// <summary>
  36. /// consentWebService를 리턴한다.
  37. /// </summary>
  38. /// <returns></returns>
  39. public static ConsentSvcRef.ConsentSvcSoapClient GetConsentWebService(string serverUrl)
  40. {
  41. ConsentSvcRef.ConsentSvcSoapClient consentWebService = null;
  42. BasicHttpBinding consentSvcBinding = new BasicHttpBinding();
  43. consentSvcBinding.Name = "ConsentSvcSoap";
  44. consentSvcBinding.MaxReceivedMessageSize = 2147483647;
  45. consentSvcBinding.MaxBufferSize = 2147483647;
  46. consentSvcBinding.MaxBufferPoolSize = 2147483647;
  47. consentSvcBinding.BypassProxyOnLocal = false;
  48. consentSvcBinding.AllowCookies = false;
  49. EndpointAddress consentSvcendpoint = new EndpointAddress(serverUrl);
  50. consentWebService = new ConsentSvcRef.ConsentSvcSoapClient(consentSvcBinding, consentSvcendpoint);
  51. ConfigureClientEndPoint(consentWebService.Endpoint);
  52. return consentWebService;
  53. }
  54. /// <summary>
  55. /// hospitalWebService 리턴한다.
  56. /// </summary>
  57. /// <returns></returns>
  58. public static HospitalSvcRef.HospitalSvcSoapClient GetHospitalWebService(string serverUrl)
  59. {
  60. HospitalSvcRef.HospitalSvcSoapClient hospitalWebService = null;
  61. BasicHttpBinding hospitalSvcBinding = new BasicHttpBinding();
  62. hospitalSvcBinding.Name = "HospitalSvcSoap";
  63. hospitalSvcBinding.MaxReceivedMessageSize = 2147483647;
  64. hospitalSvcBinding.MaxBufferSize = 2147483647;
  65. hospitalSvcBinding.MaxBufferPoolSize = 2147483647;
  66. hospitalSvcBinding.BypassProxyOnLocal = false;
  67. hospitalSvcBinding.AllowCookies = false;
  68. EndpointAddress hospitalSvcendpoint = new EndpointAddress(serverUrl);
  69. hospitalWebService = new HospitalSvcRef.HospitalSvcSoapClient(hospitalSvcBinding, hospitalSvcendpoint);
  70. ConfigureClientEndPoint(hospitalWebService.Endpoint);
  71. return hospitalWebService;
  72. }
  73. private static void ConfigureClientEndPoint(ServiceEndpoint endPoint)
  74. {
  75. //개체 그래프에서 직렬화 또는 역직렬화할 수 있는 최대 항목 수는 '65536'입니다. 개체 그래프를 변경하거나 MaxItemsInObjectGraph 할당량을 늘리십시오.
  76. foreach (OperationDescription operation in endPoint.Contract.Operations)
  77. {
  78. DataContractSerializerOperationBehavior dataContractBehavior = operation.Behaviors.Find<DataContractSerializerOperationBehavior>();
  79. if (dataContractBehavior != null)
  80. {
  81. dataContractBehavior.MaxItemsInObjectGraph = int.MaxValue;
  82. }
  83. }
  84. }
  85. }
  86. }