Subscribe To Get FREE Updates!

Follow Us On

Friday, 18 July 2014

xml to Json response using BPEL and spring context

Your Ad Here

Chapter 1:Context

The objective of this document is to provide an overview of how an xml response from the reference webservice can be directly mapped to the Http binding as a JSON response
  • HTTP Binding enables you to integrate a soa composite applicattion and access through http get and post.
  • BPEL process is used to get the xml response from the reference webservice and pass it to spring context for further processing.
Mediator cannot be used for mapping for this scenario
We will go in detail further of why we can't use mediator to map the request and response.

Chapter 2:Develop a Http service with Json response from XML response

1.Http service returns JSON response using spring context
2.Mapping of Request and Response
3.Convert XML to JSON object using spring context

Step 2:Mapping of Request and Response

  • The request from the http service is directly mapped to the request of the reference.
  • The response from the reference web service is mapped to the request if the spring context
  • The response from the context is mapped to the response of the http service.
Your Ad Here

Json Response using Socket Adapter

Your Ad Here

Chapter 1:Context

This document provides of how to get json response in http request using socket adapter.
  • Socket Adapter is used to create a client-server application which is communicated over TCP protocol.
  • It allows us to configure with a BPEL or mediator component inorder to read and write over TCP/IP sockets
HttpBinding adapter can't be used in order to get http response in json format.
It supports only xml as response.

Chapter 2:Getting Json Response using socket adapter

1Configure the socket adapter in weblogic console.
2Create Http request and response using socket adapter
3Get the response from the url using spring context
4Mapping of request and response

Step 1:Configure the socket adapter in weblogic console

  • create a jndi for using socket adpater.
  • Specify host and port number.
This host and port number will be used to access the service

Your Ad Here

JSON Request and Response Wrapping in xml

Your Ad Here

Chapter 1: Context

This documents provides us to understand how to wrap the json request and response to xml.
  • Web services uses soap in order to communicate using xml.
  • If the rest client accepts json as input and respond json as response,we need to convert the json to and from xml.
These wrapping of requests and response are done in java using spring context

Chapter 2: How to wrap json request and response in xml

1Define contract for the exposed service
2Create java class to wrap json request and response
3Use Spring context to access the java class
4Map the request and response

Step 1: Define contract for the exposed service

  • Create xsd for both request and response

  • Now we need to convert this into json object which will be used to send the request to rest client
Your Ad Here

Previous Post Home