Sujeeth Pakala wrote:Vivek
Your issue is not clearly described ( sorry for that ;-) ). Answer below questions :
1.-> Does this mean you have some logic and want to expose as webservice ?Java files working fine
2.-> Are you generating webervice skeleton from WSDL ?generating the webservice
BTW, there are 2 approaches to build webservice.
1. Contract first (prefered way): You have WSDL and aim to generate webservice skeleton. This is doable in eclipse. Right click on wsdl -> Webservices ->generate webservice skeleton.
2. Contract last: You have solution logic and aim to expose as webservice. This is doable in eclise too. Tight click on the java implementatin class- > webservices -> create webservice.
Mkyong created nice JAX-WS tutorials. (Thanks to him ;-)). I recomend to go through them, which will give you good idea .
Hope this helps.
Ulf Dittmer wrote:"null" is not the same as no data; please be precise about what's happening, we have only what you write to go by.
Are we still talking about the last code you posted? That looks a bit different - it couldn't have produced the exact output you posted just now. Printing either "wr.toString()" or "connection.getOutputStream()" is not particularly useful - what do you think those should print?
Given what is printed after that ("sb.toString..."), do you have reason to believe that something is going wrong? It looks OK to me.
Ulf Dittmer wrote:So there's a NPE in the line that contains "connection.getOutputStream()"? That's quite odd, as connection can't be null - several methods are invoked on it before that line. Please post the entire stack trace.
You should not close the OutputStreamWriter where you're doing that now, as closing it will close the underlying connection - close it when you're done reading as well.
Ulf Dittmer wrote:OK, you're getting an NPE. But the code does not show how you're obtaining the connection, so we can't speculate what might be going wrong.
And if that's the problem, please clarify how that block of code relates to the WS call (see my previous post).
Ulf Dittmer wrote:I'm not quite sure what you're asking, or rather, I don't see the connection between handling a CSV file and a REST WS call. The WS si just server-side Java code - it can do anything any other Java code can do, including handling CSV files in whichever way you can imagine. But what do you mean by "passing the input stream from a CSV file"? Is the CSV file on the client? If so, you need to send its data as part of the WS call if the server needs to process it, an InputStream is not something you can pass between client and server.
Ulf Dittmer wrote:What difference do you see between reading a CSV file from within WS code, and reading a CSV file from any random piece of Java code?
I advise to use a CSV library (like one of the ones listed in https://coderanch.com/how-to/java/AccessingFileFormats) instead of rolling your own CSV parser.
Tim Moores wrote:A WS is generally invoked via SOAP or REST, not through a servlet. If you're asking how to invoke a WS from within a servlet, then that doesn't differ from how you'd invoke it from any other piece of Java code. Maybe I'm misunderstanding what you're asking?
Tim Moores wrote:Not sure if there's anything special about Siebel WS, but generally you'd get ahold of the WSDL for that web service, and then use the tools that come with your WS implementation of choice to create the WS client code.