Vivek Pinto

Greenhorn
+ Follow
since Apr 19, 2012
Vivek likes ...
Hibernate Oracle Java
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
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Vivek Pinto

Sujeeth Pakala wrote:Vivek

Your issue is not clearly described ( sorry for that ;-) ). Answer below questions :

1.

Java files working fine

-> Does this mean you have some logic and want to expose as webservice ?
2.

generating the webservice

-> Are you generating webervice skeleton from WSDL ?

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.



Hi Sujeeth,

I have some logic and i want to expose as webservice(have done it using the right click ->webservice->create webservice).
"But this selection Must be a WSDL " is error is something for which i am not able to find out the reason.If i close eclipse and build project again fresh then WSDL gets generated.And it doesnt come always!!
Hope you got the problem.
9 years ago
Hi All,

I am trying to build a webservice using eclipse IDE . .Java files working fine .But while generating the webservice it says "Selection must be wsdl".And i observed that some times it throws that error and some times does not.Some times when i create the entire project as fresh project it wont throw that error.
I am using Eclipse IDE,CXF runtime 2.7.1 version and trying to build a SOAP web Service.

Can anybody help me out so as to understand what is causing this freaking behavior.

Thanks in advance.
9 years ago

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.



Yes..Same here..that look ok.I am suspecting wrong inputs are being passed.

Well,If i figure out ,i will post.

Thank you for you valuable time Ulf.
10 years ago
java.io.OutputStreamWriter@10564f7Connection get OutputStream :..........
is null..see the empty place .
10 years ago

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.



this is the out put in console.
Seriously i don't know you are able to follow the problem?

URLhttps://secure.p03.eloqua.com/API/Bulk/1.0/contact/import/164/data
sun.net.www.protocol.https.DelegateHttpsURLConnection:https://secure.p03.eloqua.com/API/Bulk/1.0/contact/import/164/data
java.io.OutputStreamWriter@10564f7Connection get OutputStream :
Server Respose CODE=201

connection.getResponseMessage() : Created
sb.toString :syncedInstanceUri,syncStartedAt,syncEndedAt,status,createdAt,createdBy,uri/contact/import/164,,,pending,2014-03-05T08:45:43.5389415Z,Veeraraghavan.Srinivasan,/sync/413
10 years ago

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).



Hi Ulf,
Sorry ,My Bad for calling you so.

You havent read my comment //in main ,setting up the data,reading from csv .
No problem..

Here is the complete code.
10 years ago
Here is the code..Please let me know if you guys find any need of change.
And i am getting "NULL" value for "connection.getOutputStream()".

10 years ago

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.



Dear Dittmer,

I am new bie to this.Trying for the first time.
In my question when i said input stream,i meant stream of data and not inputStream object.I am reading data from CSV and passing to POST method.

Let me put it in this way ,if you can understand ,then great.

I have a BULK REST API which would create or update Contact record (some thing like baseurl+contact/import/data).now i am trying to call that API...(Hope you understood till here).
Now the input for this API is the records read from a csv file.
I am looking for streaming the POST method...i.e write the data to POST method(Call to POST method of this API).(Hope you got what i am looking for)
10 years ago
Hi,
can anybody tell me how to call a Bulk REST API' POST method by passing the input stream reading from a csv file.
Looking out explanation on inputStream,buffered reader..write..response , and call the POST method.

Thank You


10 years ago
Hi Guys,

I am able to complete the needed feature..

It was my fault while giving the path of the file.(Format of the path).

:-) :-)
Cheers..
10 years ago

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.




Hi Harry,Dittmer,
Thank You so much for the reply!
I have written code(Working as expected) if the file is in my local file system.I may be silly with my questions!!
Now all i wanted to know is that how different it is if the file that i have to read is in some ftp location or some server.
Is it that i have just specify the location from where it should be read?And how it works?

Thank You
10 years ago
Hi,
I have a requirement to build a webservice in which i have to read a CSV file from a location.Please not that WebService.
I have used something like this in local(the file is in my C: drive).

"
String csvFile = "C:/new.csv";
BufferedReader br = null;
br = new BufferedReader(new FileReader(csvFile));
while ((line = br.readLine()) != null)
{
String[] country = line.split(cvsSplitBy);


...blah blah..and the functionality goes...".

Can anybody tell me how to read a file in WebService like how to give path,how to get that file, reading path and etc.

any help is appreciated.
Thanks in Advance.
10 years ago

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?



Hi Tim
!,I would be very grateful if you post a piece of code which demonstrates how to call webservice in java,,,,Actually as you said there is no doubt that the WS is called through SOAP or REST....My requirement is to call siebel webservice from a application...that is i have wsdl file that should be input to the call which will talk to siebel db and xml will be sent back as result and after xslt its displayed on UI...
let me put this in diff way...when we use SOAP UI,the output is XML format na!Which is not userfriendly!!so i am doing a application(webpage)in which i want to call siebel webservice which will pull data from siebel database!!!Hope you got my point.
11 years ago

Hi can anyone give me a sample code which demonstrates how to invoke siebel webservice through java(servlet request and response).

Thanks In advance
Pinto
11 years ago

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.



Hi Tim Moores,
I dint get the concept which you put accross...Let me put some more explanation!
We used Soap UI inorder to test the webservice...But in Soap UI ,the output will be in xml form and wont be in user friendly mode...So i want to create a front end so that i can call siebel weservice and i can render the output in UI.
11 years ago