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