Link to home
Start Free TrialLog in
Avatar of Sreenivas Pinninti
Sreenivas Pinninti

asked on

Unale to access WCF service from azure functions?

Getting exception while accessing WCF SOAP service from Azure fuctions using dotnet core.

Error Message:

The content type multipart/related; type="application/xop+xml"; start="<http://tempuri.org/0>"; boundary="uuid:06e7725d-7c4a-404d-9f6b-0d9044ec44fe+id=2"; start-info="text/xml" of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 872 bytes of the response were: '
--uuid:06e7725d-7c4a-404d-9f6b-0d9044ec44fe+id=2
Content-ID: <http://tempuri.org/0>
Content-Transfer-Encoding: 8bit
Content-Type: application/xop+xml;charset=utf-8;type="text/xml"





WCF Calling Methods in azure functions:


 public async Task<IActionResult> PosteCaseAsync([HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = null)] HttpRequest httpRequest)
        {
            MethodBase methodBase = MethodBase.GetCurrentMethod();
            CaseListResponse response;
            try
            {
                string request = await httpRequest.ReadAsStringAsync();
                await _httpClient.LogAsync(LogTypes.Info, methodBase.ReflectedType.Namespace, methodBase.ReflectedType.Name, "PosteCaseAsync" + request).ConfigureAwait(true);
                CaseListUpdateRequest caseRequest = JsonConvert.DeserializeObject<CaseListUpdateRequest>(request);
                CaseServiceClient caseService = new CaseServiceClient();

                response = await caseService.UpdateCaseAsync(caseRequest);
                return new ContentResult { Content = response.ToString(), ContentType = Environment.GetEnvironmentVariable("XmlContentType"), StatusCode = HttpStatusCode.OK.GetHashCode() };
            }
            catch (Exception ex)
            {
                return new ContentResult { Content = ex.Message, ContentType = Environment.GetEnvironmentVariable("XmlContentType"), StatusCode = HttpStatusCode.OK.GetHashCode() };
                //await _httpClient.LogAsync(LogTypes.Info, methodBase.ReflectedType.Namespace, methodBase.ReflectedType.Name, "Exception: " + ex.Message).ConfigureAwait(true);
                //throw ex;
            }
        }
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.