wood burning stoves*
The moose likes Web Services and the fly likes Webservice for beginners Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Webservice for beginners" Watch "Webservice for beginners" New topic
Author

Webservice for beginners

ujwwala tem
Ranch Hand

Joined: Feb 10, 2010
Posts: 83
Hello,

I am new to webservice,and I want to work at client side for requirements so what can be the task in a brief for client side for webservices and also guide me for good tutorial link,I am trying to learn throgh google but for easy understanding I am looking for.

Thanks,
Ujwwala
Jim Akmer
Ranch Hand

Joined: Jul 06, 2010
Posts: 104
Usually if you work at the client side only, it means that a web service is already deployed and the wsdl is available. So using various generators by JAX WS, cxf or axis what ever framework you decide to use, you create client stubs created by the wsdl processing. After you have the stubs in place you start developing your code so that you can communicate with the web service. A simple tutorial can be found here Design and Develop JAX WS services
ujwwala tem
Ranch Hand

Joined: Feb 10, 2010
Posts: 83
Hi,

Thanks for the info,

I am trying to run as per the totorial,Its running step by steb but at last in the class Orderclient.java for the OrderItem item = new OrderItem();
item.setItemId("11");
item.setQty(11);

order.getOrderItems().add(item); I am not able to add the item,Its giving me as compiler error, I had java6 installed on my m/c I made the settiongs in eclipse also,set the environment variables also,On my m/c there are jdk1.5 also but I am not using them,Please help where could be the problem.

Thanks,
Ujwwala
ujwwala tem
Ranch Hand

Joined: Feb 10, 2010
Posts: 83
I have checked java -version in the command prompt Its giving me for 1.6 I am not able to figure out why the order.getOrderItems().add(item); causing syntax error no add function
Bernhard Haeussermann
Ranch Hand

Joined: Aug 05, 2009
Posts: 38
Please show us some more of the code that precedes the call to the add() method, so we can see what the context is.
Please also give us the exact message string of the compiler error.
What type of object does the getOrderItems() method return?
ujwwala tem
Ranch Hand

Joined: Feb 10, 2010
Posts: 83
This is the code in orderclient as per the tutorial you had given https://www6.software.ibm.com/developerworks/education/ws-jax/section5.html


So its saying as can not invoke add(OrderItem) on the arraytype OrderItem[] in orderclient.java as I have java6 and in eclipse I have configured all the settings jdk1.6 and all and in environment variables aslo I have set.

Thanks,
Ujwwala
Bernhard Haeussermann
Ranch Hand

Joined: Aug 05, 2009
Posts: 38
Hello Ujwwala,

the problem is not your JDK. In Java, an array does indeed not have an add() method.
I suspect that the problem is in the OrderBean class. Perhaps orderItems should have been a List<OrderItem> and not an OrderItem[].
If the length of the array returned by getOrderItems() is larger than 0 (you can use the length-data member of the array to inspect its length, as in System.out.println(order.getOrderItems().length)), then you could simply assign the OrderItem object to the first element of the array, as in order.getOrderItems()[0] = item; .
If this doesn't work (perhaps because the length of the array is 0), your OrderBean class won't cut it. In this case the problem evidently lies in the client stub generator that you're using. Try using a different one.
Jim Akmer
Ranch Hand

Joined: Jul 06, 2010
Posts: 104
Hi,

I tried the code in my machine, not used an IDE and have java 1.6.0_20 and it works fine. Did you just try to copy-paste the code?
Better is to download the code of the tutorial from Source code of tutorial and try again.
dibakar sinha
Greenhorn

Joined: Oct 02, 2011
Posts: 15
I am a beginner. I want to learn webservices .Please help me with some tutorial or files , Using example will be great!!!
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3817

dibakar sinha wrote:I am a beginner. I want to learn webservices .Please help me with some tutorial or files , Using example will be great!!!

Introduction to web services with examples(in NetBeans) can be found here.


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Webservice for beginners
 
Similar Threads
Setting time out for web service call
Problem with Chineese characters when the request is received at the webservice.
Maximum reqeust length exceeded
File Not found Exception
Sending and receiving a file through webservive