import java.io.PrintWriter;
import javax.servlet.http.HttpServletResponse;
import org.apache.axis.Message;
import org.apache.axis.MessageContext;
import org.apache.axis.message.SOAPEnvelope;
import org.apache.axis.transport.http.HTTPConstants;
public class Service01 {
public String service(String name) throws Exception {
// String a = "<soapenv:Envelope 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><GetPasswordServiceApplyResponse xmlns=\"http://getpassword.server.interfaces.lcunp.linkage.com\"><GetPasswordServiceApplyReturn><description>TimeStamp is wrong</description><resultCode>5</resultCode><userName>agagagag</userName></GetPasswordServiceApplyReturn></GetPasswordServiceApplyResponse></soapenv:Body></soapenv:Envelope>";
//Thread.sleep(10000);
System.out.println(name);
MessageContext mc = MessageContext.getCurrentContext();
// Message msg = new Message("<soapenv:Envelope 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:Envelope>",true);
Message msg = new Message("<wangfeng>&abc");
mc.setResponseMessage(msg);
// mc.reset();
// HttpServletResponse response = (HttpServletResponse) mc.getProperty(HTTPConstants.MC_HTTP_SERVLETRESPONSE);
// response.setContentType("text/xml;charset=utf-8");
// PrintWriter pw = response.getWriter();
// pw.write("<wangfeng>");
// pw.flush();
// throw new Exception();
return null;
}
}
这时候 < 符号不会被转义成为 <
用soapui测试结果如下:
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Set-Cookie: JSESSIONID=CF5C49618724F725227A6B96C189FD55; Path=/axis
Content-Type: text/xml;charset=utf-8
Transfer-Encoding: chunked
Date: Wed, 24 Dec 2014 09:02:19 GMT
<?xml version="1.0" encoding="UTF-8"?><wangfeng>&abc
分享到:
相关推荐
axis1.4服务端的编写,简单的写了一个接口和实现类,客户端可以用WSDL2JAVA生成的代码调用
Axis1.4从服务端到客户端图文攻略,同时附赠Axis1.4 Jar包。 本攻略经过多次测试可靠耐用,并同时带有详细的文字说明,保证一学就会!从现在起axis不再是问题!让你爱上web service!
内有axis1.4jar包以及使用eclipse和axis1.4 将WSDL和服务端代码互转方法 亲测可用
MyEclipse的axis1.4 java的webservice客户端服务端,下载即可直接运动,包括lib
springboot 集成axis1.4的webservice,该为maven的工程
axis1.4生成客户端 根据WSDL生成客户端和服务端
axis1.4完整包下载Apache Axis是一种SOAP(简单对象访问协议”)实现。 包含 Axis1.4的所有完整包。
【java项目整合Axis1.4webservice搭建实例】服务端代码
基于AXIS1.4实现的webservice客户端和服务端的搭建例子。里面包括完整的服务端demo和客户端demo并附有文档教程
axis1.4和axis2相关jar文件,axis1.4和axis2相关jar文件
Axis1.4如何实现头部鉴权(包括实现类模板)
axis1.4生成访问客户端代码
用于axis1.4开发webService。 文件包含,axis1.4.ZIP以及其他所需jar包,和生成webservice客户端,生成webService服务端发布 的详细教程说明。
axis1.4的帮助文档,WEBService发布必备产品。
Axis1.4开发指南 介绍Axis1.4的开发方式,并附上不少范例代码
Axis1.4开发指南.pdf axis-bin-1_4.zip axis相关文档 axis1.4 开发jar包
webservice axis1.4服务搭建
axis1.4学习示例(详细步骤说明)axis1.4
本方法是用axis1.4技术,实现java客户端调用webservice。已经可实现过可行的,如果不行可加我QQ号302633进行详细解析。