2012-05-23 43 views
2

wso2esb-4.0.3WSO2 ESB示例440失敗(JSON/XML代理)

我能夠執行其他示例。我確實運行了ESB和StockService。看起來JSON轉換正在發生,但jsonclient無法處理JSON響應。

ant jsonclient -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/services/JSONProxy 

產生

[java] org.apache.axis2.AxisFault: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '{' (code 123) in prolog; expected '<' 
[java] at [row,col {unknown-source}]: [1,1] 
[java]  at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430) 
[java]  at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:123) 
[java]  at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:67) 
[java]  at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:354) 
[java]  at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:421) 
[java]  at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229) 
[java]  at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165) 
[java]  at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:555) 
[java]  at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:531) 
[java]  at samples.userguide.JSONClient.executeClient(Unknown Source) 
[java]  at samples.userguide.JSONClient.main(Unknown Source) 

我不是一個Axis2客戶機專家。任何人都有解決這個例子的工作?

發送捲曲從示例JSON有效載荷也產生錯誤:

curl -X POST -H 'Content-type: application/json' -d '{"getQuote":{"request":{"symbol":"IBM"}}}' http://localhost:8280/services/JSONProxy 

ESB控制檯:

[2012-05-23 16:28:24,079] INFO - LogMediator To: /services/JSONProxy, MessageID: urn:uuid:fa1489c7-e12e-4a59-8abb-663a35115cce, Direction: request, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><getQuote><request><symbol>IBM</symbol></request></getQuote></soapenv:Body></soapenv:Envelope> 
[2012-05-23 16:28:24,087] WARN - ClientHandler Received an internal server error : Internal Server Error For : 127.0.0.1:9000 For Request : Axis2Request [Message ID : urn:uuid:ce8b27f3-5aea-461c-a1f5-e7d0c6bbac4d] [Status Completed : true] [Status SendingCompleted : true] 
[2012-05-23 16:28:24,089] INFO - LogMediator To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:ce8b27f3-5aea-461c-a1f5-e7d0c6bbac4d, Direction: response, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><faultstring>com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog 
at [row,col {unknown-source}]: [1,0]</faultstring></soapenv:Body></soapenv:Envelope> 

回答

3

當你從JSON來soap11轉換的信息,請確保您設置將端點格式設置爲soap11。您可以通過在突觸配置中設置如下端點地址來實現:<address uri="http://localhost:9000/services/SimpleStockQuoteService" format="soap11"/>

+0

這對我有幫助。 Soap12格式也適用。 – DNNX

1

我在Tomcat上部署了CXF-JAX-WS Webservice。我得到的問題是,當JSON Post請求被轉換爲XML的SOAP時,它不會獲取名稱空間(只是一個普通的xml)。我嘗試設置format =「soap11」但沒有成功。 但是,當從Webservice獲取某些數據時,從XML - > JSON的轉換完美無缺。 我提到了WSO2 ESB的示例440。 任何幫助將不勝感激。