已经知道:wsdl地址
用CXF编写一webservice 远程客户端
用CXF编写一webservice 远程客户端
解决方案 »
- csdn下载页面的资源怎么不见下载按钮或链接啊?
- 怎么用正则表达式截取字符串,急!!!
- Spring mail发送的邮件无主题,无收件人,附件不显示?
- Struts2 比strut1好用吗
- JSP 数据库输出
- weblogic 发布的Web站点最少应包含哪些文件?
- csdn高手来帮帮我Sessionbean引用CMP问题
- 在struts开发中,为什么资源文件中的中文字体在页面中是乱码?
- 关于实体BEAN的问题.
- jboss启动报错……
- 请问哪位高手对Liferay Portal 的源码有研究?或者对在Liferay Portal 上进行Portlet开发有研究的,请指点一下学习路线。谢谢
- 10086语音功能是如何实现
import javax.xml.ws.Service;
import javax.xml.ws.soap.SOAPBinding;public class HelloWorldClient { private final static QName SERVICE_NAME
=new QName("http://server.ws.demo/", "HelloWorld");
private final static QName PORT_NAME
=new QName("http://server.ws.demo/", "HelloWorldPort");
/**
* @param args
*/
public static void main(String[] args) {
Service service = Service.create(SERVICE_NAME);
String endpointAddress = "http://localhost:8080/HelloWorld"; //wsdl地址
service.addPort(PORT_NAME, SOAPBinding.SOAP11HTTP_BINDING, endpointAddress);
HelloWorld hw = service.getPort(HelloWorld.class); //发布服务的接口
System.out.println(hw.sayHi(" cvicse!")); //接口方法调用
}}
public static void main(String[] args) {
try {
String url = "http://219.148.199.4:9082/gsNotifyWS/services/gsNotify";
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new java.net.URL(url));
call.setOperationName(new QName ("http://soapinterop.org/","orderRelationUpdateNotifyReq"));
call.invoke(new Object[]{"99","99",99,"99",99});
} catch (ServiceException e) {
e.printStackTrace();
System.out.println("Service 获取 Call对象失败!");
} catch (MalformedURLException e) {
e.printStackTrace();
System.out.println("new java.net.URL(url)错误!");
} catch (RemoteException e) {
e.printStackTrace();
System.out.println("远程错误!");
}
}
}
client = dcf.createClient("http://127.0.0.1:9001/services/systemserver?wsdl");
Object[] re1 = client.invoke("方法名", "参数");
if (re1 != null && re1.length != 0) {
System.out.println("一共有几个参数:" + re1.length);
for (int i = 0; i < re1.length; i++) {
System.out.println("返回的第" + (i + 1) + "个值: " + new String((byte[])re1[i]));
}
}