jquery 如何调用java写的webservice (wsdl) webservicejqueryjavawsdlsoap 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 java的ws不能配置成普通键值对形式的get/post请求?配置成get/post就按照普通url那样请求就好了 jquery 不能webservice吧,改为JSON格式接口吧 本帖最后由 liyihongcug 于 2015-1-12 19:59 编辑问题 :jQuery consumes a JAX-WS web service失败提示com.sun.xml.ws.transport.http.HttpAdapter$H)源代码myeclipse10 jax-ws webservicepackage server;public class Demo {publicString sayHello(String name) {return name + ", hello!";}}package server;@javax.jws.WebService(targetNamespace = "http://server/", serviceName = "DemoService", portName = "DemoPort")public class DemoDelegate { server.Demo demo = new server.Demo(); public String sayHello(String name) { return demo.sayHello(name); }}测试都成功 http://localhost:8080/Demo/DemoPortWeb ServicesEndpoint InformationService Name: {http://server/}DemoServicePort Name: {http://server/}DemoPortAddress: http://localhost:8080/Demo/DemoPortWSDL: http://localhost:8080/Demo/DemoPort?wsdlImplementation class: server.DemoDelegate客户端使用jquery 发生错误如上jsp代码如下<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%><!DOCTYPE html><html> <head> <title>通过ajax调用WebService服务</title> <script src="http://code.jquery.com/jquery-1.5.2.min.js"></script><script > function jquery(){ alert("Start JSON --- "); $.post( "http://localhost:8080/Demo/DemoPort?wsdl/sayHello", -------------------------//这里可能出问题 就是不知道格式 '{"get":{"name":"5"}}', function(r) { alert("Book Title: " + r['return'].title); }, "json" ); } </script> </head> <body> <input type="button" value="jquery发送SOAP请求" id="btnJson"> <input type="text" id="name"> <div id="showInfo"> </div> </body></html> 录数据库时候是中文,再从数据库取出后就是乱码,用了中文过滤器后没用,请问怎么解决!(这是JAVASCRIPT的问题) spring前置通知可否阻止后续代码运行? 电脑不支持javascript是怎么回是事啊? 华为的网络存储及网络安全产品线部门怎么样呀? j2EE技术 大家棒我看看这段代码有什么问题,为什么IF语句好像没有起作用 急求Web Service问题 jsp页面中有三个按钮,如何判断是哪个按钮按下,跳转到相应的页面去呢? 请问linux下有什么好的JSP开发工具?谢先了 挑战高手!!!!答题者均有分 IE中img标签的src属性不能显示FTP上的图片 下拉选择框做table切换
本帖最后由 liyihongcug 于 2015-1-12 19:59 编辑
问题 :
jQuery consumes a JAX-WS web service失败提示com.sun.xml.ws.transport.http.HttpAdapter$H)
源代码
myeclipse10 jax-ws webservicepackage server;public class Demo {public
String sayHello(String name) {
return name + ", hello!";
}
}package server;@javax.jws.WebService(targetNamespace = "http://server/", serviceName = "DemoService", portName = "DemoPort")
public class DemoDelegate { server.Demo demo = new server.Demo(); public String sayHello(String name) {
return demo.sayHello(name);
}}
测试都成功 http://localhost:8080/Demo/DemoPort
Web Services
Endpoint Information
Service Name: {http://server/}DemoService
Port Name: {http://server/}DemoPort
Address: http://localhost:8080/Demo/DemoPort
WSDL: http://localhost:8080/Demo/DemoPort?wsdl
Implementation class: server.DemoDelegate客户端使用jquery 发生错误如上
jsp代码如下<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
<title>通过ajax调用WebService服务</title>
<script src="http://code.jquery.com/jquery-1.5.2.min.js"></script>
<script >
function jquery(){ alert("Start JSON --- "); $.post( "http://localhost:8080/Demo/DemoPort?wsdl/sayHello", -------------------------//这里可能出问题 就是不知道格式
'{"get":{"name":"5"}}',
function(r) {
alert("Book Title: " + r['return'].title);
},
"json" ); }
</script>
</head>
<body>
<input type="button" value="jquery发送SOAP请求" id="btnJson">
<input type="text" id="name">
<div id="showInfo">
</div>
</body>
</html>