473,804 Members | 3,557 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem utilizing WebService method

I have several methods implemented in a webservice written in C#. The
methods execute SQL against a SQL Server 2005 db and returns a Dataset (as
XML). I am utilizing the webservice from a VC++ app by adding the web ref to
the project which creates the header file for making the calls. I traced
through the method call in my app and found the problem in the
CAtlHttpClientT <TSocketClasste mplate implementation. The problem is
happening in the Navigate method:

CAtlHttpClientT <TSocketClass>: :Navigate

this calls the function: ReadHTTPRespons e which calls:

CrackResponseHe ader which calls ParseStatusLine () (all methods in
CAtlHttpClientT <TSocketClass >)

ParseStatusLine works its way through the HTML header buffer until it
reaches a space which is followed by the status code. The Status Code
appears to be 200 which is documented as a valid code. However, the code
that follows is:

if (*pBuffer >= '0' && *pBuffer <= '9')
{
// probably a good status code
m_nStatus = strtol((LPSTR)p Buffer, (LPSTR*)&pEnd, 10);
if (Checked::get_e rrno() == ERANGE)
return NULL; // bad status code
}
--------------------------------------------------------------------
This is the contents of pBuffer:

200 OK
Server: Microsoft-IIS/5.1
Date: Tue, 12 Dec 2006 05:26:26 GMT
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private, max-age=0
Content-Type: text/xml; charset=utf-8
Content-Length: 6968
--------------------------------------------------------------------
In the debugger, m_nStatus = 200. The Checked::get_er rno() returns 34 which
apparently is in ERANGE because it resolves to TRUE and returns NULL which
tells the caller that the header parse failed (Returns the code:
RR_PARSEHEADERS _FAILED).

When I run the debugger on the webserver size, it appears that the SQL
executes properly and the resulting XML looks OK. the strange thing is I
have another call to the webservice from this app and it works fine. Both
webservice methods return a Dataset (as XML). The only difference is the
working method has no params and the problem method has 4 params.

This is the implementation of the method in the web service that is failing
when I call it:
--------------------------------------------------------------------
public DataSet GetTimeListByDa teRange(string startDate, string endDate,
string sEventType, int StaffID, int
ResidentID)
{
SqlConnection conn;
SqlDataAdapter dataAdapter;
DataSet timeDataSet;
string cmdString;
cmdString = "SELECT * FROM Time";
conn = new SqlConnection(" Server
=localhost;uid= aUser;pwd=myPW; database=myDB") ;

dataAdapter = new SqlDataAdapter( cmdString, conn);
timeDataSet = new DataSet();
dataAdapter.Fil l(timeDataSet);

string theXML = timeDataSet.Get Xml(); // used to debug the XML

return timeDataSet;
}
--------------------------------------------------------------------
This is how I call it from my VC++ code:

MyDataService:: CMyDataService DataServer;
CString strStartTime = startDate.Forma t(_T("%m/%d/%Y"));
CString strEndTime = endDate.Format( _T("%m/%d/%Y"));

BSTR bstrEventType = strEventType.Al locSysString();
BSTR bstrStartTime = strStartTime.Al locSysString();
BSTR bstrEndTime = strEndTime.Allo cSysString();

BSTR bstrResults;
HRESULT hr = DataServer.GetT imeListByDateRa nge(bstrStartTi me, bstrEndTime,
bstrEventType, 0, 0, &bstrResults );

// HR is return E_FAIL because of the NULL returned as explained above
// bstrResults is a bad pointer
--------------------------------------------------------------------
I can't figure out why one works and the other doesn't (although I have
gotten the good one to fail once in a while).

Rob C
Dec 13 '06 #1
0 1381

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2489
by: Phil Powell | last post by:
What is the most standardized method of utilizing the CURL functions in PHP (version 4.3.2) to be able to retrieve the contents of a remote URL that happens to be dependent upon $_SESSION for its content display? I've tried the following class methods for display and I have most everything working until I get to a URL that requires $_SESSION: class Timer extends View {
4
1697
by: Flare | last post by:
OK. I'll try explain my problem so simple as possible. I have to send a complex data type to a WebService from a Asp.net webapplication. My Data type look like this. (A class with a porperty) ------------- namespace Elsam.Turabs.ClassLibraries.TurabsLogExeption{
0
1080
by: Raed Sawalha | last post by:
Dear: I'm working web application that expect to pass an class object to DLL(Class Lib) I just Attached the DLL File into Web Solution ( DLL is located in other machine), inside the class library I'm calling a webservice function with the parameter object class , but I just knew that the parameter should be serializable , so I build class with two functions serialize/derserialize . in the DLL I did serialize and pass string to the...
3
2354
by: Ohad Young | last post by:
Hi, I have a webservice method that returns an instance of a custom class I created (e.g., bank account). The class definition in the webservice contains properties, overrides Object.ToString method and etc. However, the proxy created for the webservice contains a definition for this class without the code I wrote. Instead it contains only public fields. I understand the reason, interoperability with none .net clients, but is there...
16
4932
by: Dany | last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by Microsoft must be installed on their servers. Now german Umlaute (ä, ü, ö) and quotes are returned incorrectly in SOAP fault responses. This can be easily verified: Implement the following in a web service method (just raises a SOAPException with a...
0
984
by: batista | last post by:
Hi, I'm using webservice.htc to call a non-secure(without https) webservice method from a webpage. Now, if the webpage is not under https then everything works fine. But, when enable ssl in that page the webservice method does'nt work. So how shud i solve this.
3
1685
by: Massimo Gentilini | last post by:
I have a problem with namespace: I've a class in a namespace namespace.Foo that's used in a web method when I reference the web method from a web service the namespace changes because of the wsdl compiler, so now my class, in the code using the web
2
4689
by: rakesh kumawat | last post by:
I am facing a problem while reading the result which is loaded in DOMDocument. In which I am sending a request to web service and getting a record of Single Order. This is my VB Code which is i am using.... ......................... Dim Connector As SoapConnector30 ' To connect to webservice Dim Serializer As SoapSerializer30 ' To serialize the XML data Dim Reader As SoapReader30 ' To read the Webservice response...
0
1329
by: rakeshkumawat | last post by:
I am facing a problem while reading the result which is loaded in DOMDocument. In which I am sending a request to web service and getting a record of Single Order. This is my VB Code which is i am using.... ........................ Dim Connector As SoapConnector30 ' To connect to webservice Dim Serializer As SoapSerializer30 ' To serialize the XML data Dim Reader As SoapReader30 ' To read the Webservice...
0
9706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10583
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10337
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9160
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7622
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6854
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4301
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3822
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.