0
我正在嘗試使用wso2 esb工具和tcp請求。我通過tcp協議從我的客戶端發送文本請求到代理服務。我根據this從財產調解員處獲得該文本值。這裏是我的客戶在wso2 esb工具中將文本值轉換爲xml
class TCPClient {
public static void main(String argv[]) throws Exception {
String delimiter = "|";
int modifiedSentence;
Socket clientSocket = new Socket("localhost", 6790);
DataOutputStream outToServer = new DataOutputStream(clientSocket.getOutputStream());
BufferedReader inFromServer = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
//String message2 = "WZ2OCS2:1:21:1:1:@1479122000#"+ delimiter;
String message2 = "Nuwan,34,Sama;Kuma,23,Sanga;Ara,78,siva"+ delimiter;
outToServer.writeBytes(message2);
outToServer.flush();
while ((modifiedSentence = inFromServer.read()) > -1){
System.out.print((char)modifiedSentence);
}
clientSocket.close();
}
}
現在我需要轉換這個
「Nuwan,34,薩瑪;吾,23,沙雅,阿糖胞苷,78,溼婆」
值爲json或xml。我試圖使用數據Mapper調解員和Smooks調解員。但是我不能將這個文本請求設置給上述兩個中介。當我去嘗試使用foreach調解器時,我遇到了像this這樣的問題。我儘可能多地嘗試>我該如何解決這個問題。謝謝
謝謝讓米歇爾。我從兩天開始搜索這個。你救了我。 – Dev4World