Service unavailable on First call in synchronous mode only! question for webservice.htc gurus.

Ask a Question related to ASP.NET Web Services, Design and Development.

  1. #1

    Default Service unavailable on First call in synchronous mode only! question for webservice.htc gurus.

    Hi,
    This is a interesting problem.

    I got webservice.htc integrated pretty well with .net framework. I
    wrote a control that generates all the necessary scripts to consume
    webservices with dhtml objects.

    It is working great for me accept for one scenario.

    When the page loads, and the first webservice call is synchronous, it
    returns "service unavailable" error, BEFORE actually making the server
    call!

    After stepping through the webservice.htc file a few [dozen] times i
    noticed that:
    callService method checks for readyState == 4 (completed) status of
    the xml object. if call is synchronous and status isnt 4 it throws the
    "service unavailable" error.

    the status is actually 3 (loaded) during the call.

    after callservice is executed and I get the nice error alert,
    onreadystatechange event is exected again and the xml doc is now in
    completed state.

    therefore every call after this is successful!


    I am running out of ideas on how to troubleshoot this further (other
    than working around by making a dummy call to the ws on page load) but
    i would hate to work around such important issue.


    here is my abridged viewsource (all my js is autogenerated by asp.net
    control):

    <div id="WebService_233632359"
    style="behavior:url(/scripts/webservice.htc)">

    function Confirmation_servicecontrol_SubmitTrade_synchronou s (
    Quantity, Price, Symbol, tradeId, Action ) {

    // create call object and set its properties

    var callobject = new Object();
    callobject.funcName = 'SubmitTrade';
    callobject.async = false;


    // register service if this is the first time running it
    // tagid.classname ( classname = name of server side class which
    methods will be using )
    if ( ! WebService_233632359.Confirmation ) {

    // check if this service has a registration function
    if ( typeof(register_Confirmation_servicecontrol) == 'function' )
    {
    register_Confirmation_servicecontrol();
    } else {

    // are we in debug mode ?
    if (register_Confirmation_servicecontrol) {
    alert( 'registration function not found
    register_Confirmation_servicecontrol' );
    }
    return;
    }
    }

    // verify that the service was registered and call it
    if ( WebService_233632359.Confirmation ) {


    // webservice call

    return WebService_233632359.Confirmation.callService( callobject ,
    Quantity, Price, Symbol, tradeId, Action );


    } else {
    if (true) { alert( ' service failed to register ::
    WebService_233632359:Confirmation ' ); }
    }

    }

    function register_Confirmation_servicecontrol() {
    WebService_233632359.useService('http://localhost/pbt/Confirmation.asmx?wsdl','Confirmation');
    }
    sonic_soul Guest

  2. Similar Questions and Discussions

    1. WebService Behavior problem (Service unavailable on localhost)
      I am running into a problem with trying to use web services in a web page. As an example I created a C# web service using the VS 2003 wizard, the...
    2. Web service calls asynchronous vs synchronous
      The best solution is to design you architecture using the observer pattern(GOF) K,Browne Developer
    3. Question about privileges required to call LoadUserProfile from ASP.NET webservice
      I am trying to call LoadUserProfile from within an ASP.NET webservice. I have set the process to run under an impersonated account that is an...
    4. Newbie Question: fill a dataset with results from web service call
      I am trying to get a better grasp of using web services. I have had success when I have a user type something into a text box and then pass that...
    5. HTTP 503 (Service Unavailable) error when calling a webservice inside the network
      Hello This problem has been driving me mad for the past few days. I am basically writing a generic utility in .NET/C# that can read any WSDL...
  3. #2

    Default RE: Service unavailable on First call in synchronous mode only! questi

    Actually, if you're calling the service synchronously, I believe the
    applicable code is in the _invoke method of webservice.htc. Specifically the
    following code block:

    try
    {
    oXmlHttp.xmlHttp.send(szPayload);
    }
    catch(e)
    {
    return returnError(oCall, 5);
    }
    if (oXmlHttp.xmlHttp.responseXML.parseError.errorCode != 0)
    {
    _errUnknownS.raw = oXmlHttp.xmlHttp.responseText;
    return returnError(oCall, 4);
    }

    If you'll send me your email, I'll send you a commented/formatted version of
    webservice.htc that I just created. If you're going to spend much time
    trying to understand that code - like I've been trying to do - you'll need
    all the help you can get!

    David Thom
    [email]dathom@npsinc.com[/email]




    "sonic_soul" wrote:
    > Hi,
    > This is a interesting problem.
    >
    > I got webservice.htc integrated pretty well with .net framework. I
    > wrote a control that generates all the necessary scripts to consume
    > webservices with dhtml objects.
    >
    > It is working great for me accept for one scenario.
    >
    > When the page loads, and the first webservice call is synchronous, it
    > returns "service unavailable" error, BEFORE actually making the server
    > call!
    >
    > After stepping through the webservice.htc file a few [dozen] times i
    > noticed that:
    > callService method checks for readyState == 4 (completed) status of
    > the xml object. if call is synchronous and status isnt 4 it throws the
    > "service unavailable" error.
    >
    > the status is actually 3 (loaded) during the call.
    >
    > after callservice is executed and I get the nice error alert,
    > onreadystatechange event is exected again and the xml doc is now in
    > completed state.
    >
    > therefore every call after this is successful!
    >
    >
    > I am running out of ideas on how to troubleshoot this further (other
    > than working around by making a dummy call to the ws on page load) but
    > i would hate to work around such important issue.
    >
    >
    > here is my abridged viewsource (all my js is autogenerated by asp.net
    > control):
    >
    > <div id="WebService_233632359"
    > style="behavior:url(/scripts/webservice.htc)">
    >
    > function Confirmation_servicecontrol_SubmitTrade_synchronou s (
    > Quantity, Price, Symbol, tradeId, Action ) {
    >
    > // create call object and set its properties
    >
    > var callobject = new Object();
    > callobject.funcName = 'SubmitTrade';
    > callobject.async = false;
    >
    >
    > // register service if this is the first time running it
    > // tagid.classname ( classname = name of server side class which
    > methods will be using )
    > if ( ! WebService_233632359.Confirmation ) {
    >
    > // check if this service has a registration function
    > if ( typeof(register_Confirmation_servicecontrol) == 'function' )
    > {
    > register_Confirmation_servicecontrol();
    > } else {
    >
    > // are we in debug mode ?
    > if (register_Confirmation_servicecontrol) {
    > alert( 'registration function not found
    > register_Confirmation_servicecontrol' );
    > }
    > return;
    > }
    > }
    >
    > // verify that the service was registered and call it
    > if ( WebService_233632359.Confirmation ) {
    >
    >
    > // webservice call
    >
    > return WebService_233632359.Confirmation.callService( callobject ,
    > Quantity, Price, Symbol, tradeId, Action );
    >
    >
    > } else {
    > if (true) { alert( ' service failed to register ::
    > WebService_233632359:Confirmation ' ); }
    > }
    >
    > }
    >
    > function register_Confirmation_servicecontrol() {
    > WebService_233632359.useService('http://localhost/pbt/Confirmation.asmx?wsdl','Confirmation');
    > }
    >
    David Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139