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 January 7th, 2004, 02:23 AM
Registered User
 
Join Date: Jan 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Web Service call fails

Hi all,
   I have a code which calls my webservice using XMLHTTP Post method. Including the code below. Now most of the times this call happens without any problem. But on the live environment sometimes this call fails. Haven't been able to find out why it fails at all. If anyone can guide me on how to find this out even that would be a great help.
   Here is the code :
Function vf_ProcessSoapRequest(objXML,ServiceName,FunctionN ame,ParamName)
    Dim OutXML
    Dim saveXMLobj
    Dim Result

    set saveXMLobj = createobject("MSXML2.XMLHTTP.4.0")
    saveXMLobj.open "POST", Application("WS1") & ServiceName & ".asmx",false
    saveXMLobj.setRequestHeader "Content-Type","text/xml; charset=utf-8"
    saveXMLobj.setRequestHeader "SOAPAction","http://abc.com/WebServices/" & FunctionName

    OutXML = "<?xml version=""1.0"" encoding=""utf-8""?>"
    OutXML = OutXML & "<soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">"
    OutXML = OutXML & "<soap:Body>"
    OutXML = OutXML & "<" & FunctionName & " xmlns=""http://abc.com/WebServices/"">"
    OutXML = OutXML & "<" & ParamName & ">"
    OutXML = OutXML & HTTPEncode(objXML.xml)
    OutXML = OutXML & "</" & ParamName & ">"
    OutXML = OutXML & "</" & FunctionName & ">"
    OutXML = OutXML & "</soap:Body>"
    OutXML = OutXML & "</soap:Envelope>"
    saveXMLobj.send OutXML
    Result = saveXMLobj.responseText
    set saveXMLobj = nothing
    vf_ProcessSoapRequest = Result
End Function

As you can see the parameter is itself an xml document.

Thanks and regards,
Gurjit

 
Old January 7th, 2004, 10:35 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

I hate to provide a less than useful answer, but I'm wondering about something. If you are using .net web services, how come you are coding the soap request manually? .net provides all the wizards and things to generate all the soap requests (and remote class definition where applicable) in a webservice "stub" class file. Are you unclear on how to do this or are you doing this manually for a reason?

Peter
------------------------------------------------------
Work smarter, not harder.
 
Old January 8th, 2004, 01:39 AM
Registered User
 
Join Date: Jan 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi peter,
   The fact of the matter is that we are still using asp code(no .Net) to call this Web Service. It's kind of first step to move towards .Net. The above code calls the webservice from an asp page and that is why the Soap request is being formed manually.

Thanks and regards,
Gurjit

 
Old January 8th, 2004, 08:19 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Ok, well there's a legitimate answer. How about this: change your .net service to support GET calls and you only need to construct a simple query string with the parameters/arguments to the web service method. The beauty of that is that you can use the ASP based XML object(s) with that simple GET URL to the web service.

Peter
------------------------------------------------------
Work smarter, not harder.
 
Old January 9th, 2004, 12:51 AM
Registered User
 
Join Date: Jan 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sorry Peter, GET will not work here. That's because one of the XML parameters is a full length XML document. Now there could be another way of passing XML document to the webservice like letting the webservice itself pick it up instead of passing it, but that would constitute a big change. So a POST is really necessary in this context. Also the problem is not that the code doesn't work entirely, only that it fails sometimes and for a clientele like ours even one in 20 requests failing is a dangerous thing.

Thanks and Regards,
Gurjit

 
Old January 9th, 2004, 01:28 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Ok. That makes sense.
Then let's get back to the original problem:
What is the error you are experiencing?
Can you provide more details on the failure?

Peter
------------------------------------------------------
Work smarter, not harder.
 
Old January 13th, 2004, 01:48 AM
Registered User
 
Join Date: Jan 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I can just put the error message here. I am not able to get the Error no. as of now.
I will try and get the error no/hex code.

"An exception occurred: 'saveXMLobj.send'"

Regards,
Gurjit


 
Old January 15th, 2004, 06:06 AM
Registered User
 
Join Date: Jan 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I finally got something to go on. The hex code is given here and as I searched Google, I could see a lot of such errors but nothing related to send. They all correspond to the object created doing and .execute or .Send as in my case or many more things. I hope this problem can find a solution soon.

Standard Microsoft Information Microsoft VBScript runtime (0x800A01FB)
An exception occurred: 'saveXMLobj.send'

Regards,
Gurjit

 
Old January 23rd, 2004, 08:25 AM
Registered User
 
Join Date: Jan 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Here something else to go ahead on... Again have searched google and all and it has not been helping. The error no is "507". The error description is "An Exception Occurred".
Thanks for helping out,
Gurjit


 
Old October 18th, 2004, 06:48 AM
Registered User
 
Join Date: Oct 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to nitinshinde
Default

Hi Gurujit,

Last 2 days we are also facing the same error used to face by u earlier.
Are u able to resolve this error ? if Yes, please let us known the solution.

Regards,


Nitin





Similar Threads
Thread Thread Starter Forum Replies Last Post
Web service call error Tomi J2EE 0 February 1st, 2008 06:22 AM
Call a Web Service deer_reema ASP.NET 1.0 and 1.1 Basics 1 April 28th, 2006 10:12 AM
GetActiveObject Fails in Web Service tcarrico .NET Web Services 0 January 7th, 2004 11:48 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.