473,320 Members | 1,952 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,320 software developers and data experts.

ATL Service Web Serice Using XML as Input and Output

Hi,

I am writing ATL Service application (XML Web service) in
VS.NET C++.
Are there any sample programs that accept XML as input and
XML as output
in the web service?

Thank you very much.

FS Liu

Nov 16 '05 #1
8 2545
Hi

Please clarify: do you want to load SOAP XML requests as input, and generate
SOAP XML responses as output?

--
--
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Please do not send email directly to this alias. It is for newsgroup
purposes only.

thanks,
bogdan


"FS Liu" <fa***********@hotmail.com> wrote in message
news:1d****************************@phx.gbl...
Hi,

I am writing ATL Service application (XML Web service) in
VS.NET C++.
Are there any sample programs that accept XML as input and
XML as output
in the web service?

Thank you very much.

FS Liu

Nov 16 '05 #2
Thanks for your message.

The input to the web service is a set of parameters
which may change in format and the number of variables
for each call. The output variable or the returned
value of the web service is also a set of paramters
which may change in format and the number of variables
as the result of the call.

In my thinking, there are at least two ways to do this:
(1). Pass both input and output as strings in
calling the web service.
In this case, I need to know how to convert
XmlTextReader to string in a very efficient way.
Is this method OK in ATL Server application?
Do I need managed code to do this?
(2). Call web service by passing parameter such as
XmlTextReader or XmlNode type.
But unfortunately, there is too little resources from
Microsoft. Do you have some sample programs ?

Thank you very much.

FS Liu
-----Original Message-----
Hi

Please clarify: do you want to load SOAP XML requests as input, and generateSOAP XML responses as output?

--
--
--
This posting is provided "AS IS" with no warranties, and confers no rights.Please do not send email directly to this alias. It is for newsgrouppurposes only.

thanks,
bogdan


"FS Liu" <fa***********@hotmail.com> wrote in message
news:1d****************************@phx.gbl...
Hi,

I am writing ATL Service application (XML Web service) in VS.NET C++.
Are there any sample programs that accept XML as input and XML as output
in the web service?

Thank you very much.

FS Liu

.

Nov 16 '05 #3
Some more clearification:
As I described below, I am thinking to use XML to pass
both the input parameters and output results. I hope
to use both ADO.NET and XML classes for best performance
and development speed.

Thanks again.

FS Liu

-----Original Message-----
Thanks for your message.

The input to the web service is a set of parameters
which may change in format and the number of variables
for each call. The output variable or the returned
value of the web service is also a set of paramters
which may change in format and the number of variables
as the result of the call.

In my thinking, there are at least two ways to do this:
(1). Pass both input and output as strings in
calling the web service.
In this case, I need to know how to convert
XmlTextReader to string in a very efficient way.
Is this method OK in ATL Server application?
Do I need managed code to do this?
(2). Call web service by passing parameter such as
XmlTextReader or XmlNode type.
But unfortunately, there is too little resources from
Microsoft. Do you have some sample programs ?

Thank you very much.

FS Liu
-----Original Message-----
Hi

Please clarify: do you want to load SOAP XML requests as

input, and generate
SOAP XML responses as output?

--
--
--
This posting is provided "AS IS" with no warranties, and

confers no rights.
Please do not send email directly to this alias. It is

for newsgroup
purposes only.

thanks,
bogdan


"FS Liu" <fa***********@hotmail.com> wrote in message
news:1d****************************@phx.gbl...
Hi,

I am writing ATL Service application (XML Web service)in VS.NET C++.
Are there any sample programs that accept XML as inputand XML as output
in the web service?

Thank you very much.

FS Liu

.

.

Nov 16 '05 #4
In article <#D**************@TK2MSFTNGP10.phx.gbl>, "Bogdan says...

Hi

Please clarify: do you want to load SOAP XML requests as input, and generate
SOAP XML responses as output?


How about a similar question...

Should (of course I CAN) use ATL Server, VC++7.1 to produce a REST like program?
i.e. from a URL, return an XML doc, which is from my complex C++ objects, and
also be able to PUT/POST HTTP messages that end up back in my C++ program for
processing?

Simple GET example
http://myapp/address?IBM
a get on that would return the address of IBM in my database as a formatted XML
document.

