aspose file tools*
The moose likes Servlets and the fly likes Unable to invoke servlet from client (simple java class) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Unable to invoke servlet from client (simple java class)" Watch "Unable to invoke servlet from client (simple java class)" New topic
Author

Unable to invoke servlet from client (simple java class)

Raja Sekhar Tiruveedula
Greenhorn

Joined: Jul 21, 2009
Posts: 2
Hi all,
I had written simple servlet and client.I am able to invoke servlet from browser and from JSP page.My servlet is not getting invoked from client (simple java program used URL).
-------------------------------------------------------
Here is my client code



Thanks in advance to all
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61747
    
  67

Please be sure to use code tags when posting code to the forums. Unformatted code is extremely hard to read and many people that might be able to help you will just move along to posts that are easier to read. Please read this for more information.

You can go back and change your post to add code tags by clicking the button on your post.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

How are you invoking it from the browser? I would have thought you'd have to give it a parameter name.
Raja Sekhar Tiruveedula
Greenhorn

Joined: Jul 21, 2009
Posts: 2
hi david,
I am simply placing this URL in browser(address bar)

http://localhost:8080/B2BServer-war/B2BConnectorServlet
Katty Knk
Greenhorn

Joined: Jul 21, 2009
Posts: 3
Sekhar,
Could you explain bit more about your servlet, like what kind of input your servlet would expect from the client? and expected response?. As per the client code you have written, it looks to me that the servlet is expecting "File" kind of input from the client, but in your reply to Davit you mentioned that you have just pasted the URL in browser, this is totally confusing me.

Explain your expected servlet input/output in detail.



Katty Knk
Greenhorn

Joined: Jul 21, 2009
Posts: 3
Katty Knk wrote:Sekhar,
Could you explain bit more about your servlet, like what kind of input your servlet would expect from the client? and expected response?. As per the client code you have written, it looks to me that the servlet is expecting "File" kind of input from the client, but in your reply to Davit you mentioned that you have just pasted the URL in browser, this is totally confusing me.

Explain your expected servlet input/output in detail.





Refer this link, i hope this would give you more detail.
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

well, basically it wont trigger the URL, it create the connection.

to make a request you need to do this
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42906
    
  69
seetharaman venkatasamy wrote:to make a request you need to do this "connection.getInputStream();"

... which is what the code is doing in line 29.

So the response from the server is completely empty, and the servlet's doPost method is not called?
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Ulf Dittmer wrote:... which is what the code is doing in line 29.


i miss that Completely
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unable to invoke servlet from client (simple java class)