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:
WCF Calling Methods in azure functions:
public async Task<IActionResult> PosteCaseAsync([HttpTrigge r(Authoriz ationLevel .Anonymous , "post", Route = null)] HttpRequest httpRequest)
{
MethodBase methodBase = MethodBase.GetCurrentMetho d();
CaseListResponse response;
try
{
string request = await httpRequest.ReadAsStringAs ync();
await _httpClient.LogAsync(LogTy pes.Info, methodBase.ReflectedType.N amespace, methodBase.ReflectedType.N ame, "PosteCaseAsync" + request).ConfigureAwait(tr ue);
CaseListUpdateRequest caseRequest = JsonConvert.DeserializeObj ect<CaseLi stUpdateRe quest>(req uest);
CaseServiceClient caseService = new CaseServiceClient();
response = await caseService.UpdateCaseAsyn c(caseRequ est);
return new ContentResult { Content = response.ToString(), ContentType = Environment.GetEnvironment Variable(" XmlContent Type"), StatusCode = HttpStatusCode.OK.GetHashC ode() };
}
catch (Exception ex)
{
return new ContentResult { Content = ex.Message, ContentType = Environment.GetEnvironment Variable(" XmlContent Type"), StatusCode = HttpStatusCode.OK.GetHashC ode() };
//await _httpClient.LogAsync(LogTy pes.Info, methodBase.ReflectedType.N amespace, methodBase.ReflectedType.N ame, "Exception: " + ex.Message).ConfigureAwait (true);
//throw ex;
}
}
Error Message:
The content type multipart/related; type="application/xop+xml"; start="<http://tempuri.org/0>"; boundary="uuid:06e7725d-7c 4a-404d-9f 6b-0d9044e c44fe+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-0d904 4ec44fe+id =2
Content-ID: <http://tempuri.org/0>
Content-Transfer-Encoding:8bit
Content-Type: application/xop+xml;charset=utf-8;ty pe="text/x ml"
WCF Calling Methods in azure functions:
public async Task<IActionResult> PosteCaseAsync([HttpTrigge
{
MethodBase methodBase = MethodBase.GetCurrentMetho
CaseListResponse response;
try
{
string request = await httpRequest.ReadAsStringAs
await _httpClient.LogAsync(LogTy
CaseListUpdateRequest caseRequest = JsonConvert.DeserializeObj
CaseServiceClient caseService = new CaseServiceClient();
response = await caseService.UpdateCaseAsyn
return new ContentResult { Content = response.ToString(), ContentType = Environment.GetEnvironment
}
catch (Exception ex)
{
return new ContentResult { Content = ex.Message, ContentType = Environment.GetEnvironment
//await _httpClient.LogAsync(LogTy
//throw ex;
}
}
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers 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.