473,396 Members | 1,713 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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<TSocketClasstemplate implementation. The problem is
happening in the Navigate method:

CAtlHttpClientT<TSocketClass>::Navigate

this calls the function: ReadHTTPResponse which calls:

CrackResponseHeader 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)pBuffer, (LPSTR*)&pEnd, 10);
if (Checked::get_errno() == 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_errno() 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 GetTimeListByDateRange(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.Fill(timeDataSet);

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

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

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

BSTR bstrEventType = strEventType.AllocSysString();
BSTR bstrStartTime = strStartTime.AllocSysString();
BSTR bstrEndTime = strEndTime.AllocSysString();

BSTR bstrResults;
HRESULT hr = DataServer.GetTimeListByDateRange(bstrStartTime, 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 1335

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

Similar topics

0
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...
4
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)...
0
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...
3
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...
16
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...
0
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...
3
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...
2
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...
0
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.