Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Building Blockchain Apps this week in the Cloud/Virtualization forum!

Michael Bruesch

Ranch Hand
+ Follow
since Sep 23, 2001
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
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Michael Bruesch

I think the WSDL2Java tool is creating the client classes correctly, but I think the WSDL itself may not be accurate. Before I try another tool (wsimport) I want to see if I can fix this issue since we only use Axis here at work. I tried adding the maxOccurs attribute to the response but it caused an exception:



It says: javax.wsdl.WSDLException: WSDLException (at /definitions/message[4]/part): faultCode=INVALID_WSDL: Encountered illegal extension attribute 'maxOccurs'. Extension attributes must be in a namespace other than WSDL's.

Where would I add the maxOccurs attribute?
8 years ago
Thanks for the reply. I forgot to include this part:



Which appears to me that it should only return one DL-TankInventory object?

I'm not familiar with wsimport, I'll have to look that one up.
8 years ago
I'm very new to web services so please forgive my ignorance. I'm trying to consume a web service to which I was provided the wsdl. There are several complex types being returned by the web service. Here is an example of one:



I used WSDL2Java to create the client classes and everything seems ok there. It created a class called DLTankInventory (same as the complexType without the dash). When I call the method that should return this DLTankInventory object it throws a ClassCastException saying it can't cast ArrayList to DLTankInventory.

I used the soapUI program to test the web service and it works, but it returns multiple DLTankInventory objects (maybe returning an array?). The WSDL2Java tool seems to think it should only return one DLTankInventory object. What am I doing wrong? I can post more of the wsdl or client code if needed.

Thanks

--EDIT I went into the Stub class and modified the function to cast the returning Object to an ArrayList of DLTankInventory object and it seems to be working now. My question still is why WSDL2Java wanted to make it return a single object. Is the WSDL wrong? I've been told it is correct.
8 years ago
Ack! I had the slash in the wrong place in <shortcut/>. I changed it to </shortcut> but now I'm getting different errors. Let me try to fix those, if not I'll be back!!

11 years ago
Hi all,
This is my first attempt at using Web Start and I'm having a problem I can't figure out. It says I'm missing the application-desc field but everything seems to be there. Any suggestions would be greatly appreciated.


Here's the .jnlp file:


And here's the stack trace:
11 years ago
You're absolutely right, I didn't see that at first somehow. Everywhere I went reading about using timers for swing apps everyone said "Use the Swing Timer!" and so I did without question I guess. I'll try the util Timer and see how it works. Thanks Ulf!!
Yes, each class has it's own GUI. It's ugly but it's the only way I could figure out how to run the queries concurrently. I've been told now that the java.util.Timer runs each timer event on it's own thread. I'll have to try that and see if it works (I've been using the javax.swing.Timer). Otherwise I'll have to take the ugly approach again and use 2 different web starts.

Thanks Paul.
11 years ago
Forgive me if this question has been asked already, I searched but couldn't find anything. I have a Swing app that has to run about 15 queries and display the data, pretty simple. Some of the queries take mere milliseconds while some of them take several minutes to return the data. I have the queries set to run each time a Swing timer fires. My ideal situation would be to have the data update every 5 seconds but that's not possible with the slower queries. I broke the queries into 2 groups, the really fast ones and the really slow ones. I even set them on 2 different timers on different threads, the fast ones run every 5 seconds, the slow ones run every 5 minutes. The problem is that when the slow queries are running the fast queries wait until the slow queries finish before they run again, even on different threads. I switched to use the SwingWorker class and am having the same problem.
I've tried everything....using separate DB connections for each query group, putting the queries into 2 separate classes with separate connections and calling one main from the other but it always seems to bottleneck at the database (Oracle). The only way I've found a way around this is to start the 2 main classes completely independent of each other. Now each set of queries can run at the same time but I've had to split my Swing app into 2 separate forms and it's a pain in the butt because I'm trying to learn Web Start now.
Sorry this is so long but I wanted to make my problem clear. I hope there's an easy solution because I can't seem to find it.

Thanks for any advice!

I'm trying to run my application using Web Start but I have 2 main classes I need to run (it doesn't work for me to call one main from the other...long story). Is there a way to accomplish this?
11 years ago
Oh yes, I will almost always choose readability over saving a few nano or milliseconds, but since they both seem equally readable to me I figured I'd see which one performed better.

Thanks for all the replies!
11 years ago
Have any time studies been performed to analyze the difference? I've done limited searching online on this topic but can't find anything conclusive.
11 years ago
When you are accessing a private instance variable from within the same class, is it "more correct" to access the variable directly like

or to access it through the get/set methods like

It would seem to me that direct access would save a few milliseconds.

Thanks!!
11 years ago
Glad to see my thread is still going strong 2 years later! To fill you in on my progress, I'm now working in the tech support dept for a call center in NC, and I've written several internal apps for the IT dept in Java (using Notepad). They are impressed with my work, however I still can't get a position as a programmer because I have no paid "real-world" experience. I'm Not sure what I'm supposed to do. I have my degree now (double major Comp Sci and Math), I'm certified as SCJP, A+ and Network+. Any suggestions on how to break into the programming world? (Programming is my true love and I won't quit until that's what I get to do all day). Keep the replies coming!
As far as questions 1 and 2 go, try not to think of it in terms of pass by value or pass by reference. It is quite different than C++. What I did basically is forget all that when dealing with Java, and worry about what it really is doing, not what to call it. As far as what it really is doing, you are correct in your previous statements. Java is built slightly on the C++ syntax, but it is very different. As long as you know how it works, don't worry about whether it's by value or by reference (this has been a large and heated discussion between many Java programmers for a while now, you'll get a different answer every time you ask the question).
Same thing with the question of pointers. In Java as you know, they're called references. Whether or not they hold a pointer to the actual object is irrelevant, we know how it works, we know how to use it, that's all that matters. It's a reference, not a pointer, very different. If you want to think in C++ terms, then think of the interface and the implementation of a method or class. If you want to know how to use the method or class, you look at the interface, you need not look at the implementation because you shouldn't be concerned about how the method is doing what it is doing, just know that it is doing it correctly and that you are using it correctly. And I only use C++ as a point of view because that's where a lot of people migrate to Java from (myself included).
I've rambled enough, you get my point.

------------------
Michael J Bruesch
Codito, ergo sum...
I code, therefore I am.
My Java Games, I'm quite proud
18 years ago
Just as Cindy said (she is always correct), by default err and out print to the same place, the console. You can redirect either to print to your preference of locations. As far as I know, there are err and out only for purposes of the programmer. If you want to specify something as an error, or just want to see when a certain condition occurs, you can print it to err on the console. You can then send the out stuff to a file, for example, and the err messages won't get mixed up with the out stuff. It basically gives you 2 means by which to print things. That explanation was not very good, but I hope it helps a little.
------------------
Michael J Bruesch
Codito, ergo sum...
I code, therefore I am.
My Java Games, I'm quite proud
18 years ago