Thanks
sdg

Nov 16 '05 #5
Are there efficient way (both performance and development
speed) to convert XPathDocument or XmlDocument to string,
or even compress them into binary string for better
internet data transfer performance?

Thanks.

FS Liu

-----Original Message-----
If the params are dynamic, as in FS Liu's example, or if you just want topass a XML doc up and return one, why not use a document style of literal?
[
request_handler(name="Default", sdl="GenBlahWSDL"),
soap_handler(
name="BlahService",
namespace="urn:BlahService",
protocol="soap",
style="document",
use="literal" // in order to use style = document, you musthave use = literal
)
]

Then your soap method can look like this:
[ soap_method ]
HRESULT Foo(BSTR foobar, BSTR* retval);

foobar will be your uploaded XML document, and retval will be your returnxml document.

hth

todd brooks


<sc****************@yahoo.com> wrote in message
news:bf*********@drn.newsguy.com...
In article <#D**************@TK2MSFTNGP10.phx.gbl>, "Bogdan says...
>
>Hi
>
>Please clarify: do you want to load SOAP XML requests
as input, and
generate >SOAP XML responses as output?
How about a similar question...

Should (of course I CAN) use ATL Server, VC++7.1 to

produce a REST likeprogram?
i.e. from a URL, return an XML doc, which is from my
complex C++ objects,and
also be able to PUT/POST HTTP messages that end up back
in my C++ programfor
processing?

Simple GET example
http://myapp/address?IBM
a get on that would return the address of IBM in my
database as aformatted XML
document.

Thanks
sdg

.

Nov 16 '05 #6
Hi, Bogdan,

I am writing some functions to provide data via
internet with ATL Server structure in VC++.NET.
The input to these functions has the following
feature:
* it may change in data format or/and the number
of variables.
* I am thinking to pass such a dynamic varaible
set with XML doc. The web service will parse
the input XML doc and decide what to do on
server side.
* it may be beter to compress the data before
send it to web server. If this is quite easy
to implement with .NET classes. I will do it.
The output of these functions has the following
feature:
* The results are from SQL Server 2000.
* I want to return the data with XML doc, so
as to use the data cross platform.
* it may be beter to compress the data before
send it back to client. Again, if this is quite
easy to implement with .NET classes. I will do it.
I know that one of the solutions is to implement the
input and output as string or binary string (in the
case of compressed data). But I cannot find an good
example to:
* get data in XML format from SQL Server 2000 in
ATL Server application (by using "for XML"
clause with SQL 2000);
* convert the XML doc to a string in a very
efficient way (instead of node by node by
navigating through the XML tree)
* compress the string into a binary string before
sending it back to client.
* decide a better choice between HTTP GET/POST and
ATL Server web service (I am not sure if I should
go to web service wizard project for this. But
I am sure I want to use ATL server project for
beter performance.).

Please advise.

Thank you very much.

FS Liu
-----Original Message-----
Could you please provide a few more details on the functionality of yourapp?
Looks like the HTTP Client class in ATL Server could be of help here
--
--
--
This posting is provided "AS IS" with no warranties, and confers no rights.Please do not send email directly to this alias. It is for newsgrouppurposes only.

thanks,
bogdan


<sc****************@yahoo.com> wrote in message
news:bf*********@drn.newsguy.com...
In article <#D**************@TK2MSFTNGP10.phx.gbl>, "Bogdan says...
>
>Hi
>
>Please clarify: do you want to load SOAP XML requests
as input, and
generate >SOAP XML responses as output?
How about a similar question...

Should (of course I CAN) use ATL Server, VC++7.1 to

produce a REST likeprogram?
i.e. from a URL, return an XML doc, which is from my
complex C++ objects,and
also be able to PUT/POST HTTP messages that end up back
in my C++ programfor
processing?

Simple GET example
http://myapp/address?IBM
a get on that would return the address of IBM in my
database as aformatted XML
document.

Thanks
sdg

.

Nov 16 '05 #7
Hi,

The problems that I understand need solving are:
1. compression (in and out)
2. reading variable XML description of the parameters from the input
3. getting SQL 2000 data as XML
4. render the response as a stream

