java - How to develop REST and SOAP interface for same web service using MuleSoft? -
right services exposed using rest while using soap. there more 2000 services. requirement expose these in soap 1.2 , rest api (yes both).
i wondering if can take build on integration layer (preferable mulesoft) this. integration layer call services , expose/convert "rest soap" , "soap rest"
- client makes soap call mulesoft
- mulesoft makes rest call actual service
- mulesoft receives rest response
- mulesoft uses above response , send client soap response
how may achieve above flow in mulesoft? algorithm very helpful.
thanks in advance.
for example: changename(string id, string newname) should called soap as:
<soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:enterprise.soap.sforce.com"> <soapenv:header> </soapenv:header> <soapenv:body> <urn:changename> <urn:id>1001</urn:id> <urn:newname>steve jobs</urn:newname> </urn:changename> </soapenv:body> </soapenv:envelope>
and form rest, example
http://www.mywebserviceurl/changename/ post {id:1001, name:steve jobs}
soap protocol , rest architectural style. , different in nature.
in usecase, can
you can create mule flow, accept soap request
and can extract value using xpath3 , store in flow variable ,
then create json request actual rest web service using expression transformer reference :- how transform json-to-json document in mule esb,
and post rest service using mule http outbound or request component actual rest service exposed
get json response actual rest service, , parse , extract values using
json:json-to-object-transformer
, , store value in flow variablesuse data mapper or if use mule ce, use xslt create soap response client ref: https://developer.mulesoft.com/docs/display/current/xslt+transformer
the above simple , easiest way create client api/flow in mule accept soap request client , transform json request rest service exposed , post through http actual service.
this way can make mule interface application between soap call , actual rest service
,
Comments
Post a Comment