Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > .NET Web Services
|
.NET Web Services Discussions about .NET XML Web Service technologies including ASMX files, WSDL and SOAP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Web Services section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 19th, 2004, 04:48 AM
Registered User
 
Join Date: May 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ehtesham Send a message via Yahoo to ehtesham
Default Sychronous remote call to web service using DHTML

We were using remote scripting technique in our application to fetch data from the server without re-submitting the web page. This technique was utilizing java applets and thus started producing errors on windows XP user machines. We are now developing the same functionality using WebService on the server end and DHTML element behaviour (WebBehaviour.htc) on the client side HTML page. Using the above-mentioned method we were able to communicate successfully with the web service in asynchronous mode. However the same communication using synchoronous mode is not working properly and is returning either "Service unavailable" and "Invalid Arguments" error messages.

Async Mode (Working Properly)
    var callObj1 = new Object();
    callObj1.funcName = <function name>;
    callObj1.async = true;
    callObj1.timeout = 3600;

    // SOAP header information
    callObj1.SOAPHeader = "<SOAP-ENV:Header>";
    callObj1.SOAPHeader += "<t:Transaction xmlns:t='some-URI' SOAP-ENV:mustUnderstand='1'>";
    callObj1.SOAPHeader += 5;
    callObj1.SOAPHeader += "</t:Transaction>";
    callObj1.SOAPHeader += "</SOAP-ENV:Header>";


    service.useService("<WebService Address>","MyFunc");
    iCallID = service.MyFunc.callService(showres, callObj1, "<var1>", "<var2>", "<var3>");
The above-mentioned code works properly and passes back the result object to showres function.

SYNC MODE (NOT WORKING)
    var callObj1 = new Object();
    callObj1.funcName = <function name>;
    callObj1.async = false;
    callObj1.timeout = 3600;

    // SOAP header information
    callObj1.SOAPHeader = "<SOAP-ENV:Header>";
    callObj1.SOAPHeader += "<t:Transaction xmlns:t='some-URI' SOAP-ENV:mustUnderstand='1'>";
    callObj1.SOAPHeader += 5;
    callObj1.SOAPHeader += "</t:Transaction>";
    callObj1.SOAPHeader += "</SOAP-ENV:Header>";


    service.useService("<WebService Address>","MyFunc");
    iCallID = service.MyFunc.callService(callObj1, "<var1>", "<var2>", "<var3>");

This Code does not work properly and returns "Invalid Argument" or "Service Unavailable" error message.

I would really appreciate if someone could point out the mistake I am making here. or if there is some native issue with this functionality.

Thanks

 
Old July 1st, 2004, 10:15 AM
Registered User
 
Join Date: Jul 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Use event onserviceavailable:

<DIV id="service" style="BEHAVIOR: url(webservice.htc)"></DIV>
<SCRIPT language="javascript" event="onLoad" for="window">
  service.onserviceavailable = ServiceReady;
  service.useService("srv1.asmx?WSDL","S1");
</SCRIPT>
<SCRIPT language="javascript">
function ServiceReady()
{
  // sync call of services will work correctly
}
</SCRIPT>


 
Old August 18th, 2004, 04:11 AM
Registered User
 
Join Date: May 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ehtesham Send a message via Yahoo to ehtesham
Default

Thanks, Using the onserviceavailable call indeed resolved the service unavailability issue for Sync calls.

There is another issue I have been encountering for a few days regarding the above-mentioned technique. The method randomly returns an error with following details irrespective of the Sync/Async call method.

errorDetail.code = "Server"
errorDetail.string = "Access Denied"
errorDetail.raw = NULL

Can anyone please tell me what does that error refer to, especially in a scenario where the error pattern is random and occurs only with 1-3% calls to the WebService.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Web service call error Tomi J2EE 0 February 1st, 2008 06:22 AM
Web Service call fails gurujeet .NET Web Services 10 December 18th, 2006 06:28 PM
Call a Web Service deer_reema ASP.NET 1.0 and 1.1 Basics 1 April 28th, 2006 10:12 AM
How to call WMI from web service? yezh99 .NET Web Services 1 July 22nd, 2003 11:58 PM
How to call WMI from web service? yezh99 VS.NET 2002/2003 1 July 14th, 2003 10:45 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.