-
java web service..
hi evrybdy,
my aim is
http://api.search.live.net/search.wsdl
using this service and making a key search of like "microsoft" then listing the return values.
i wrote this code but it needs completing
import org.apache.axis.client.Service;
import com.microsoft.schemas.LiveSearch._2008._03.Search. *;
public class WebService {
public static void main(String[] args) {
SearchRequest request = new SearchRequest();
request.setAppId("******************************** *");
request.setQuery("microsoft");
request.setSources(new SourceType[]{SourceType.Web});
// //Common request fields (required)
// request.AppId = AppId;
// request.Query = "microsoft";
// request.Sources = new SourceType[]
// {
// SourceType.Web,
// SourceType.RelatedSearch
// };
}
}
thnks...
-
well, it looks like you are using axis. Have you found the wsdl2java tool in the axis documentation yet ? that is a command line (or Ant task) that hits a wsdl and generates a Java client stub. Once the stub is generated there should be methods with objects that model the structure of the WSDL, and you would then invoke the service by creating an instance of your generated stub object and pass the paramters to the methods in the stub.
(that is, you wouldn't directly program with the axis service class).
-
thnks for reply
i understand from these i get some jars, then create client object..
call search operations and listing the screen..
how i can create client object, i use which class ???
-
Yes, the axis2 distribution has a bunch of the jar files you need for the runtime of the generated axis client.
Then with the axis2 distribution folder, invoke the wsdl2java command (set the bin folder onto your path or specify the path by setting AXIS_HOME environment variable)
Probably something like
Code:
%AXIS2_HOME%\bin\WSDL2Java -uri http://api.search.live.net/search.wsdl -d adb -s -uw -o build/client
which will use the wsdl url
the axis data binding (adb) mechanism
generate synchronous methods
unwrap parametes
and place the generated classes into the build/client folder.
Another good reference for this is : Apache Axis2 -
and Reference Guide to Axis2 Code Generation Parameters - Part 1 | WSO2 Oxygen Tank
Then, in the generateFolder there will likely be a class that ends in "Stub". that is the client stub, with the methods we invoke.