Posts

Showing posts with the label WCF

Azure API Management : Exposing backend SOAP service as REST

Image
A very common scenario for any API management tools is to expose an (older) back end SOAP service as a REST JSON service. In this post I will explain how you can do this in Azure API Management. I'm not an API management expert, this is just my experience. The service The case I will be using is a WCF-basicHttp service hosted on a BizTalk 2010 machine and IIS. The service to list customers in the ERP (SAP). The SOAP request and response look like this. Request <CustomerList xmlns="http://www.mydomain.com/schemas/"> <SalesOrganizations> <SalesOrganization>XXXX</SalesOrganization> </SalesOrganizations> <WebshopRelevant>true</WebshopRelevant> </myp:CustomerList> Response <CustomerListResponse xmlns="http://www.mydomain.com/schemas/"> <Customer> <CustomerNumber>0000000001</CustomerNumber> <SalesOrganization>XXXX</SalesOrganization> <Lastname>Customer 1...

Receive invalid xml through WCF adapter

Image
Recently I had a small project that involved getting exchange rate data from the website of the Central Bank of the Republic of Turkey (CBRT). http://www.tcmb.gov.tr/kurlar/201707/10072017.xml Basically I just needed to do an HTTP GET to a specific URL, and that would give me back an xml with the exchange rate information I needed. So my first thought was to just use a WCF sendport with the webHttpBinding to download this. The first test I make results in the following error message. System.Xml.XmlException: Processing instructions (other than the XML declaration) and DTDs are not supported. Line 2, position 2. When I looked closer at the XML I get back, I saw that it contained a reference to an xsl file to make the file readable through a browser. <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="isokur.xsl"?> <Tarih_Date Tarih="07.07.2017" Date="07/07/2017"  Bulten...