QUESTION:如何可以使用不同的编码(字符集和转移)与轴?AXIS2由于编码而生成错误的SOAP消息。如何解决它?
这是我的客户机:
public Object[] invoke(String xmlRepresentation)
throws CustomApplicationException {
Object[] responseWS = null;
RPCServiceClient serviceClient = new RPCServiceClient();
Options options = serviceClient.getOptions();
options.setAction("WBSREFT");
options.setTo(new EndpointReference("http://localhost:6132"));
QName qName = new QName(XML_SCHEMA, operation);
Object[] args = new Object[] { "blablabla" };
responseWS = serviceClient.invokeBlocking(qName, args, returnTypes);
String responseAsString = (String) responseWS[0];
return responseWS;
}
这里正在生成的SoapEnvelope(捕获的使用TCP/IP监视器):
<?xml version="1.0" encoding="http://schemas.xmlsoap.org/soap/envelope/"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<WBSREFT xmlns="http://tempuri.org/LICPOCSampleService">
<arg0 xmlns="">blablabla</arg0>
</WBSREFT>
</soapenv:Body>
</soapenv:Envelope>
WHY Axis2中生成此笨编码(http://schemas.xmlsoap.org/soap/envelope)???如果我发送邮件使用的soapUI这就是TCPMon的捕获XML请求
POST/HTTP/1.1
Content-Type: text/xml; charset=UTF-8
SOAPAction: "WBSREFT"
User-Agent: Axis2
Host: 172.17.192.113:6133
Transfer-Encoding: chunked
102
<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<WBSREFT xmlns="http://tempuri.org/LICPOCSampleService">
<arg0 xmlns="">to cobol</arg0>
</WBSREFT>
</soapenv:Body>
</soapenv:Envelope>0
:
POST/HTTP/0.9
Content-Type: text/xml;charset=UTF-8
SOAPAction: ""
User-Agent: Jakarta Commons-HttpClient/3.1
Host: 172.17.192.113:6133
Content-Length: 265
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<WBSREFT xmlns="http://tempuri.org/LICPOCSampleService">
<arg0 xmlns="">to cobol</arg0>
</WBSREFT>
</soapenv:Body>
</soapenv:Envelope>
我已经注意到了这个奇怪的输出:
使用Apache TCPMon的我已经捕捉到了这一请求102而在XML中间的0 ...它可能是什么?
我想你应该还发布可重复创建已损坏的SOAP请求的最小代码。 – Tomalak 2009-03-02 10:34:02
您发布了3个XML片段。只有第一个有奇怪的/破坏的编码属性。你是怎样产生后两者的? – 2009-03-02 11:55:59