Hi Chanaka,
You can use a http client to invoke the service instead of Axis2 client.
Then you can get JSON response without any issue.

Please refer sample code[1] for JSON messages over http transport

[1]
https://svn.wso2.org/repos/wso2/carbon/platform/branches/turing/platform-integration/test-automation-framework/4.2.6/org.wso2.carbon.automation.utils/src/main/java/org/wso2/carbon/automation/utils/esb/JSONClient.java

Thanks,
Nuwanw


On Mon, Feb 10, 2014 at 4:38 PM, Chanaka Dharmarathna <
[email protected]> wrote:

> Hi All,
>
> I'm trying to write integration test for PPal connector. PPal API is
> accepting REST calls with JSON body and return JSON objects as the
> response. Currently I have proxy [0] which accept JSON payload. I'm using
> SoapUI to send REST request with JSON body [1] to ESB.
>
> The code snippet [2] is in my test method which is written following a
> sample integration test [3]. There, axisServiceClient.sendReceive() method
> returns an OMElement. But since PPal response is in JSON format, I'm
> getting parse error [4].
>
> I'm thinking of, convert the response message type to XML from the proxy
> (only for the testing purposes) and assert tag names. Do you think is this
> a good approach ?
>
> Or else, is there any specific way to write integration tests with JSON
> support ?
>
> Appreciate your thoughts on this.
>
> [0] : https://gist.github.com/Chanaka/8911696
> [1] : https://gist.github.com/Chanaka/8911788
> [2] : https://gist.github.com/Chanaka/8911816
> [3] :
> https://github.com/wso2/esb-connectors/blob/master/salesforce-connector-test/src/test/java/org/wso2/carbon/connector/integration/test/salesforce/SalesforceConnectorIntegrationTest.java
> [4] : https://gist.github.com/Chanaka/8911862
>
> Regards !
> --
> Chanaka Dharmarathna
> *http://chanakaindrajith.blogspot.com/*<http://chanakaindrajith.blogspot.com/>
>
> _______________________________________________
> Dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Nuwan Wimalasekara
Senior Software Engineer - Test Automation
WSO2, Inc.: http://wso2.com
lean. enterprise. middleware

phone: +94 71 668 4620
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to