Using Asynchronous JavaScript and XML (AJAX) to make calls to a web service

My program is showing an internal server error

  var parameters = "<?xml version='1.0' encoding='utf-8'?>" +
        "<soap:envelope xmlns:xsi='ttp://www.w3.org/2001/xmlschema-instance' xmlns:xsd='http://www.w3.org/2001/xmlschema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>" +
        "<soap:body>" +
        "<listeVille xmlns='http://..../b1'>" +     
        "<ville>"+ "Test" +"</ville>" +
        "</listeVille>" +
        "</soap:body>" +
        "</soap:envelope>";
    
    $.ajax({
        type: "POST",
        url: _URL_SITE + "webservices/b1.asmx",
        dataType: "xml",
        data: parameters,
        contentType: "application/soap+xml; charset=utf-8",
        headers: {
            Accept: '*/*',
            SOAPAction: 'http://.../webservices/b1/ListeVille'            },
        success: function (xml) {
            alert('test');
            //var _xmldoc
            //_xmldoc = new activexobject("microsoft.xmldom");
            //_xmldoc.async = "false";
            //_xmldoc.loadxml(xml);
        
        },
        error: function () {
            alert('error');
        }
    });

And the web service code is:

<WebMethod(True)> Public Function ListeVille(ByVal ville As String) As System.Xml.XmlDocument
    
        Dim _xml As System.Xml.XmlDocument = New System.Xml.XmlDocument
        Dim _hsh As New ParameterCollection
        
        Try
            _hsh.Add("@Ville", "")
            _xml.LoadXml(_hsh)
        Catch ex As Exception
            AjoutJournal(ex)
        End Try
        Return _xml
    End Function

I am trying to retrieve an XML file by calling my web service. Please note that the value returned by the function ListeVille is correct.

Thank you!

Answer №1

Encountering an Internal Server Error typically indicates an issue within the server side code.

If you opt to enable Remote Errors, you will be able to view error messages on a remote machine. Alternatively, debugging the code locally will reveal the specifics of the exception.

Furthermore, it appears that there may be an error in how the XmlDocument.LoadXml Method is being used based on the details provided in your inquiry. Ensure that the parameter passed to LoadXml is a valid XML document string. For additional information, refer to the documentation on msdn here

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Autocomplete Data Origin

I'm currently exploring the use of Typeahead and implementing AJAX to fetch my data source: $(document).ready(function() { $('input.typeahead').typeahead( { hint: true, highlight: true, m ...

Encountering a "BadGzipFile" Error in Python Pandas while trying to read a ".json.gz" file

I am having trouble reading data from a ".json.gz" file into a dataframe in Python. Every time I try, I encounter a "BadGzipFile" error. Oddly enough, when I manually unzip the file by double-clicking it in my finder, I can open the json file without any i ...

Datatables utilizing column generation and retrieving the row ID from the server side

Incorporating Datatables server-side, a datatable has been established and filled with data. Now, the requirement is to add a button column with the row ID displayed upon clicking. Here is the data retrieved: {"data":[{"id":"13","name":"gerrard","adress" ...

Tips for resolving the warning message: "Utilize a callback function in the setState method to reference the

I'm having an issue with this code fragment as ESLint is giving me a warning: "Use callback in setState when referencing the previous state react/no-access-state-in-setstate". Can someone help me resolve this? const updatedSketch = await ImageManipula ...

Error message: 'firebase/app' does not export 'app' (imported as 'firebase') - Import attempt failed

Encountered a strange issue today. As I tried to import firebase, an error popped up: ./node_modules/firebaseui/dist/esm.js Attempted import error: 'app' is not exported from 'firebase/app' (imported as 'firebase'). The setup ...

The responsiveness of Highcharts does not work properly when making an AJAX call

In my node.js application, I am utilizing the Highcharts API for visualizing charts. The divs containing the charts are initially hidden on page load. When the onclick function is triggered, the charts appear in the respective divs. Within the onclick func ...

Changing the visual appearance of an alert in JavaScript and HTML

My knowledge in JavaScript is limited, but I have a script that retrieves a query from a Python service to a Mongodb database. The query is returned in the following format: [{CHAIN: "STREET ELM, ELMER", CODE: "1234"}, {CHAIN: "STREET LM, LMAO", CODE: ...

A guide to incorporating partials into a multi-page form using Rails

Currently, I am in the process of converting Railscast #217. My goal is to modify a multi-partial form so that it dynamically loads the partials using AJAX. I operate a website where users can register for an account. Within the registration form, there ar ...

Incorporate classes into multiple titles by utilizing the text within the title

Here is some HTML code: <tr class="more-options"> <td width="190px" valign="top" class="ms-formlabel"> <H3 class="ms-standardheader"> <nobr>Required Hidden 1&l ...

Is it possible to create a single code that can be used for various buttons that perform the same function?

Whenever I click the right button, the left button appears and when I reach the last page, the right button disappears. However, this behavior is affecting both sections. Is there a way to write separate code for each section? I managed to make it work by ...

Modifying the status using retrieved JSON information

My goal is to retrieve data from an external API and use it to update the state of my app. Although I can see the data in the console, the state of my app remains unchanged when I try to run setState. class App extends Component { state={ jobs:[] ...

A guide on retrieving the values of all child elements within an HTML element using Puppeteer

I have been exploring the capabilities of puppeteer and am trying to extract the values from the column names of a table. <tbody> <tr class="GridHeader" align="center" style="background-color:Black;"> <td cl ...

Update the value in a nested object array by cross-referencing it with a second nested object array and inserting the object into the specified

I have a large array of objects with over 10,000 records. Each object contains an array in a specific key value, which needs to be iterated and compared with another array of objects. If there is a match, I want to replace that value with the corresponding ...

`Stop the JW Player from playing several videos simultaneously`

I have a situation where I want to display multiple videos on the same page, but only one should be playable at a time. When a new video is started, the currently playing video should automatically stop. <div class="tab-pane active" id="abc"><d ...

Why does my Javascript cross-domain web request keep failing with a Status=0 error code?

UPDATE: I've been informed that this method doesn't work because craigslist doesn't have an Allow-Cross-Domain header set. Fair point. Is there an alternative way to download a page cross-domain using Javascript in Firefox? It's worth ...

Shifting the div with a sliding animation!

My webpage features a video background with text overlay, and I am looking to add a button in the center of the page. When users click on this button, I want the current text div to slide up using a CSS transition, revealing another div with the same effec ...

How can I specifically refresh certain portions of my custom Module in Magento using a combination of JQuery and Ajax, without reloading the entire block?

I have been tasked with creating a simple Product configurator for our Magento Template within a tight deadline of 5 days. The configurator should allow users to choose attributes, calculate the price based on their selections, display a new image seamless ...

Can one integrate various angular components constructed using distinct versions of Angular?

Is it feasible to utilize various angular components (custom elements) created with different versions of Angular? I've heard concerns about zone.js causing global scope pollution. Appreciate your response! ...

What is the reason that when a variable is embedded within another variable, its value remains anchored to its initial declaration?

When looking at the code below, one would anticipate the output to read "text something different" but instead it displays "text something". var dynamic = "something"; var thistext = "text " + dynamic; dynamic = "something different"; console.log(this ...

Is there a way to retrieve values from TextFields and Select elements by simply clicking on a button?

I am currently working on a project using react, redux, and material ui. I need to retrieve data from a TextField in order to make an order. The code snippet below showcases my current implementation: <Select value={product.color_set[0].title}> { ...