public async void RunSoapAsync(double currentTime, bool countryCode, string country) { SOAPClient proxy = new SOAPClient(); // Trim and make into PascalCase string countryName = country.Trim().Substring(0, 1).ToUpper() + country.Trim().Substring(1).ToLower(); string countryTime; try { if (countryCode) { countryTime = await proxy.GetISOTimeAsync(countryName); } else { countryTime = await proxy.GetCountryTimeAsync(countryName); } Console.WriteLine("Time in " + countryName + " (SOAP): " + UnixTimeStampToDateTime(currentTime + Double.Parse(countryTime))); } catch (FaultException e) { Console.WriteLine("SOAP: Country not found!"); } }
static void Main(string[] args) { const string serverUrl = "http://localhost:12345/"; var transferServer = new TransferServer(new RequestHandler()); using (new HttpListenerTransferEndpoint(serverUrl, transferServer)) { var transferClient = new SOAPClient(serverUrl); Console.Write("Create..."); var address = transferClient.BuildMessage().Create(new SampleData()); Console.WriteLine(address.Address); Console.Write("Put..."); var data = transferClient.BuildMessage().Put <SampleData>(new SampleData { A = "AAA" }); Console.WriteLine(data.A); Console.Write("Get..."); data = transferClient.BuildMessage().Get <SampleData>(); Console.WriteLine(data.A); Console.Write("Delete..."); transferClient.BuildMessage(); Console.WriteLine("OK"); Console.WriteLine("Press any key to exit"); Console.ReadKey(); } }
public Jsr262MBeanServerConnection(int enumerationMaxElements, string serverUri) { _enumerationMaxElements = enumerationMaxElements; _soapClient = new SOAPClient(serverUri); _manClient = new ManagementClient(serverUri); _enumClient = new EnumerationClient(true, serverUri); _eventingClient = new EventingClient(serverUri); }
void HandleButtonTouchUpInside(object sender, EventArgs e) { label.Text = "Calling Service..."; c = new SOAPClient(new BasicHttpBinding(), new EndpointAddress("http://sguest01/TechEdDemoMVC/Services/SOAP.svc")); c.Open(); c.GetTitleForCodeCompleted += HandleCGetTitleForCodeCompleted; c.GetTitleForCodeAsync("DPR304"); // Not sure why this demo doesn't work async System.Threading.Thread.Sleep(5000); }
public ManagementClient(string serverUrl) { _soapClient = new SOAPClient(serverUrl); }
public HackneyAppointmentsService(ILoggerAdapter <AppointmentActions> logger) { _client = new SOAPClient(); _logger = logger; }
public SOAPClient(EndpointConfiguration endpointConfiguration) : base(SOAPClient.GetBindingForEndpoint(endpointConfiguration), SOAPClient.GetEndpointAddress(endpointConfiguration)) { this.Endpoint.Name = endpointConfiguration.ToString(); ConfigureEndpoint(this.Endpoint, this.ClientCredentials); }
public SOAPClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) : base(SOAPClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress) { this.Endpoint.Name = endpointConfiguration.ToString(); ConfigureEndpoint(this.Endpoint, this.ClientCredentials); }
public SOAPClient() : base(SOAPClient.GetDefaultBinding(), SOAPClient.GetDefaultEndpointAddress()) { this.Endpoint.Name = EndpointConfiguration.Soap.ToString(); ConfigureEndpoint(this.Endpoint, this.ClientCredentials); }
private static System.ServiceModel.EndpointAddress GetDefaultEndpointAddress() { return(SOAPClient.GetEndpointAddress(EndpointConfiguration.Soap)); }
private static System.ServiceModel.Channels.Binding GetDefaultBinding() { return(SOAPClient.GetBindingForEndpoint(EndpointConfiguration.Soap)); }
public AccountController() { _soapClient = new SOAPClient(); }
MobileRemoteStop(MobileRemoteStopRequest Request) { #region Initial checks if (Request == null) { throw new ArgumentNullException(nameof(Request), "The given MobileRemoteStop request must not be null!"); } Request = _CustomMobileRemoteStopRequestMapper(Request); if (Request == null) { throw new ArgumentNullException(nameof(Request), "The mapped MobileRemoteStop request must not be null!"); } HTTPResponse <Acknowledgement <MobileRemoteStopRequest> > result = null; #endregion #region Send OnMobileRemoteStopRequest event var StartTime = DateTime.UtcNow; try { if (OnMobileRemoteStopRequest != null) { await Task.WhenAll(OnMobileRemoteStopRequest.GetInvocationList(). Cast <OnMobileRemoteStopRequestDelegate>(). Select(e => e(StartTime, Request.Timestamp.Value, this, ClientId, Request.EventTrackingId, Request.SessionId, Request.RequestTimeout ?? RequestTimeout.Value))). ConfigureAwait(false); } } catch (Exception e) { e.Log(nameof(MobileClient) + "." + nameof(OnMobileRemoteStopRequest)); } #endregion using (var _OICPClient = new SOAPClient(Hostname, URLPathPrefix + MobileAuthorizationURL, VirtualHostname, RemotePort, RemoteCertificateValidator, ClientCertificateSelector, UserAgent, RequestTimeout, DNSClient)) { result = await _OICPClient.Query(_CustomMobileRemoteStopSOAPRequestMapper(Request, SOAP.Encapsulation(Request.ToXML(CustomMobileRemoteStopRequestSerializer))), "eRoamingMobileRemoteStop", RequestLogDelegate : OnMobileRemoteStartSOAPRequest, ResponseLogDelegate : OnMobileRemoteStartSOAPResponse, CancellationToken : Request.CancellationToken, EventTrackingId : Request.EventTrackingId, RequestTimeout : Request.RequestTimeout ?? RequestTimeout.Value, #region OnSuccess OnSuccess : XMLResponse => XMLResponse.ConvertContent(Request, (request, xml, onexception) => Acknowledgement <MobileRemoteStopRequest> .Parse(request, xml, CustomAcknowledgementMobileRemoteStopParser, CustomStatusCodeParser, onexception)), #endregion #region OnSOAPFault OnSOAPFault : (timestamp, soapclient, httpresponse) => { SendSOAPError(timestamp, this, httpresponse.Content); return(new HTTPResponse <Acknowledgement <MobileRemoteStopRequest> >( httpresponse, new Acknowledgement <MobileRemoteStopRequest>( Request, StatusCodes.DataError, httpresponse.Content.ToString() ), IsFault: true )); }, #endregion #region OnHTTPError OnHTTPError : (timestamp, soapclient, httpresponse) => { SendHTTPError(timestamp, this, httpresponse); return(new HTTPResponse <Acknowledgement <MobileRemoteStopRequest> >( httpresponse, new Acknowledgement <MobileRemoteStopRequest>( Request, StatusCodes.DataError, httpresponse.HTTPStatusCode.ToString(), httpresponse.HTTPBody.ToUTF8String() ), IsFault: true )); }, #endregion #region OnException OnException : (timestamp, sender, exception) => { SendException(timestamp, sender, exception); return(HTTPResponse <Acknowledgement <MobileRemoteStopRequest> > .ExceptionThrown( new Acknowledgement <MobileRemoteStopRequest>( Request, StatusCodes.ServiceNotAvailable, exception.Message, exception.StackTrace ), Exception: exception )); } #endregion ); } if (result == null) { result = HTTPResponse <Acknowledgement <MobileRemoteStopRequest> > .OK( new Acknowledgement <MobileRemoteStopRequest>( Request, StatusCodes.SystemError, "HTTP request failed!" ) ); } #region Send OnMobileRemoteStopResponse event var Endtime = DateTime.UtcNow; try { if (OnMobileRemoteStopResponse != null) { await Task.WhenAll(OnMobileRemoteStopResponse.GetInvocationList(). Cast <OnMobileRemoteStopResponseDelegate>(). Select(e => e(Endtime, Request.Timestamp.Value, this, ClientId, Request.EventTrackingId, Request.SessionId, Request.RequestTimeout ?? RequestTimeout.Value, result.Content, Endtime - StartTime))). ConfigureAwait(false); } } catch (Exception e) { e.Log(nameof(MobileClient) + "." + nameof(OnMobileRemoteStopResponse)); } #endregion return(result); }