AXIS 1.4 服务端特殊字符不转义(比如CDATA区域,研究了好久)

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;
}
}


[color=blue][size=large]这时候 < 符号不会被转义成为 <

用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[/size][/color]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值