Kelly Powell

Ranch Hand
+ Follow
since Oct 29, 2010
Merit badge: grant badges
For More
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
2
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Kelly Powell

Currently, we are using IBM VisualAge for Java to program Swing classes for our legacy system. We plan on migrating to Eclipse, but I cannot find a simple way how to. Is there any tool to migrate the VisualAge Java classes repository (.dat file) and visual composition of Swing classes to Eclipse?
I found the solution to it. Instead of using URLConnection, I used HttpURLConnection. It allows me to get the status code of the response and then getErrorStream instead of getInputStream if the response is not OK. I found the solution at: https://coderanch.com/t/433447/Streams/java/HttpsURLConnection-Reading-Body-Response-when . I was searching for the wrong keyword before and is not yet sure regarding the cause of my problem.
12 years ago
This may happen if you are trying to connect to an invalid ip address or port. Check the java classes that you were able to generate using the WSDL if they're using a valid ip address. Sometimes, the ip address is written as "localhost" in the code instead of the real ip address (e.g: localhost:8080 instead of 192.168.0.1:8080).
12 years ago
How do you get the body of a HTTP Response if it has a status code of HTTP 500? When I receive the response below, it is automatically catch as IOException. However, I am unable to get the body attached to it. How do I get the body attached to the response without using any 3rd party API?


Note: I also posted a similar but more detailed question under the Web Service topic. I am not yet sure if this is a web service problem but based on the facts I've gathered, it seems that this problem has nothing to do with web service. Link to my post under Web Service topic: https://coderanch.com/t/546023/Web-Services/java/Web-Service-Client-read-fault
12 years ago
Hi. I have an Axis2 web service and a web service client which is not based on Axis2. I wrote the client from scratch without using any 3rd party API (I'm using URLConnection). I have a login method in my web service which returns the user information if login is successful and an AxisFault containing a message if login failed. When I try to connect in my web service using the client I made, I was able to get the XML response of my web service if my login is successful. However, if my login failed, I am only able to receive IOException.

Here are my questions:
1. Does Java treat AxisFault as SOAPFault? I included SOAPFaultException in my try catch statement before the IOException but the exception still goes to IOException.
2. When I try to invoke exception.getMessage(), I only get a "Server returned HTTP response code: 500 for URL: ..." error message instead of the "Login failed. The username and password does not match." which is the message I set on my AxisFault. How do I get the error message I set on the server?

Some facts:
1. I am using Java both for my web service and web service client.
2. I am not using Axis2 API for my client. I'm writing it from scratch.
3. I am calling the web service in my client in REST style. (http://ip:port/services/webService/login?username=value1&password=value2)
4. I am able to view the AxisFault if I call my web service using my browser (Firefox and Chrome). Browser displays an XML:

5. If login fails and I'm using Internet Explorer to call the web service, I only get an HTTP 500 error message without the XML.
6. The TCP/IP Monitor of Eclipse shows that my web service was able to return a response containing a soap envelope of the fault. Below is the response displayed in TCP/IP Monitor:
Below is a code snippet from the client:
12 years ago
In Android, one can draw a line using shape or View. Assuming that I am using the code below, which is better in terms of efficiency, etc if I am planning to reuse the line in other Activities? Why?

Using shape: (Will then be use as a background for a certain text.)

Using View: (Will then be placed on top of a certain text.)
12 years ago
I am new to PHP and I wonder if it is possible to load a PHP file on application startup? The problem is I have PHP script which I want to be loaded when I my application starts. I will be using it to initialize whatever needs to be initialized and to continuously check for updates. How do you configure a PHP file to load on startup? Thanks! A link to a tutorial will do.
12 years ago
PHP
I am using Eclipse to generate an Axis2 web service client. However, since I have multiple services, I need to generate their codes from different WSDLs which results to multiple stubs. (e.g. Service1 has its own stub. Service2 has its own stub.) I know that when generating a client using Eclipse, the manage session is not set. And so, I have to set it to true. I was able to successfully maintain the session but only for the service I am using. (e.g. When I am using Service1 and then suddenly switch to using Service2, my session on Service1 is not seen on Service2 anymore.) How do I set the 2 services to use the same session? Also, the 2 services that I'm using belongs to the same service group.
12 years ago
Hi. Is it possible to generate a single WSDL for multiple services? How do you do it in Axis2? Currently, I have multiple services which is under one service group.
12 years ago
Sorry, I almost forgot about this thread. I understand it now. Thanks, Mark!
12 years ago
@Kurtcebe Eroglu: Thanks for the reply! Same here. Even though I was already able to fix the problem, I still can't figure out why WAS suddenly behaved like that before. Anyway, I was able to fix it by restarting WAS. I also save the link of the save function just in case it happens to me again.

Kurtcebe Eroglu wrote:I also recall having problems on adminconsole controls while using chrome as browser; it sometimes does not play well with javascript on admin pages.


Thanks for the tip!
12 years ago
@Cambell: Yes, static is not an access modifier. I am just stating that it is possible to access a class' method without the need to declare a variable of its type. I'm talking about the ways he can access a method not the access scope of a method.

Mezan Shareef wrote:... is it possible that i call Class2.method1. ??...


If he wish to access a method using its class name (e.g. ClassName.methodName()), then that method must be declared as static. Based on his question, I assumed that "Class2" is a class name. If that is the case, then "method1" must be declared as static. Clearly, he won't be able to access "method1" using "Class2.method1()" if "method1" is not static.
12 years ago
Private and protected are examples of access modifiers. All in all, there are 4 types of access modifiers.

If a variable is private, it means that it is only accessible inside the class where it is declared.

If a variable is protected, it means that it is accessible not only inside the class where it is declared, but also to other classes which belongs to the same package as it is. A protected variable is also accessible to its subclasses.

You may visit the link provided by Campbell for the other access modifiers.

Dynamic initialization is when a variable's value is determined on runtime rather than on compile time.

For example,

The reason for this is because when the variables are compiled, the compiler already knows that the value of num1 is 2 and so it assigns the value 2 to num1. However, a compiler only compiles, but does not compute. When the compiler sees 1 + 1, instead of computing it and assigning the sum to num2, it assign 1 + 1 directly to num2 without computing it. Now, when num2 is run on the runtime, 1 + 1 will now be executed and it is the only time that the value of num2 which is 2 is determined.

Mezan Shareef wrote:one more doubt, lets say there is class 1 which has method 1. And there is class 2 which has some method. they are in same package. is it possible that i call Class2.method1. ?? i do not understand how ?



Yes, it is possible. In fact, you may access the methods of Class2 even though you're in a different package. One way to do it is what Campbell had shown. The other way is to declare the method as static. A great example for this are the methods of the Math class. Ever wonder why you can easily access the methods (e.g. Math.abs(param)) of the Math class without the need to declare a variable of type Math? It's because they are declared as static.
12 years ago
Found it. I already know how to enable session on Axis2. SOAP session has almost the same with the token-based authentication so I just needed to add a login operation to validate the user. If he's a valid user, I'll save an indicator in his session indicating that he was already validated. I found the tutorial at: http://wso2.org/library/articles/axis2-session-management-part-2.
12 years ago