I spent a lot fo time in testing a SAP Web Service via javascript.
Here is an example for calling a SAP Web Service called Z_MATANF_INTRANET_AUFTR via javascript:
function callSAPService() { try { var xmlhttp =new ActiveX Object("MSXML2.XMLHTTP.3.0"); var action action = "http://www.sap.com/Z_MATANF_INTRANET_AUFTR"; var sURL= "http://brvsapp1v1.egv.at:8000/sap/bc/soap/rfc?services=Z_MATANF_INTRANET_AUFTR%3Fsap-client%3D011" xmlhttp.Open("POST", sURL,false); xmlhttp.setRequestHeader("SOAPAction", action); xmlhttp.setRequestHeader("Content-Type", "text/xml"); var SOAPEnvelope = "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' " SOAPEnvelope += "xmlns:urn='urn:sap-com:document:sap:rfc:functions'>" SOAPEnvelope += "<soapenv:Header/>" SOAPEnvelope += "<soapenv:Body>" SOAPEnvelope += "<urn:Z_MATANF_INTRANET_AUFTR>" <!--You may enter the following 5 items in any order--> SOAPEnvelope += "<DATAB>2010-07-01</DATAB>" SOAPEnvelope += "<KOKRS>0001</KOKRS>" SOAPEnvelope += "<ZAUFTR>" <!--Zero or more repetitions:--> SOAPEnvelope += "<item>" SOAPEnvelope += "</item>" SOAPEnvelope += "</ZAUFTR>" SOAPEnvelope += "<ZKOSTL>" <!--Zero or more repetitions:--> SOAPEnvelope += "<item>" SOAPEnvelope += "</item>" SOAPEnvelope += "</ZKOSTL>" SOAPEnvelope += "<ZVORG>" <!--Zero or more repetitions:--> SOAPEnvelope += "<item>" SOAPEnvelope += "</item>" SOAPEnvelope += "</ZVORG>" SOAPEnvelope += "</urn:Z_MATANF_INTRANET_AUFTR>" SOAPEnvelope += "</soapenv:Body>" SOAPEnvelope += "</soapenv:Envelope>" xmlhttp.Send(SOAPEnvelope); } catch (e) { .... } var xmlDoc=new ActiveX Object("MSXML2.DOMDocument.3.0"); xmlDoc.async=false; var tmpXML = xmlhttp.responseXML.xml ..... }
Edited by: Rainer Barta on Jul 14, 2010 5:38 PM