Manhar Puri

Ranch Hand
+ Follow
since Aug 23, 2005
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
(keep public parts private until JForum day)
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt
Moderation Tools

Recent posts by Manhar Puri

If an application is not using two different technologies , then is it still good to use Web services ?



Sure why not. Imagine the case where there are 5 Java applications in an organization developed by different teams and all require a search feature.

You can build a central search feature and expose this as a WebService for all five of them.

The above one a very simple example but can be expanded to create shared services architecture for complex applications.
8 years ago
Couple of ways:

1) Create a method in the webservice which can be used to poll the health of webservice.
2) I am not sure of how your webserices are built, but obtain the wsdl file by typing in the required url in the browser. For example to obtain wsdl file from weblogic you can type http://myServer:port/MyProject/MyWebService.jws?WSDL
3) If have a UDDI registry being used then I think you can inquire about a webservice.

8 years ago
I am not sure why you commented out the line

FileInputStream url= this.getClass().getResourceAsStream("properties");



Is there a reason for changing the path from "properties" to "../properties"?

Try the code below:


Also please provide the name of your properties file as well location.

8 years ago
I have not tried this but you can run dos level commands from java code. Thus in theory you could launch the java command for your other class from the callee program and add the parameters like: -Xms1024M -Xmx1024M -XX:PermSize=256M -XX:MaxPermSize=256M. Here is a sample code to do this:

String cmd = "dir";
Process process = Runtime.getRuntime().exec(cmd);

If you are able to get it working please put your code here for other members.

Thanks.
8 years ago
Just googled your error message and found this forum

mail-archives.apache.org
8 years ago
You can convert the UTF-8 bytes to Unicode as shown below by the pseudo code. The compare it as a string in Java and replace with empty string.

byte[] utf8 = <whatever data is>
// Convert from UTF-8 to Unicode
string = new String(utf8, "UTF-8");


Hope this helps.
8 years ago
Karthik,

Its been sometime since I worked with Web Services, but as far as I remember you could collect these phone number in an array and send them across to the Web Service.

Process the array over there and return back an array containing whatever the result is. Most probably you will face issues with declaring type of the Array and its contents on the response. Look into Castor in achieving this.

Let me know if you have some doubts.

Oh forgot to mention, the above can be achieved only if the both the Web Service itself and the client is being created by you. If the Web Service is already existing then looping can some problems in performance. Again depends on the number of calls made to the Web Service.

-Manhar.
[ April 04, 2007: Message edited by: Manhar Puri ]
10 years ago
Shariq,

You can visit the website below for starting:
http://java.sun.com/webservices/docs/1.6/tutorial/doc/index.html

Also you can check out Apache Axis website. Apache Axis is a famous open source tool used to build Web Services. The Apache Axis website address is:

http://ws.apache.org/axis/

-Manhar.
10 years ago
Emile,

- Are you able to find out at which line of the code you get the result set closed exception? Please provide the stack trace, if present.

- Are the methods of the class you have given called from some other class? If so, can you provide that code?

-Manhar.
Jesse,

Your code looks fine to me, just check if your insert statement works from the sql editor i.e. try your insert directly on the database.

Also just check if you are actually able to get the connection successfully.

-Manhar.
[ March 29, 2007: Message edited by: Manhar Puri ]
Rajesh,

You can convert the image data to a stream and then store this in a column of type BLOB. The website below provides the table design but the code is PHP.

http://www.onlamp.com/pub/a/onlamp/2002/05/09/webdb2.html

Other more generic solution, could be to store "the location of the image on the hard drive", in the database.

-Manhar.
Rudy,

In the above case "Done" will not be printed if an exception occurs.

In case of finally no matter what happens in the try block the finally block of code is executed. You should put code like cleaning database connections in the finally block, since you always want to close the database connection no matter what!

Hope this helps.

-Manhar
10 years ago
Thank you Jan for your response. That does provide a solution for my design. Do you have any ideas on improving the DAO design itself?
Hello ranch members,

I have the following scenario and would like suggestions on the best possible design for it.

TableA (id_A, blah1, blah2)
TableB (id_B, id_A)

I am using MySQL and id_A and id_B are primary keys for the respective tables. I am generating values for keys using AUTO_INCREMENT in MySQL.

I have a single DAO class and want to insert data into both these tables using it.
My problem is how would I insert a value for id_A in TableB.

The only way I could think of is was that insert values in TableA and the query the newly inserted record, use this id for TableB.

There are two problems with above approach one an extra select query and second since I am auto generating the key values I do not know the value of id_A for the newly created record.

Any suggestions are appreciated.

Thanks,

Manhar.
I am not very sure of this but try changing the modifier for your variables from protected to private.

Also what happens if you set the completionTime variable.

Let me know if it works.

-Manhar.
[ June 29, 2006: Message edited by: Manhar Puri ]
11 years ago