Call Web Service with Ajax

Call Web Service with Ajax

I wrote the following code with Dreamweaver:

// JavaScript Document

function createSoapRequest(value1, value2){
var soapRequest = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:sap-com:document:sap:soap:functions:mc-style"> \
   <soapenv:Header/> \
   <soapenv:Body> \
      <urn:ZSumWs> \
         <Input1>' + value1 + '</Input1> \
         <Input2>' + value2 + '</Input2> \
      </urn:ZSumWs> \
   </soapenv:Body> \
</soapenv:Envelope>';

return soapRequest;
}

function callWs(){
var soapMessage = createSoapRequest($("input#value1").val(),$("input#value2").val());

   //return $.ajax({
  $.ajax({
url: "http://server:port/sap/bc/srt/rfc/sap/z_sum_ws/001/z_sum_ws/z_sum_ws",
type: "POST",
dataType: "xml",
data: soapMessage,
username: "username",
password: "password",
success: function(){alert("Success!");},
error: function(){alert("Error!");},
contentType: "text/xml; charset=utf-8"
});
}


$(function() {
      // Register event for handling submit of address updates
      $('#submit_form').submit(function() {
 
  callWs();
    
  return false;

            }); // Submit handler
  }); // Event registration


If I run it in Dreamweaver It works and the alert success is raised, but If I run this code into Safari or Chrome the Error alert is always raised. Why?

Thank,
Antonello