LOCAL loXml
LOCAL lcSoapRequestBody
LOCAL lcEndpoint
LOCAL lcSoapAction
LOCAL lcContentType
LOCAL loHttp
LOCAL loResp
LOCAL loResponseXml
LOCAL lnStatusCode
LOCAL lcAddContactRequestResult
loXml = CreateObject('Chilkat_9_5_0.Xml')
loXml.Tag = "soapenv:Envelope"
loXml.AddAttribute("xmlns:api","http://services.mascus.com/api")
loXml.AddAttribute("xmlns:soapenv","http://schemas.xmlsoap.org/soap/envelope/")
loXml.UpdateChildContent("soapenv:Header","")
loXml.UpdateChildContent("soapenv:Body|api:AddContactRequest|api:sessionId","string")
loXml.UpdateChildContent("soapenv:Body|api:AddContactRequest|api:ProductID","string")
loXml.UpdateChildContent("soapenv:Body|api:AddContactRequest|api:GivenName","string")
loXml.UpdateChildContent("soapenv:Body|api:AddContactRequest|api:GivenEmail","string")
loXml.UpdateChildContent("soapenv:Body|api:AddContactRequest|api:GivenPhone","string")
loXml.UpdateChildContent("soapenv:Body|api:AddContactRequest|api:GivenAddress","string")
loXml.UpdateChildContent("soapenv:Body|api:AddContactRequest|api:GivenCity","string")
loXml.UpdateChildContent("soapenv:Body|api:AddContactRequest|api:GivenPostalCode","string")
loXml.UpdateChildContent("soapenv:Body|api:AddContactRequest|api:GivenProvince","string")
loXml.UpdateChildContent("soapenv:Body|api:AddContactRequest|api:GivenCountry","string")
loXml.UpdateChildContent("soapenv:Body|api:AddContactRequest|api:RequestText","string")
loXml.UpdateChildContent("soapenv:Body|api:AddContactRequest|api:customEmailSubject","string")
loXml.UpdateChildContent("soapenv:Body|api:AddContactRequest|api:TestReceiverEmail","string")
* In a SOAP HTTP request, including the XML declaration (<?xml version="1.0" encoding="UTF-8"?>) in the XML body is generally not required.
loXml.EmitXmlDecl = 0
lcSoapRequestBody = loXml.GetXml()
lcEndpoint = "https://services.mascus.com/api/mascusapi.asmx"
lcSoapAction = "http://services.mascus.com/api/AddContactRequest"* For SOAP requests, the standard Content-Type is usually set to "text/xml" or "application/soap+xml"
lcContentType = "text/xml"
loHttp = CreateObject('Chilkat_9_5_0.Http')
loHttp.ClearHeaders()
loHttp.SetRequestHeader("Content-Type",lcContentType)
loHttp.SetRequestHeader("SOAPAction",lcSoapAction)
loResp = loHttp.PostXml(lcEndpoint,lcSoapRequestBody,"utf-8")
IF (loHttp.LastMethodSuccess = 0) THEN
? loHttp.LastErrorText
? "Failed to send SOAP request."RELEASE loXml
RELEASE loHttp
CANCELENDIF* Get the XML response body.
loResponseXml = CreateObject('Chilkat_9_5_0.Xml')
loResp.GetBodyXml(loResponseXml)
lnStatusCode = loResp.StatusCode
? "response status code: " + STR(lnStatusCode)
RELEASE loResp
* If the status code does not indicate succcess, then show the response XML,
* which probably contains error information.IF (lnStatusCode <> 200) THEN
? loResponseXml.GetXml()
RELEASE loXml
RELEASE loHttp
RELEASE loResponseXml
CANCELENDIF
? loResponseXml.GetXml()
* Parse the successful SOAP response XML.* This is a sample of the response XML, but the namespace prefixes will be different.
* We can parse the result using "*" for the namespace prefixes (see below).
lcAddContactRequestResult = loResponseXml.GetChildContent("*:Body|*:AddContactRequestResponse|*:AddContactRequestResult")
RELEASE loXml
RELEASE loHttp
RELEASE loResponseXml