1. Compression -- I think this can be solved by using IISs compression
abilities. I think IIS comes with an ISAPI filter that allows zip
compression for in/out traffic.
If not, you could easily overwrite the ATLServer ISAPI buffer response class
to compress the content on the fly and add a custom header to the response
For the main part of the job (reading the input and generating the streamed
output) -- one way to go is to modify the ATL Server SOAP support framework.
It is possible to completely override the SOAP input parameter parsing (and
get control by using your custom SAX handler instead of ATLS's one). Also,
it is possible to write directly to the response stream and override the
SOAP response serialization mechanism. If you think you really need to do
this and override the SOAP support, please let me know, the rest of this
messsage is about a different solution)

However, the SOAP support is intended to help in RPC/COM like invocations of
SOAP methods (with IDL support for structs, in/out parameters and basic
types).
Your application seems to have a more specialized function: get some POSTed
XML input which contains a query description (or so) , execute the query and
stream the XML from SQL Server as response.
You could just not use the ATLS SOAP support, but create a regular
(non-soap) web application and parse yourself the input XML (which may or
may not be strictly respecting the SOAP format).
Once you parse the input parameters, you can build your query and execute it
against SQL Server. The 'FOR XML AUTO' response from SQL Server can be
fetched as an IStream interface through OLEDB and, as you read from that
stream, you can render data back to the caller (by writing it to the
m_HttpResponse buffer).
The code should look like below (connecting to Northwind,

#define CONNECTION_STRING L"Provider=SQLOLEDB.1; Integrated Security=SSPI;
Data Source=localhost; Initial Catalog=Northwind"
#define CHECK_ERROR(x) (hr=x; if (!SUCCEEDED(hr))goto err;)

HRESULT hr;
CDataSource dataSrc;
CSession session;
CCommand<CNoAccessor, CStreamRowset> cmd;

CHECK_ERROR(dataSrc.OpenFromInitializationString(C ONNECTION_STRING));
CHECK_ERROR(session.Open(dataSrc));

CHECK_ERROR(cmd.Open(session, "SELECT * from Customers FOR XML AUTO"));

CHAR buff[1024 + 1];
ULONG cbRead = 1024;
do
{
CHECK_ERROR(cmd.m_spStream->Read( buff, 1024, &cbRead));
buff[cbRead] = '\0';
m_HttpResponse.Write(buff);
}while( cbRead == 1024 );
err:
return SomeError;
This way, the XML data coming from the SQL Server is directly streamed to
the HTTP response without loading it into intermediary XML classes (either
unmanaged DOM or .Net)
So, if you decide to go with this second approach (regular web application
instead of using the SOAP support), you 'll get:
- good performance for writing the query result as XML back to the caller,
without using intermediate classes and without intermediate copy operations
- good database connection performance (ATL Server has a mechanism to cache
database connections)
- ability to expose a SOAP -like behavior for the clients (without actually
using the ATL Server SOAP support) -- you will have to parse the input and
make sure it looks like <soap:Envelope... etc
Also, to implement SOAP you will have to wrap the response from the SQL
Server in a <soap:Envelope><soap:Body> set of tags
- ability to switch with minimal effort to a HTTP GET behavior (you'll just
need to get the parameters from the QueryString collection instead opf
parsing a POSTed input XML document)

Besides, you don't need to modify the ATLS SOAP framework
Please let me know if this works for you and if you would like a small
working sample of this

Optimization suggestion:
- the SQL Server connection should be cached in the ISAPI DLL (the ATLS
wizard allows you to create a database connection cache in the ISAPI dll)
- if you decide to have POST-ed XML as input (instead of HTTP GET or POST
parameters), you could use the per-thread ISAXXMLReader that available in
ISAPI DLLs
- you might want to change the default buffer size for the HTTP Response
depending on the values you use when reading from the CStreamRowset in the
code above
--
--
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Please do not send email directly to this alias. It is for newsgroup
purposes only.

thanks,
bogdan
Hi, Bogdan,

I am writing some functions to provide data via
internet with ATL Server structure in VC++.NET.
The input to these functions has the following
feature:
* it may change in data format or/and the number
of variables.
* I am thinking to pass such a dynamic varaible
set with XML doc. The web service will parse
the input XML doc and decide what to do on
server side.
* it may be beter to compress the data before
send it to web server. If this is quite easy
to implement with .NET classes. I will do it.
The output of these functions has the following
feature:
* The results are from SQL Server 2000.
* I want to return the data with XML doc, so
as to use the data cross platform.
* it may be beter to compress the data before
send it back to client. Again, if this is quite
easy to implement with .NET classes. I will do it.
I know that one of the solutions is to implement the
input and output as string or binary string (in the
case of compressed data). But I cannot find an good
example to:
* get data in XML format from SQL Server 2000 in
ATL Server application (by using "for XML"
clause with SQL 2000);
* convert the XML doc to a string in a very
efficient way (instead of node by node by
navigating through the XML tree)
* compress the string into a binary string before
sending it back to client.
* decide a better choice between HTTP GET/POST and
ATL Server web service (I am not sure if I should
go to web service wizard project for this. But
I am sure I want to use ATL server project for
beter performance.).

Please advise.

Thank you very much.

FS Liu



Nov 16 '05 #8
Hi, bogdan,

Your message is very helpful in showing me the direction
and some details. I don't have an immediate feeling of
the difference in the performance of the two methods you
described. Could you please show me how to override
SOAP support? I will also try the second approach by
myself to see what the performance difference between
the two methods looks like.
Thank you very much.

FS Liu

-----Original Message-----
Hi,

The problems that I understand need solving are:
1. compression (in and out)
2. reading variable XML description of the parameters from the input3. getting SQL 2000 data as XML
4. render the response as a stream

1. Compression -- I think this can be solved by using IISs compressionabilities. I think IIS comes with an ISAPI filter that allows zipcompression for in/out traffic.
If not, you could easily overwrite the ATLServer ISAPI buffer response classto compress the content on the fly and add a custom header to the response

For the main part of the job (reading the input and generating the streamedoutput) -- one way to go is to modify the ATL Server SOAP support framework.It is possible to completely override the SOAP input parameter parsing (andget control by using your custom SAX handler instead of ATLS's one). Also,it is possible to write directly to the response stream and override theSOAP response serialization mechanism. If you think you really need to dothis and override the SOAP support, please let me know, the rest of thismesssage is about a different solution)

However, the SOAP support is intended to help in RPC/COM like invocations ofSOAP methods (with IDL support for structs, in/out parameters and basictypes).
Your application seems to have a more specialized function: get some POSTedXML input which contains a query description (or so) , execute the query andstream the XML from SQL Server as response.
You could just not use the ATLS SOAP support, but create a regular(non-soap) web application and parse yourself the input XML (which may ormay not be strictly respecting the SOAP format).
Once you parse the input parameters, you can build your query and execute itagainst SQL Server. The 'FOR XML AUTO' response from SQL Server can befetched as an IStream interface through OLEDB and, as you read from thatstream, you can render data back to the caller (by writing it to them_HttpResponse buffer).
The code should look like below (connecting to Northwind,

#define CONNECTION_STRING L"Provider=SQLOLEDB.1; Integrated Security=SSPI;Data Source=localhost; Initial Catalog=Northwind"
#define CHECK_ERROR(x) (hr=x; if (!SUCCEEDED(hr))goto err;)
HRESULT hr;
CDataSource dataSrc;
CSession session;
CCommand<CNoAccessor, CStreamRowset> cmd;

CHECK_ERROR(dataSrc.OpenFromInitializationString (CONNECTION_STRING)); CHECK_ERROR(session.Open(dataSrc));

CHECK_ERROR(cmd.Open(session, "SELECT * from Customers FOR XML AUTO"));
CHAR buff[1024 + 1];
ULONG cbRead = 1024;
do
{
CHECK_ERROR(cmd.m_spStream->Read( buff, 1024, &cbRead)); buff[cbRead] = '\0';
m_HttpResponse.Write(buff);
}while( cbRead == 1024 );
err:
return SomeError;
This way, the XML data coming from the SQL Server is directly streamed tothe HTTP response without loading it into intermediary XML classes (eitherunmanaged DOM or .Net)
So, if you decide to go with this second approach (regular web applicationinstead of using the SOAP support), you 'll get:
- good performance for writing the query result as XML back to the caller,without using intermediate classes and without intermediate copy operations- good database connection performance (ATL Server has a mechanism to cachedatabase connections)
- ability to expose a SOAP -like behavior for the clients (without actuallyusing the ATL Server SOAP support) -- you will have to parse the input andmake sure it looks like <soap:Envelope... etc
Also, to implement SOAP you will have to wrap the response from the SQLServer in a <soap:Envelope><soap:Body> set of tags
- ability to switch with minimal effort to a HTTP GET behavior (you'll justneed to get the parameters from the QueryString collection instead opfparsing a POSTed input XML document)

Besides, you don't need to modify the ATLS SOAP framework
Please let me know if this works for you and if you would like a smallworking sample of this

Optimization suggestion:
- the SQL Server connection should be cached in the ISAPI DLL (the ATLSwizard allows you to create a database connection cache in the ISAPI dll)- if you decide to have POST-ed XML as input (instead of HTTP GET or POSTparameters), you could use the per-thread ISAXXMLReader that available inISAPI DLLs
- you might want to change the default buffer size for the HTTP Responsedepending on the values you use when reading from the CStreamRowset in thecode above
--
--
--
This posting is provided "AS IS" with no warranties, and confers no rights.Please do not send email directly to this alias. It is for newsgrouppurposes only.

thanks,
bogdan
Hi, Bogdan,

I am writing some functions to provide data via
internet with ATL Server structure in VC++.NET.
The input to these functions has the following
feature:
* it may change in data format or/and the number
of variables.
* I am thinking to pass such a dynamic varaible
set with XML doc. The web service will parse
the input XML doc and decide what to do on
server side.
* it may be beter to compress the data before
send it to web server. If this is quite easy
to implement with .NET classes. I will do it.
The output of these functions has the following
feature:
* The results are from SQL Server 2000.
* I want to return the data with XML doc, so
as to use the data cross platform.
* it may be beter to compress the data before
send it back to client. Again, if this is quite
easy to implement with .NET classes. I will do it.
I know that one of the solutions is to implement the
input and output as string or binary string (in the
case of compressed data). But I cannot find an good
example to:
* get data in XML format from SQL Server 2000 in
ATL Server application (by using "for XML"
clause with SQL 2000);
* convert the XML doc to a string in a very
efficient way (instead of node by node by
navigating through the XML tree)
* compress the string into a binary string before
sending it back to client.
* decide a better choice between HTTP GET/POST and
ATL Server web service (I am not sure if I should
go to web service wizard project for this. But
I am sure I want to use ATL server project for
beter performance.).

Please advise.

Thank you very much.

FS Liu



.

Nov 16 '05 #9

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

Similar topics

3
by: Mike Frank | last post by:
What is the correct way to abort a service start in the OnStart method if things were detected which will not let the service run properly? I could simply throw an exception and the serice will...
3
by: Jerome Cohen | last post by:
AI am trying to call a third-party web service. this service expects an XML fragment that contains the request plus other parameter. adding the web reference created the syntax below(reference.vb)....
7
by: Jorgen Haukland, Norway | last post by:
Hi, I have created a Java webservice which runs in IBM WebSphere appserver. I take the WSDL-file and create a VS.NET WinForm application and calls the service running on my PC and everything...
0
by: leslie_tighe | last post by:
Hello, I have a set of web services running on Java server that are exposed through axis 1.2.1. I can invoke these services in browser and through a java test client. However, when I try to...
4
by: leslie_tighe | last post by:
Hello, I have a webservice running on a J2EE server created with Axis 1.2.. I have a client that I am building in .net that needs to consume this webserivce and am having a bit of trouble. I have...
1
by: William | last post by:
I have a few questions. First, I have a java webservice, which was developed using the Java Webserices Developer Pack 1.3. Here is the wsdl for the service. (Note: That this service is not exposed...
2
by: Tim Reynolds | last post by:
Team, We need some guidance here. We are developing a web service to expose to external system. We are not sure which is the best path to take. We have multiple input fields required and a few...
0
by: ben | last post by:
OK so there are a few things going on. I succesfully created a SOAP webreference in VS IDE which when built works fine under small amounts of load, however under heavy amounts of load we start to...
2
by: Brock | last post by:
I have a classic textbook example of consuming a Web service. I'm using Visual Web Developer Express 2008 v9. I have a textbox, a listbox, and a button on my .aspx form. I'm trying to use the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.