我在同一机器上面部署了tomcat和websphere。
客户端放在了tomcat上,webservice部署在websphere上。
通过IE测试,结果正常返回,进入jquery的success代码块中,弹出消息:
success la:
result1:hello Xiao Ming
但用Firefox和Chrome测试,程序进入了jquery的error代码块中,弹出错误信息:
error la
XMLHttpRequest.state:function{return 3},
XMLHttpRequest.readyState:0,
textStatus:error,
XMLHttpRequest.responseText:
客户端代码html 调用webservice的代码片段如下:
$('#callwebserviceId').click(function() {
$.ajax({
url: 'http://localhost:9081/xxx/RetriveHelloWordService?wsdl/sayHello',
type: 'post',
dataType: 'xml',
data: populateXML(),
contentType: 'text/xml;charset="utf-8"',
success:function(zz){
alert("success la:");
alert("result1:"+$(zz).text());
},
error: function(XMLHttpRequest, textStatus) {
alert("error la");
alert("XMLHttpRequest.state:"+XMLHttpRequest.state+"-XMLHttpRequest.readyState:"+XMLHttpRequest.readyState+"-textStatus:"+textStatus+"-XMLHttpRequest.responseText:"+XMLHttpRequest.responseText);
}
});
});
function populateXML(){
var xmlData="<soapenv:Envelope xmlns:q0=\"http://action.test.com/\" xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><soapenv:Body><tns:sayHello xmlns:tns=\"http://action.test.com/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://action.test.com/ RetriveHelloWordService_schema1.xsd \"><arg0> Xiao Ming</arg0></tns:sayHello></soapenv:Body></soapenv:Envelope>";
alert(xmlData);
return xmlData;
}
服务器端的webservice 服务类
package com.test.action;
public class RetriveHelloWord {
public String sayHello(String name){
System.out.println("got message:"+name);
return "hello"+name;
}
}
响应了wsdl文件:
<?xml version="1.0" encoding="UTF-8"?><!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI IBM 2.2.1-11/30/2010 12:42 PM(foreman)-. --><definitions name="RetriveHelloWordService" targetNamespace="http://action.test.com/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://action.test.com/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<types>
<xsd:schema>
<xsd:import namespace="http://action.test.com/" schemaLocation="RetriveHelloWordService_schema1.xsd"/>
</xsd:schema>
</types>
<message name="sayHello">
<part element="tns:sayHello" name="parameters"/>
</message>
<message name="sayHelloResponse">
<part element="tns:sayHelloResponse" name="parameters"/>
</message>
<portType name="RetriveHelloWordDelegate">
<operation name="sayHello">
<input message="tns:sayHello" wsam:Action="http://action.test.com/RetriveHelloWordDelegate/sayHelloRequest"/>
<output message="tns:sayHelloResponse" wsam:Action="http://action.test.com/RetriveHelloWordDelegate/sayHelloResponse"/>
</operation>
</portType>
<binding name="RetriveHelloWordPortBinding" type="tns:RetriveHelloWordDelegate">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="sayHello">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="RetriveHelloWordService">
<port binding="tns:RetriveHelloWordPortBinding" name="RetriveHelloWordPort">
<soap:address location="http://localhost:9081/xxx/RetriveHelloWordService"/>
</port>
</service>
</definitions>
感觉这是webservice ajax 或者是 jquery对浏览器不兼容造成的,有谁知道?谢谢!
问题补充没人知道吗?
问题补充:IE版本:9
FireFox版本:17.0.5
Chrome版本: 26.0.1410.64 m
相关推荐
本案例实现使用Axis2生成.arr包发布WebService服务,并使用Axis2生成客户端代码方式调用WebService
Android 利用axis2 调用webservice 包含j2ee服务端代码和Android客户端代码 代码实现包含 List,map ,对象传递
axis发布webservice教程axis发布webservice教程axis发布webservice教程axis发布webservice教程
Java通过Axis2调用SAP的Webservice 生成Java Proxy
axis2例子 webservice axis2 示例axis2例子 webservice axis2 示例axis2例子 webservice axis2 示例axis2例子 webservice axis2 示例axis2例子 webservice axis2 示例
<groupId>org.apache.axis2 <artifactId>axis2 <version>1.6.2 <groupId>org.apache.axis2 <artifactId>axis2-adb <version>1.6.2 <groupId>org.apache.axis2 ...
一个基于axis的webservice接口例子
Axis2WebService源码。本地测试通过。
axis调用第三方webservice接口所需的jar包,包括axis-1.4.jar,axis-jaxrpc-1.3.jar,axis-jaxrpc-1.4.jar,commons-discovery-0.5.jar,commons-logging-1.2.jar,cxf-rt-databinding-jaxb-3.3.1.jar,javax.mail-...
java axis客户端调用webservice,可应用于ofbiz框架。 解决网络上共享代码两次调用后会出现timeout的BUG
Axis2调用SAP Webservice源码 使用Axis2 org.apache.axis2.eclipse.codegen.plugin_1.6.2.jar插件生成本地Java Proxy同事生成同步和异步调用测试用例 更重要的是配备详细文档,实乃Java与SAP集成是宝典!
webService—Axis实例webService—Axis实例webService—Axis实例webService—Axis实例webService—Axis实例webService—Axis实例webService—Axis实例
压缩包中包含详细代码以及所用到的jar,是完整可运行的project。当然,需要正确的路径支持才可以运行,本人没有把我所用到的路径贴出,改为本机地址。
本方法是用axis1.4技术,实现java客户端调用webservice。已经可实现过可行的,如果不行可加我QQ号302633进行详细解析。
1、使用服务端类com.Hello.java,com.Other.java生成wsdl、aar文件【aar文件通过axis2插件的Axis2 service archiver生成】【wsdl文件通过axis2插件的Axis2 code generator中的"(服务端)代码生成wsdl"来生成】, ...
Java Axis 直接调用webservice 接口工具类, 无需根据wsdl编译客户端,需要axis相关包,测试使用axis 1.4, 附demo引入axis包后直接可以测试;
axis2客户端调用webService接口需要用的jar包,在一次调接口中遇到的问题,亲测可用(整理成了比较精简的jar包)
使用axis2创建webservice步骤以及客户端调用service服务代码,如何编写和发布WebService,如何使用services.xml配置文件发布,如何用Java实现调用WebService的客户端程序等等
java 调用https发布的webservice接口实例及axis包及详细说明
简单例子:axis2整合spring发布webservice,以及session的管理