私は Spring-WS を初めて使用し、自分のプロジェクト用に WebService を作成する必要がありました。いくつかの例を試すために、http: //code.google.com/p/spring-webservices-samples/ から 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 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>
TCPMon を使用してキャプチャされた応答:
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 が出力されています。これらの文字が追加された場所と、応答が不完全な理由がわかりません。
ありがとう、ジェグ