Example #1
0
        public SoapRequester(SoapRequestInfo soapRequestInfo, Func <SoapRequestInfo, IHttpWebRequest> createHttpWebRequest)
        {
            Ensure.IsNotNull(soapRequestInfo, nameof(soapRequestInfo));
            Ensure.IsNotNull(createHttpWebRequest, nameof(createHttpWebRequest));

            _soapRequestInfo      = soapRequestInfo;
            _createHttpWebRequest = createHttpWebRequest;
        }
        public RequestXmlWriter(StreamWriter streamWriter, SoapRequestInfo soapRequestInfo)
        {
            Ensure.IsNotNull(streamWriter, nameof(streamWriter));
            Ensure.IsNotNull(soapRequestInfo, nameof(soapRequestInfo));

            _streamWriter    = streamWriter;
            _soapRequestInfo = soapRequestInfo;
        }
Example #3
0
        public static IHttpWebRequest Create(SoapRequestInfo soapRequestInfo, IWebRequestFactory webRequestFactory)
        {
            Ensure.IsNotNull(soapRequestInfo, nameof(soapRequestInfo));

            var httpWebRequest = webRequestFactory.CreateHttpWebRequest(soapRequestInfo.Url);

            httpWebRequest.Credentials = soapRequestInfo.Credentials;
            httpWebRequest.Method      = "POST";
            httpWebRequest.ContentType = "text/xml; charset=utf-8";
            httpWebRequest.Headers.Add("SOAPACTION", $"{soapRequestInfo.ServiceNameSpace}#{soapRequestInfo.ActionName}");
            httpWebRequest.ProtocolVersion = HttpVersion.Version11;

            return(httpWebRequest);
        }