• Post Reply Bookmark Topic Watch Topic
  • New Topic

want to calls method on webservice wsdl file

 
vaibhav lather
Greenhorn
Posts: 5
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

want to call method on wsdl file having parameters and get response from that
 
vaibhav lather
Greenhorn
Posts: 5
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.mkyong.ws.HelloWorld;

public class HelloWorldClient{

public static void main(String[] args) throws Exception {

URL url = new URL("http://localhost:9999/ws/hello?wsdl");

//1st argument service URI, refer to wsdl document above
//2nd argument is service name, refer to wsdl document above
QName qname = new QName("http://ws.mkyong.com/", "HelloWorldImplService");

Service service = Service.create(url, qname);


}

}
 
vaibhav lather
Greenhorn
Posts: 5
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i found this code but how do i pass parameters to it and get response please suggest
 
Kesava Krishna
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please follow the below steps

1)Try generating stubs using axis2 framework WSDL2JAVA or cxf framework WSDL2JAVA commands using the wsdl
2)From the stubs generated get the service object using the proxy and then call the methods on the service object passing whatever the parameters those methods are expecting

Step 1 and 2 varies depending the type of underlying framework you are using.


Thanks,
Kesava
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!