We need the WSDL file. Then we use a command called wsimport. With this command, we'll generate all needed classes to make queries to the service. Basically, the syntax we'll neded is the following:
wsimport -p <package> <wsdl_file_path>For example:
wsimport -p stockquote http://stockquote.xyz/quote?wsdlIt generates the artifacts for the services described by the wsdl in the url (it can contain a hard disk path also) contained in the package "stockquote". For more information about wsimport, check the folloowing link:
http://docs.oracle.com/javase/6/docs/technotes/tools/share/wsimport.html
Making the query
The generated artifacts will contain a class named Service. That class will handle the connection and will contain the a methods supported by the service. So, you'll have to:
Establish the connection
Service svc = new Service(new URL(SOAP_WSDL_URL), new QName(SERVICE_URL, "Service");Making the query
ServiceSoap svcSOAP = svc.getServiceSoap();
svcSOAP.<method>(<arguments>);The generated artifacts will contain the classes needed to pass as parameters.
No hay comentarios:
Publicar un comentario