1

私の質問は簡単です。

Unmarshallingの場合、カスタムunmarshallerを記述したいのですが、marshellingの場合、wsdlがあります。

マーシャリングされていないオブジェクトを返す次のメソッドがありますが、マーシャリングされていないオブジェクトでxml文字列を使用したいので、クイックヘルプが必要です。

Bean wsdlBean = (wsdlBean)webServiceTemplate.marshalSendAndReceive(results);

こんなもの欲しい

String xmlStr = webServiceTemplate.marshalSendAndReceive(results);

どうすればこれを達成できますか?

4

1 に答える 1

0

使用できますWebServiceTemplate.sendSourceAndReceiveToResult(Source source, Result result)- API はこちらです。

Result を StringResult として定義し、Source を StringSource として定義するだけです。

StringSource source = new StringSource(content);
StringResult result = new StringResult(new StringWriter());

wsTemplate.sendSourceAndReceiveToResult(source, result);

..result.getWriter().toString();
于 2012-08-27T20:20:17.793 に答える