SOAP 1.2 in VBA

jrussell25

New Member
Joined
Oct 15, 2016
Messages
2
Hi there,

I am relatively new to both VBA and very new to SOAP. I have an online shop which I would like to be able to download orders from through excel.

I have been given the following SOAP code by the online shop but have no idea where i go now - i'm sure it's relatively simple but don't know where to start.

Any help would be amazing :)
[h=2]SOAP 1.2[/h][FONT=museo_sans300][FONT=museo_sans700]Request[/FONT][/FONT]
POST /v1.1/publicapi.asmx HTTP/1.1
Host: publicapi.ekmpowershopX.com
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<GetOrders xmlns="http://publicapi.ekmpowershop.com/">
<GetOrdersRequest>
<APIKey>string</APIKey>
<SearchText>string</SearchText>
<CustomerID>int</CustomerID>
<Status>string</Status>
<FromDate>string</FromDate>
<ToDate>string</ToDate>
<ItemsPerPage>int</ItemsPerPage>
<PageNumber>int</PageNumber>
<Fields>string</Fields>
</GetOrdersRequest>
</GetOrders>
</soap12:Body>
</soap12:Envelope>
[FONT=museo_sans300][FONT=museo_sans700]Response[/FONT][/FONT]
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<GetOrdersResponse xmlns="http://publicapi.ekmpowershop.com/">
<GetOrdersResult>
<TotalOrders>int</TotalOrders>
<TotalCost>double</TotalCost>
<Orders>
<Order>
<OrderID>int</OrderID>
<OrderNumber>string</OrderNumber>
<CustomerID>int</CustomerID>
<FirstName>string</FirstName>
<LastName>string</LastName>
<CompanyName>string</CompanyName>
<EmailAddress>string</EmailAddress>
<OrderStatus>string</OrderStatus>
<OrderStatusColour>string</OrderStatusColour>
<TotalCost>double</TotalCost>
<OrderDate>string</OrderDate>
<OrderDateISO>string</OrderDateISO>
<EkmStatus>string</EkmStatus>
<AbandonedOrder>boolean</AbandonedOrder>
</Order>
<Order>
<OrderID>int</OrderID>
<OrderNumber>string</OrderNumber>
<CustomerID>int</CustomerID>
<FirstName>string</FirstName>
<LastName>string</LastName>
<CompanyName>string</CompanyName>
<EmailAddress>string</EmailAddress>
<OrderStatus>string</OrderStatus>
<OrderStatusColour>string</OrderStatusColour>
<TotalCost>double</TotalCost>
<OrderDate>string</OrderDate>
<OrderDateISO>string</OrderDateISO>
<EkmStatus>string</EkmStatus>
<AbandonedOrder>boolean</AbandonedOrder>
</Order>
</Orders>
</GetOrdersResult>
</GetOrdersResponse>
</soap12:Body>
</soap12:Envelope>
 
Well that paste didn't work :(

Request:
<soap12:envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">POST /v1.1/publicapi.asmx HTTP/1.1
Host: publicapi.ekmpowershopX.com
Content-Type: application/soap+xml; charset=utf-8
Content -Length: Length


<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<GetOrders xmlns="http://publicapi.ekmpowershop.com/">
<GetOrdersRequest>
<APIKey>string</APIKey>
<SearchText>string</SearchText>
<CustomerID>int</CustomerID>
<Status>string</Status>
<FromDate>string</FromDate>
<ToDate>string</ToDate>
<ItemsPerPage>int</ItemsPerPage>
<PageNumber>int</PageNumber>
<Fields>string</Fields>
</GetOrdersRequest>
</GetOrders>
</soap12:Body>
</soap12:Envelope>

Response:

HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content -Length: Length


<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<GetOrdersResponse xmlns="http://publicapi.ekmpowershop.com/">
<GetOrdersResult>
<TotalOrders>int</TotalOrders>
<TotalCost>double</TotalCost>
<Orders>
<Order>
<OrderID>int</OrderID>
<OrderNumber>string</OrderNumber>
<CustomerID>int</CustomerID>
<FirstName>string</FirstName>
<LastName>string</LastName>
<CompanyName>string</CompanyName>
<EmailAddress>string</EmailAddress>
<OrderStatus>string</OrderStatus>
<OrderStatusColour>string</OrderStatusColour>
<TotalCost>double</TotalCost>
<OrderDate>string</OrderDate>
<OrderDateISO>string</OrderDateISO>
<EkmStatus>string</EkmStatus>
<AbandonedOrder>boolean</AbandonedOrder>
</Order>
<Order>
<OrderID>int</OrderID>
<OrderNumber>string</OrderNumber>
<CustomerID>int</CustomerID>
<FirstName>string</FirstName>
<LastName>string</LastName>
<CompanyName>string</CompanyName>
<EmailAddress>string</EmailAddress>
<OrderStatus>string</OrderStatus>
<OrderStatusColour>string</OrderStatusColour>
<TotalCost>double</TotalCost>
<OrderDate>string</OrderDate>
<OrderDateISO>string</OrderDateISO>
<EkmStatus>string</EkmStatus>
<AbandonedOrder>boolean</AbandonedOrder>
</Order>
</Orders>
</GetOrdersResult>
</GetOrdersResponse>
</soap12:Body>
</soap12:Envelope>

Thanks! :)

</soap12:envelope>
 
Upvote 0
Use XMLhttp or WinHttpRequest to send the request and receive the response. Rough code:

Code:
With httpReq
  .Open "POST", "https://publicapi.ekmpowershopX.com/v1.1/publicapi.asmx", False   'https?
  .setRequestHeader "Content-Type", "application/soap+xml; charset=utf-8"
  .send ("your SOAP request string") 
  Debug.Print .Status, .statusText
  Debug.Print .getAllResponseHeaders
  Debug.Print .responseText    'parse the SOAP response
End With
Search for a VBA SOAP parser. But without seeing the API I can't give specific help.
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top