function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

.NET ASMX webservice callout from APEX

Hello - I have worked thru the given examples.  I am able to call out and get a response from the web service, but the apex generated class is unable to dechiper it.  I am receiving this error:


System.CalloutException: Web service callout failed: Unable to parse callout response. Apex type not found for element Response


The wsdl as generated from the .NET asmx  ?wsdl contained an s:any which according to another thread is unacceptable to Force, so I tried to rework it  without success. 


The response I am getting from the webservice is:


<?xml version="1.0" encoding="utf-8"?>
  <Status code="500" text="Error" />
    <Message type="E" text="This order does not exist ." />
    <Message type="E" text="The selected candidate record does not exist." />


I would like to get the message text from the lines where message type = "E"  (error) and display it in a text field on the calling form. 


So how can I determine what the wsdl needs to look like for Force to digest the response properly?







Try using the try catch block...

put the callout code in the try block and in the catch block parse the xml to read the message tag and to display it on your vf page.