Consume .NET WebService (Automation)

 

CREATE(AutXmlDoc,FALSE,TRUE);

CREATE(AutXmlHttp,FALSE,TRUE);

AutXmlHttp.open(‘POST’,’URL’,0); // If Username PWD then provide with comma separator else 0.

AutXmlHttp.SetRequestHeader(‘Host’,’Server Name’);

AutXmlHttp.SetRequestHeader(‘Content-Type’,’text/xml; charset=utf-8′);

AutXmlHttp.SetRequestHeader(‘Content-Length’,’Length’);

AutXmlHttp.SetRequestHeader(‘SOAPAction’,’http://tempuri.org/Method Name’);

AutXmlHttp.SetTimeouts(10000,10000,10000,0);

AutXmlHttp.Send(‘<?xml version=”1.0″ encoding=”utf-8″?>’ +
‘<soap:Envelope xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”xmlns:xsd=”http://www.w3.org/2001/XMLSchema&#8221; xmlns:soap=”http://schemas.xmlsoap.org/soap/envelope/”>’+
‘<soap:Body>’ +
‘<ValidateAddress xmlns=”http://tempuri.org/”>&#8217; +
‘<Address>’+Address+'</Address>’ +
‘<City>’+City+'</City>’ +
‘<State>’+State+'</State>’ +
‘<Zipcode>’+ZipCode+'</Zipcode>’ +
‘<Country>’+Country+'</Country>’ +
‘</ValidateAddress>’ +
‘</soap:Body>’ +
‘</soap:Envelope>’);

AutXmlDoc.load(AutXmlHttp.responseBody);

IF AutXmlHttp.status = 200 THEN BEGIN

AutXmlNodeList := AutXmlDoc.getElementsByTagName(‘soap:Body’); //Read XML Node

AutXmlNode := locautXmlNodeList.item(0);

EVALUATE(Output,UPPERCASE(locautXmlNode.text));

EXIT(Output);

END;

AutXmlHttp     Automation ‘Microsoft XML, v6.0’.ServerXMLHTTP60

AutXmlDoc      Automation ‘Microsoft XML, v6.0’.DOMDocument60

AutXmlNode    Automation ‘Microsoft XML, v6.0’.IXMLDOMNode

AutXmlNodeList Automation ‘Microsoft XML, v6.0’.IXMLDOMNodeList

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s