I cannot seem to access the individual elements of the SOAP/XML message after it is returned. None of the methods associated with the XMLDOM or XMLHTTP seem to be supported or I am using the wrong methods. If someone knows where I can locate the methods for these objects I would appreciate it.
I have successfully sent and received a SOAP message using JavaScript using the following code:
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
<script language="JavaScript">
var objXMLStyle;
var objXMLDOM;
var jsSOAPEnvelope;
objXMLDOM = new ActiveXObject("MSXML"
objXMLDOM.async = false;
function BuildSoapEnvelope()
{
// XML elements
var jsMsgType;
var jsTimeZone;
var jsDialingNumber;
var jsCampaignId;
jsMsgType = document.testXML.msgType.value;
jsTimeZone = document.testXML.TimeZone.value;
jsDilaingNumber = document.testXML.dialingNumber.value;
jsCampaignId = document.testXML.campaignId.value;
//Build the SOAP Envelope
jsSOAPEnvelope = "<SOAP-ENV:Envelope " +
" xmlns:SOAP-ENV=' +
" xmlns:SOAP-ENC=' +
" <SOAP-ENV:Body>" +
" <m:LiveTouchCallback xmlns:m='Line4'>" +
" <MessageType>" + jsMsgType + "</MessageType>" +
" <TimeZone>" + jsTimeZone + "</TimeZone>" +
" <DialingNumber>" + jsDialingNumber + "</DialingNumber>" +
" <CampaignId>" + jsCampaignId + "</CampaignId>" +
" </m:LiveTouchCallback>" +
" </SOAP-ENV:Body>" +
" </SOAP-ENV:Envelope>";
return jsSOAPEnvelope;
}
function SubmitForm()
{
var strReturn;
var strBody;
//Send SOAP Request
var objXMLHTTP = new ActiveXObject("Microsoft.XMLHTTP"
objXMLHTTP.open( "POST", "xmlserver.asp", false );
objXMLHTTP.setRequestHeader( "Content-Type", "text/xml" );
objXMLHTTP.setRequestHeader( "SOAPAction", "#LiveTouchCallback" );
BuildSoapEnvelope();
objXMLHTTP.send( jsSOAPEnvelope );
if( objXMLHTTP.status != 200 )
{
alert( "UnSuccessful!" );
}
else
{
//Show SOAP Response
strReturn = objXMLHTTP.responseText;
strBody = objXMLHTTP.responseXML.xml;
document.testXML.strReturn.value = strReturn;
}
}
</script>
</HEAD>
<BODY>
<FORM NAME="testXML">
<INPUT TYPE="hidden" NAME="msgType" value="0279">
<INPUT TYPE="hidden" NAME="TimeZone" value="P">
<b>SAMPLE PAGE</b>
<PRE>
PHONE NUMBER <INPUT TYPE="text" NAME="dialingNumber">
CAMPAIGN ID <INPUT TYPE="text" NAME="campaignId">
RETURN INFO. <TEXTAREA NAME="strReturn" ROWS="20" COLS="50"></TEXTAREA>
</PRE>
<INPUT TYPE="button" NAME="btnTest" value="Test Button" onClick="SubmitForm()">
</FORM>
</BODY>
</HTML>
Thanks,
Tim
I have successfully sent and received a SOAP message using JavaScript using the following code:
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
<script language="JavaScript">
var objXMLStyle;
var objXMLDOM;
var jsSOAPEnvelope;
objXMLDOM = new ActiveXObject("MSXML"
objXMLDOM.async = false;
function BuildSoapEnvelope()
{
// XML elements
var jsMsgType;
var jsTimeZone;
var jsDialingNumber;
var jsCampaignId;
jsMsgType = document.testXML.msgType.value;
jsTimeZone = document.testXML.TimeZone.value;
jsDilaingNumber = document.testXML.dialingNumber.value;
jsCampaignId = document.testXML.campaignId.value;
//Build the SOAP Envelope
jsSOAPEnvelope = "<SOAP-ENV:Envelope " +
" xmlns:SOAP-ENV=' +
" xmlns:SOAP-ENC=' +
" <SOAP-ENV:Body>" +
" <m:LiveTouchCallback xmlns:m='Line4'>" +
" <MessageType>" + jsMsgType + "</MessageType>" +
" <TimeZone>" + jsTimeZone + "</TimeZone>" +
" <DialingNumber>" + jsDialingNumber + "</DialingNumber>" +
" <CampaignId>" + jsCampaignId + "</CampaignId>" +
" </m:LiveTouchCallback>" +
" </SOAP-ENV:Body>" +
" </SOAP-ENV:Envelope>";
return jsSOAPEnvelope;
}
function SubmitForm()
{
var strReturn;
var strBody;
//Send SOAP Request
var objXMLHTTP = new ActiveXObject("Microsoft.XMLHTTP"
objXMLHTTP.open( "POST", "xmlserver.asp", false );
objXMLHTTP.setRequestHeader( "Content-Type", "text/xml" );
objXMLHTTP.setRequestHeader( "SOAPAction", "#LiveTouchCallback" );
BuildSoapEnvelope();
objXMLHTTP.send( jsSOAPEnvelope );
if( objXMLHTTP.status != 200 )
{
alert( "UnSuccessful!" );
}
else
{
//Show SOAP Response
strReturn = objXMLHTTP.responseText;
strBody = objXMLHTTP.responseXML.xml;
document.testXML.strReturn.value = strReturn;
}
}
</script>
</HEAD>
<BODY>
<FORM NAME="testXML">
<INPUT TYPE="hidden" NAME="msgType" value="0279">
<INPUT TYPE="hidden" NAME="TimeZone" value="P">
<b>SAMPLE PAGE</b>
<PRE>
PHONE NUMBER <INPUT TYPE="text" NAME="dialingNumber">
CAMPAIGN ID <INPUT TYPE="text" NAME="campaignId">
RETURN INFO. <TEXTAREA NAME="strReturn" ROWS="20" COLS="50"></TEXTAREA>
</PRE>
<INPUT TYPE="button" NAME="btnTest" value="Test Button" onClick="SubmitForm()">
</FORM>
</BODY>
</HTML>
Thanks,
Tim