Excel and xml code
How can I send http post some xml code in excel vba.
I have the follwowing code;
Sub Macro1()
'this is the xml code I have typed in excel vba'
<GovTalkMessage xsi:schemaLocation="http://www.govtalk.gov.uk/CM/envelope http://xmlgw.companieshouse.gov.uk/v1-0/schema/Egov_ch-v2-0.xsd" xmlns="http://www.govtalk.gov.uk/CM/envelope" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:gt="http://www.govtalk.gov.uk/schemas/govtalk/core" xmlns si="http://www.w3.org/2001/XMLSchema-instance">
<EnvelopeVersion>1.0</EnvelopeVersion>
-
<Header> -
<MessageDetails> <Class>CompanyDetails</Class>
<Qualifier>request</Qualifier>
<TransactionID>1</TransactionID>
</MessageDetails>
-
<SenderDetails> -
<IDAuthentication>
<SenderID>89832659075595786501487630603942</SenderID>
-
<Authentication>
<Method>CHMD5</Method>
<Value>j3u4auinzxzlwpe2ru3qcgosbqqqz24p</Value>
</Authentication>
</IDAuthentication>
</SenderDetails>
</Header>
-
<GovTalkDetails>
<Keys />
</GovTalkDetails>
-
<Body>
-
<CompanyDetailsRequest xmlns si="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xmlgw.companieshouse.gov.uk/v1-0/schema/CompanyDetails.xsd">
<CompanyNumber>03195964</CompanyNumber>
<CompanyName>Bridger Limited</CompanyNumber>
<GiveMortTotals>1</GiveMortTotals>
</CompanyDetailsRequest>
</Body></GovTalkMessage>
'this is the http post code in the same excel vba vba'
Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP")
URL = "http://xmlgw.companieshouse.gov.uk/v1-0/xmlgw/Gateway"
objHTTP.Open "POST", URL, False
objHTTP.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
objHTTP.send ("")
End Sub
Rgds
Amjid
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Bookmarks