locked
i am developing a windows store app using javascript and HTML 5 in which We have to use Sync web services as per requirement. now i want to handle it timeout and kill the call if it is getting timedout from client side.

    Question

  • How to implement this functionality.
    Wednesday, April 02, 2014 2:46 PM

Answers

  • Hi,

    The Windows.Web.Http.HttpClient class only implements the HTTP protocol. The SOAP Protocol - SOAP Header, SOAP Envelope is not implemented directly by the HttpClient class, you will need to manually construct the SOAP body yourself and have the HttpClient transfer it for you.

    That is why you need to investigate whether your WebService exposes a REST Endpoint, where you do not have the overhead of creating the SOAP header & body yourself.

    The Windows.Web.Http.HttpClient class is available for all supported languages - C#, C++, HTML/JS you don't need to write a C# wrapper since you can use it from JS directly. The class is only available starting Windows 8.1 (it is not present on Windows 8).

    Thanks,

    Prashant.


    Windows Store Developer Solutions, follow us on Twitter: @WSDevSol|| Want more solutions? See our blog

    Thursday, April 03, 2014 5:32 PM
    Moderator

All replies

  • If you want to consume a WebService from JavaScript, then you will need to use the Windows.Web.Http.HttpClient class to create the traditional SOAP Envelope based request manually and parse through the SOAP based response manually. Alternately if your WebService implementation is base on REST, you will not have to go through the hassle of creating the envelope manually...

    For the timeout option when using the HttpClient class, this link should help you with your implementation: http://msdn.microsoft.com/en-us/library/windows/apps/hh868283.aspx


    Windows Store Developer Solutions, follow us on Twitter: @WSDevSol|| Want more solutions? See our blog

    Wednesday, April 02, 2014 7:15 PM
    Moderator
  • First of all Thanks for the response. i have few questions

    is there any tutorial using which i can create soap header using Windows.Web.Http.HttpClient for javascript application?

    is this class is supported by javascript or any other alternative provided by WinJS or i have to create a C# plugin for that?

    Thursday, April 03, 2014 6:45 AM
  • Hi,

    The Windows.Web.Http.HttpClient class only implements the HTTP protocol. The SOAP Protocol - SOAP Header, SOAP Envelope is not implemented directly by the HttpClient class, you will need to manually construct the SOAP body yourself and have the HttpClient transfer it for you.

    That is why you need to investigate whether your WebService exposes a REST Endpoint, where you do not have the overhead of creating the SOAP header & body yourself.

    The Windows.Web.Http.HttpClient class is available for all supported languages - C#, C++, HTML/JS you don't need to write a C# wrapper since you can use it from JS directly. The class is only available starting Windows 8.1 (it is not present on Windows 8).

    Thanks,

    Prashant.


    Windows Store Developer Solutions, follow us on Twitter: @WSDevSol|| Want more solutions? See our blog

    Thursday, April 03, 2014 5:32 PM
    Moderator