XPO through XML Web Services - a new detail

XPO Team Blog
13 July 2006

I have previously blogged about our knowledge base article AK3911, which describes an approach to tunneling XPO’s IDataStore layer communications through XML Web Services. There’s news in this regard – no special client is needed for this any longer. The feature has actually been around since version 6.1.4, but somebody forgot to tell us about it :-)

How does it work? Very simple: the client-side functionality from the demo project of AK3911 has been integrated into XPO itself. That demo project implements a class called WebDataStore on the client side and uses that class to communicate with the Web Service on the server side. The Main method contains this code to build up the XPO data connection:

  XpoDefault.DataLayer = new SimpleDataLayer(new WebDataStore("http://localhost:2224/XpoGate/Xpo.asmx"));

With the new feature, this is no longer needed, so the WebDataStore class can be removed from the demo project. Instead of the line above, the Main method should have this line:

  XpoDefault.DataLayer = XpoDefault.GetDataLayer("http://localhost:2224/XpoGate/Xpo.asmx", AutoCreateOption.SchemaAlreadyExists);

XPO will find the extension .asmx on the end of the connection string URL and automatically connect to the given Web Service. On the server side, you can either go the lazy way that the knowledge base article suggests and only implement the two methods SelectData(…) and ModifyData(…) (in that case, make sure to use AutoCreateOption.SchemaAlreadyExists, as shown above), or you can implement all methods from the IDataStore interface for complete functionality.

Tags
15 comment(s)
Anonymous
Alain Bismark
Great..., but...

i think that is better is you can provide us with a complete example about this..., using a WindowsForms application conected to a webservice, doing CRUD operations over a database with at last two tables (mater - detail).

thanks a lot.

Alain
14 July, 2006
Anonymous
Alberino Fattibello
SchemaAlreadyExists is mandatory ?
It is possibile (of course there is security concerns about this, but this is not the question) to update the schema via web service ?
14 July, 2006
Oliver Sturm (DevExpress)
Oliver Sturm (DevExpress)
Alain - the demo project from AK3911 already contains such an application. In fact it's the same application we've always delivered with XPO (ContactManagement), only it's been modified to work through the Web Service. Isn't that what you want to see?

Alberino - I was trying to answer that question in the last sentence of my post already. The demo application from the KB article goes the lazy way of implementing only two of the methods from the interface (download and try it, you'll see what I mean). If you want to go this way, you'll have to use the SchemaAlreadyExists flag. But the Web Service client that is now integrated into XPO is also able to use the other methods (the ones that have been left out in that demo) if that's what you want. You'll just have to do a complete implementation server-side and then you can actually update schema from the client as well - mind you, I wouldn't want to do that with a Web Services client... even in "normal" client/server setups I don't normally let each client hack around in the database schema.
14 July, 2006
Anonymous
Alberino Fattibello
Thanks for the answer, now i see the complete picture ...
I forgot to mention that (also for this functionallity) XPO is fantastic ...

Thanks for the info ...
Best regards,
A.
14 July, 2006
Anonymous
Dan Vanderboom
Oliver - it's good to know we can update schema through a web services connection.  LIke you, I would never roll out such a solution to a customer, but it's a time-saver when developing.  In distributed systems where you have web sites, other web services, Win clients, and CF clients, all accessing the database, it's easy for the domain class libraries to get out of synch, and a pain to have to recompile them all because you get a SchemaNeedsUpdate Exception (or whatever that's called).

The alternative for me has been to connect directly to the database, and leave the web service connection code in there as well (commented out) until ready to do intergration testing.
14 July, 2006
Anonymous
Alain Bismark
Well, i think that is better an example for dummies, to everybody who is new on XPO world.

Thanks in advance
14 July, 2006
Anonymous
Rollie Claro
You are all great!

  I have a question. for client apps using XPO and WebServices.

 I have Two server setups. one for the WebService(IIS) and the other for the Database Server.

 now, WebService(IIS) is setup outside the Militarize zone of a company, lets say in an Internet service provider. while the Database Server is setup inside the Company's Datacenter, that is the Militarize Zone.

   the issue is, WebService(IIS) is not allowed to send info to Database Server. the port is block by a certain firewall. However, Database Server is allowed to browse WebService(IIS).  
 
  current setup allows the two servers from communicating. communication is two way for WebService(IIS). but the company demands that since the WebService(IIS) is setup outside the company's datacenter, only the Database server should be allowed to read the WebService(IIS).

   How do i update the Database Server since the WebService(IIS) is not allowed to issue command?
my idea is for the WebService(IIS) to generate a file so  the Database Server can pickup and parse some commands perhaps and execute it the throw the results back to WebService(IIS).

   how do you do this using XPO?

  thanks.

18 July, 2006
Oliver Sturm (DevExpress)
Oliver Sturm (DevExpress)
Rollie - how do you do this using XPO? Well, preferably not at all - this is a ridiculous requirement, if you'll excuse me being blunt.

Generally a good setup would be to publish a web service from the DMZ to the front end server (exclusively through the firewall) and have the front end server work as a repeater of that service.

In your situation, the only thing one of our devs could come up with was to suggest using the so-called FileChannel, which is described in this book: http://www.microsoft.com/mspress/books/index/6172.asp

The solution would involve publishing a Remoting service from the DMZ server using the FileChannel, and configuring the front end server to consume that service and working as a repeater, using Web Services. Personally I don't have any experience with the FileChannel and I'm sure you can expect an enormous performance hit when using it with XPO.
18 July, 2006
Anonymous
Rollie Claro
Yea you are right! my boss is so paranoid. not to mention that the http connection is secured(https) and the information is encrypted, along a server behind firewall utilizing RADIUS. to name a few.

    thanks for the info. i'll check out the link also.
19 July, 2006
Anonymous
Lu. Po.
What about using a more performant CacheRoot on the server side instead of IDataStore ?
If I implement the CacheRoot interface on the server, I think in this moment XPO use only the IDataStore interface and does not recognize the presence of the others methods.
There is a way yo do this out of the box, or I have to implement a modified WebDataStore class on the client side ?
It wuold be nice that with a single call to XpoDefault.GetDataLayer we can accomodate (maybe with a flag) also the CacheRoot/CacheNode case (also for remoting).
Thanks in advance
20 August, 2006
Anonymous
Lu. Po.
I have made a suggestion for this on the support center:
http://www.devexpress.com/Support/Center/ViewIssue.aspx?issueid=DS29386
Thanks in advance
21 August, 2006
Anonymous
Federico
Hi Oliver

What about security? How I can limit the access to web service.
Thank you
13 September, 2006
Dan Arnold
Dan Arnold

How can you use SessionState to implement security. I cant get it to work.

30 March, 2008
Anonymous
eXpress App Framework Team

This is post no. 10 in the mini series "10 exciting things to know about XAF". You can find

31 May, 2008
Anonymous
Bill Altmann

Why is there no CreateData() or DeleteData() in the IDataStore interface?

17 July, 2008

Please login or register to post comments.