Marek Krokosinski

Ranch Hand
+ Follow
since Jun 10, 2011
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
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 Marek Krokosinski

Hi

I wanted to ask if you have any experience about adding  functional style programming to existing java projects? Any thoughts? For me functional programming is completely different mindset, and honestly I cannot imagine how this could be introduced into project with thousands line of code. Of course, in case of microservice architecture it's easy, as each microservice can be written independently and can be written even in different language. In case of some 'core' service it might be hard. Do you have any experience with such scenarios? Can you share some good practices?

Praful Thakare wrote:

I have chosen wrong web service framework ;)



which one ?



JAX-WS. I should choose axis or CXF
11 years ago
I'm using jax-ws, and here is the problem, I have chosen wrong web service framework ;) I will think about changeing framework for one of them. If I won't find any other solution for my problem then I will have to do this, thank you for help Praful Thakare (again )
11 years ago
Oh, why I didn't saw your post 20 minutes ago, now I have resolved my problem by putting everything in one class...

It's working as I wanted, but it looks terrible. I don't know if I want to change it now.

Anyway thank you for solution, and sorry for messy code in the first post, I will try to clean it up before posting it on the forum.
11 years ago
Hello

I have problem with changing card. I have a JPanel with CardLayout as layout, and other JPanel which contains JPanel with JTree. I want to add TreeSelectionListener. If I click on the node, card should change to the node title.

Here is some code:

The listener from which I want to change cards is in the second code snippet under line 159.


JPanel with cardlayout:


Here are two classes which builds JTree:


and the second class, which add JTree to the gui:


Any ideas how could I change cards in ThumbPanel from the listener in JTreeHelper ?

I have also asked that question on stackoverflow
11 years ago

Praful Thakare wrote:

(for websites it would be browser) have access to the session attributes



hell NO

All that browsers knows is the session id that is mostly stored in cookies by browser and with every request browser sends this session id to server and that's how server identifies session for given user.



ooops :>


I don't get the remaining points you made, , I thought getCategory was returning list of categories after reterving ti from session for given user.

but the web service (jax-ws) can't return List, ArrayList, Maps etc



are you sure? did you try it? did you try HashMap (concrete type) instead of Map (Interface).

-P



No, no, my first plan was saving category list in session, and then retriving it from session on client - now I know it's impossible or hard to code. Yes I have checked that. I was trying with HashMap, Map, ArrayList and Object. I also found http://docs.oracle.com/javaee/6/tutorial/doc/bnazc.html .
I can't belive, that returning simple HashMap is so hard :/
11 years ago
I thought that session works like on websites. User login in, webserver creates session and client (for websites it would be browser) have access to the session attributes. I was thinking about the solution which you have provided (pass the username to getCategory). It's good enough for me, but if I can't save anything in session, and I can't pass arguments using session I will have other problem, The category list then should be returned in getCategory ( it would be public List getCategory(String username) ), but the web service (jax-ws) can't return List, ArrayList, Maps etc. It can return only simple arrays and raw types. It's bad solution I think. I don't know how I would solve that.
11 years ago
maybe somebody knows if I can get session object with those attributes? I was looking on the google for solution, but no results. Anyone please?
11 years ago
Hello.

I have web method "GetCategory" on WebServiceServer. In that method i save the category list in as session attribute.
On WebServiceServer I have:


I have a desktop app and I want to pass username (which is stored in session) to getCategory webmethod. But I don't know how to do this, how to get this session object. In WebSevice client I have:



but of course i can't get Session. How can I do this?
I will add more infomartion about what I want to do. I have getLogin in my WebServiceServer. On the client side I pass through it login and password. getLogin method check if login and password is correct, return true if they are, false if they aren't. It also saves username in session. In getCategory I want to pass username, and select categories from database which are assigned to this username. The problem is, that I can't get username from session.
11 years ago
Thank you very much Praful Thakare. Earlier I was looking only on tomcat-XXX logs, but this time the error was in catalina-XXX log file. Application couldn't connect to database (It was rejected by mysql security file), after reconfiguration of MYSQL security settings everything works perfectly ! And thanks for soapUI tool, I think that It will be very useful for me.
11 years ago
Ok I have installed the trial version of soapUI. I made test like here http://www.soapui.org/Functional-Testing/functional-testing.html

and when I created new project from wsdl, I get all methods.
Hello world works fine, but of course in getDataFromDb throws errors. The text from "AUT" tab is SOAP RESPONSE VALID and RESPONSE SLA VALID. HelloWorld and getdataFromDb are shining on green color, but the response from getDataFromDb is not correct.
I don't know exactly how to debug it but in XSD there is:



in table 1 I have: Cannot open connection

In RAW tab;

11 years ago

Praful Thakare wrote:well, in development phase of my web service I always use some tool for client, like SOAP UI for jax-ws and/or RestClient for Jax-RS. for simple reason it helps me to narrow down the problem.
once my web service gives expected result using these tools, I am sure my web service is working fine then I go for developing client (if required) so any issue here after is (always) related to client.

so if possible for you, try to use SOAP UI and see if you can access both methods without error.
If not then one way is to narrow down the problem is to invoke getDataFromDb from helloworld in server and invoke only hellowWorld from client.
so steps are

Modify Server HelloWorld method to invoke getDataFromDb (I assume both are in same class so it will be local call)
Modify Client and comment the call of getDataFromDb.

if this works fine, i.e getDataFromDb is success then yes there is something wrong with the way you are invoking it from client.



I will look on that soapUI, and when I will get back home, I will try to modify the HelloWorld method.

thank you for your time, I will post my results.
11 years ago
Application deploys correctly, server logs are empty.

I can see the wsdl after entering my server address. And I can enter on it when hello world method is added, and when helloworld and the database method are.added It works, XML file is always displayed.

Maybe I will tell one more thing. Server is always online, like I said. When I run client and I try to use both of these methods, I get an exception. When I will comment on client the part which tries to use the WebMethod which connects to database, client connects with WS Server and it gets response from helloworld method. So maybe problem is with client? The method which connects to the database is first method which I have ever wrote for webservice, so there is big chance that I made that wrong...
11 years ago
To connect to external server i use http://ip.address:8080/WebServiceServer/WebServiceSvr?wsdl

On localhost it also doesn't work. URL is almost the same (ip.address is switched to localhost).

I think it's not a firewall because when I will delete the method which should get data from database it works fine (hello world is working).


On localhost I have tested the Hibernate connection (I created class with main method and I made some request to that external database, I have ran it as java application) and it also worked fine. So from localhost when I run the java app with that Hibernate files I can connect to database on external server.
11 years ago
Hello.

I have a problem with my JAX WS Client-server connection. So I want to connect to the database through webservice using hibernate. So I have something like this:

I run WSserver which is on external machine, server connects to database which is on the same machine as WS Server. I run client from my pc and there is exception



On my external server I have same java version, same tomcat, everything is the same. When I had a test client, (simple hello world) it worked fine, I had the connection. When I have added the part with hibernate and database, I've got the error like above.
Any ideas what can couse that error? You want me to post source code?

Best regards.
11 years ago