我是Spring-WS的新手,我必须为我的项目创建一个WebService。 因此,尝试一些例子,我从http://code.google.com/p/spring-webservices-samples/Spring-WS:响应消息包含奇怪的字符
下载了spring-webservices-samples当我部署war文件并使用SoapUI进行测试时;我在响应消息中收到了奇怪的字符(如ce,1a,0),并且“CalculateResponse”元素为空。
<ns2:CalculateResponse xmlns:ns2='http://www.marvelution.com/samples/schemas/CalculatorServiceSchema'/>
而且没有例外。我试图调试,但没有运气。
请帮我解决这个问题。我非常感谢任何意见。
我使用JBoss 4.2.3,Java 1.6(64位)。
我试着在Tomcat-7.0.29中部署相同的war文件,它工作。但我必须让我的WebService在JBoss中使用工作TCPMon的捕获4.2.3
请求:使用TCPMon的
POST /annotated-payload-endpoint/calculatorService HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: "http://www.marvelution.com/samples/definitions/CalculatorService/Add"
Content-Length: 377
Host: 127.0.0.1:9999
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cal="http://www.marvelution.com/samples/schemas/CalculatorServiceSchema">
<soapenv:Header/>
<soapenv:Body>
<cal:Add>
<!--2 or more repetitions:-->
<cal:number>1</cal:number>
<cal:number>2</cal:number>
</cal:Add>
</soapenv:Body>
</soapenv:Envelope>
响应捕获:
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
X-Powered-By: Servlet 2.4; JBoss-4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181417)/JBossWeb-2.0
SOAPAction: ""
Content-Type: text/xml;charset=UTF-8
Transfer-Encoding: chunked
Date: Fri, 20 Jul 2012 01:47:23 GMT
ce
<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'><env:Header></env:Header><env:Body><ns2:CalculateResponse xmlns:ns2='http://www.marvelution.com/samples/schemas/CalculatorServiceSchema'/>
1a
</env:Body></env:Envelope>
0
端点:CalculatorEndpoint。 java
@PayloadRoot(namespace = "http://www.marvelution.com/samples/schemas/CalculatorServiceSchema", localPart = "Add")
public CalculateResponse add(Add numbers) {
CalculateResponse res = wrapResult(calculator.add(numbers.getNumber()));
System.out.println("Response before sending:"+res.getResult());
return res;
}
返回响应之前的System.out.println正在打印。我不确定这些字符在哪里被添加以及为什么响应不完整。
感谢, JEG