看了个例子package test;import javax.xml.rpc.ServiceException;import org.apache.axis.client.Call;
import org.apache.axis.client.Service;public class TestWebService { public static void main(String[] args) throws Exception {
//String endpoint = "http://localhost:8086/testwebservice/services/TestWebService";
String endpoint = "http://testweb.dev.php/testWebService/testWebService.php";//该段就是上面刚将的地址
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new java.net.URL(endpoint));
call.setOperationName("hello"); String param = new String("中文".getBytes(),"ISO-8859-1");//如果没有加这段,中文参数将会乱码
String s = (String) call.invoke(new Object[] {param});
s = new String(s.getBytes("ISO-8859-1"),"GBK");//如果没有转换编码,中文也会乱码
System.out.println(s);
}
}但是axis2里面没有Service ,Call类,换成axis1.4,结果也是Call call = (Call) service.createCall();不能通过编译。
请问这个可以怎么解决。
或者另外还有什么办法,用java调用php服务端?
import org.apache.axis.client.Service;public class TestWebService { public static void main(String[] args) throws Exception {
//String endpoint = "http://localhost:8086/testwebservice/services/TestWebService";
String endpoint = "http://testweb.dev.php/testWebService/testWebService.php";//该段就是上面刚将的地址
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new java.net.URL(endpoint));
call.setOperationName("hello"); String param = new String("中文".getBytes(),"ISO-8859-1");//如果没有加这段,中文参数将会乱码
String s = (String) call.invoke(new Object[] {param});
s = new String(s.getBytes("ISO-8859-1"),"GBK");//如果没有转换编码,中文也会乱码
System.out.println(s);
}
}但是axis2里面没有Service ,Call类,换成axis1.4,结果也是Call call = (Call) service.createCall();不能通过编译。
请问这个可以怎么解决。
或者另外还有什么办法,用java调用php服务端?
解决方案 »
- Java中JPanel覆盖的的规律是什么?
- SSH 异常无法捕捉的问题?紧急求救。。。。。。。。
- 请教个servlet部署问题
- sprice ioc资源文件
- 各位大侠救急呀 酒店接口的问题。
- Weblogic重启删除应用的奇怪问题~
- ExtJs 前台grid列表显示问题
- HttpServletRequest转换成MultipartHttpServletRequest异常,求解
- org.hibernate.annotations.Entity和javax.persistence.Entity 关系
- 找工作压力可真大,好久没有好好学习了?哪位大哥知道JCreator 2.5 解密方式!
- 招一名web开发人员,月薪5k以上,要求ajax,mysql,linux
- 分享:java完美编程 下载地址
只有这个接口开启了就可以了