Sunday, August 17, 2008

data source class used by IS to connect to database

Today, I am exploring webmethods regarding JDBC adapter. In my local machine, I have only 2 DBMS, which are MySQL and sql server 2005 express edition. Huehuehue.... as you know they are free and I can learn a lot from a free thing :P. Anyway, I had a problem today regarding connection to those DBMS.

This blog tells you about data source class that I use to create connection to MySQL and SQL server 2005 express edition.

However, I was trying to find out what is the class to connect to MySQL and sql server. I found a site talking about it. It says that I need to put datasource class like the following and it works fine:

com.mysql.jdbc.jdbc2.optional.MysqlDataSource



However, I still could not find any site saying about SQL server 2005. Then, I look around to jar file and I found the following class:

net.sourceforge.jtds.jdbcx.JtdsDataSource

Sunday, August 10, 2008

Exploring webmethods 2 (Sending xml file via http)

Today's exploration is about webmethods. To be more specific is sending a file to IS through http channel. I had done the following ways and only one success. I am not really sure what is the cause of it.

  • html post, This way I just create an html page and publish it using apache webserver. As usual, I create html element file. Using this element, I can choose whatever file that I want to send over. The form itself, I point to the flow service that I had just created. But unlucky me, this way fails and I dont know what is the cause.
  • Apache httpcommon , I was playing around with this useful stuff. The first try I failed. In the first try I was using a class that I am not familiar with. The following is a piece of code that I use:
Part[] parts = { part , new FilePart(f.getName(), f) };
filePost.setRequestEntity( new MultipartRequestEntity(parts, filePost.getParams()) );

The above method is actually encapsulate a file in the variable named parts. This way fails with the same output as the first way and again I dont know what is the cause of this problem. However, the second try is success. In this way, I was using the following code to send a file.

File f = new File("F:/SINAU/WM/xml/test.xml");
FileRequestEntity fileReq = new FileRequestEntity(f, "text/xml"); filePost.setRequestEntity(fileReq);

In the flow service side, I perform the following flow steps, to extract or parse the result that I want to:

What the above flow steps do are:
  • Fetch a content of file and put it in the variable test.
  • Convert the content of file to document type.
  • Perform query on the node.
The above sample may be not really efficient as it seems that I can directly query from node using flow step queryXMLNode.

The next exploration is... errmm... not sure !!!! :D

Wednesday, August 6, 2008

exploring webmethods 1

It has been a long time for not blogging. Today, I am exploring webmethods stuff. it is about reading a file to xml. I want to give a bit comment on webmethods documentation. You guys, are suck. The documentation is definitely suck. Even more, the way they named the flow service. The reason why do i tell you, it is suck:

  1. You just give the explanation with less example. Of course for me as beginner, will be having a lot of damn trouble.
  2. The flow service's name is sometime a bit difficult to interpret. if you want to have people understand on some methods, you need to have a very representative method's name of its function.
  3. There are no official, detail and complete documentation so that people can learn your product easily.

Huh, after sometimes struggling to find out on how to read a file from file system (previously, I have sent a file through ftp and get the file from ftp using webmethods), now I will blog my experience. In order to read a file, webmethods has it's own way to treat each format file. it has a way to process an xml file but I am not sure on how to read another file type. To read an xml file, is pretty much simple. First, you need a flow service named getFile. Set the load type as Bytes. The output of this flow service can be an input for another xml flow service which is xmlStringToXMLNode.

That's it, until this state, you get the xml to be loaded as a note but you cannot read it as it is an object. In order to read a node, either you read it as String or you read it as document. In my experiment, I was using xmlNodeToDocument. Yeah!!!1, that's all. You can load, read and process after the output of this flow service comes out.