[jboss-user] [JBossWS] - how to modify a client so that it works with rpc instead of
peiguo
do-not-reply at jboss.com
Tue Apr 29 21:43:18 EDT 2008
On server side, I changed the style annotation of my service: from RPC to DOCUMENT. The client side stopped working. When I first started writing this post, I found teh client side imports javax.xml.rpc.*. i searched through J2EE API and there is no javax.xml.document.
How should I modify my client code? Why is the API's not consistent for those two styles?
| package org.jboss.tutorial.webservice.client;
|
| import org.jboss.tutorial.webservice.bean.Calculator;
|
| import javax.xml.namespace.QName;
| import javax.xml.rpc.Service;
| import javax.xml.rpc.ServiceFactory;
| import java.net.URL;
| import java.io.File;
|
| public class Client
| {
| public static void main(String[] args) throws Exception
| {
| URL url = new URL("http://localhost:8080/tutorial/CalculatorBean?wsdl");
|
| ServiceFactory factory = ServiceFactory.newInstance();
| Service service = factory.createService(url, null);
|
| Calculator calculator = (Calculator) service.getPort(Calculator.class);
|
| System.out.println("" + calculator.add(Integer.parseInt(args[0]), Integer.parseInt(args[1]), args[2]));
| System.out.println("" + calculator.subtract(Integer.parseInt(args[0]), Integer.parseInt(args[1])));
| }
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4147684#4147684
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4147684
More information about the jboss-user
mailing list