Quote Originally Posted by dlscott56 View Post
I have no choice on moving to REST API in this project.
When dealing w/ SOAP services I'm applying a hybrid REST mode approach by using my mdJson.bas to convert XML to JSON and deal w/ it internally.

For instance your service reponse can be converted like this

thinBasic Code:
  1. Option Explicit
  2.  
  3. Private Declare Function MultiByteToWideChar Lib "kernel32" (ByVal CodePage As Long, ByVal dwFlags As Long, lpMultiByteStr As Any, ByVal cchMultiByte As Long, ByVal lpWideCharStr As Long, ByVal cchWideChar As Long) As Long
  4.  
  5. Private Sub Form_Load()
  6.     Dim oJson           As Object
  7.  
  8.     Set oJson = JsonFromXmlDocument(FromUtf8Array(ReadBinaryFile("d:\temp\aaa.xml")))
  9.     Debug.Print JsonDump(oJson)
  10. End Sub
  11.  
  12. Public Function ReadBinaryFile(sFile As String) As Byte()
  13.     Dim baBuffer()      As Byte
  14.     Dim nFile           As Integer
  15.    
  16.     On Error GoTo EH
  17.     baBuffer = vbNullString
  18.     nFile = FreeFile
  19.     Open sFile For Binary Access Read Shared As nFile
  20.     If LOF(nFile) > 0 Then
  21.         ReDim baBuffer(0 To LOF(nFile) - 1) As Byte
  22.         Get nFile, , baBuffer
  23.     End If
  24.     Close nFile
  25.     ReadBinaryFile = baBuffer
  26.     Exit Function
  27. EH:
  28.     Close nFile
  29. End Function
  30.  
  31. Public Function FromUtf8Array(baText() As Byte) As String
  32.     Const CP_UTF8       As Long = 65001
  33.     Dim lSize           As Long
  34.    
  35.     If UBound(baText) >= 0 Then
  36.         FromUtf8Array = String$(2 * UBound(baText), 0)
  37.         lSize = MultiByteToWideChar(CP_UTF8, 0, baText(0), UBound(baText) + 1, StrPtr(FromUtf8Array), Len(FromUtf8Array))
  38.         FromUtf8Array = Left$(FromUtf8Array, lSize)
  39.     End If
  40. End Function
... to a more convenient (for me) JSON object like this
Code:
{
    "@xmlns:soap": "http://www.w3.org/2003/05/soap-envelope",
    "@xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
    "@xmlns:xsd": "http://www.w3.org/2001/XMLSchema",
    "soap:Body": {
        "ExecuteDataSourceResponse": {
            "@xmlns": "http://www.plexus-online.com/DataSource",
            "ExecuteDataSourceResult": {
                "StatusNo": 0,
                "Error": "false",
                "ErrorNo": 0,
                "Message": "Success",
                "InstanceNo": 219,
                "DataSourceKey": 65299,
                "QuarantinedForDevelopment": { "@xsi:nil": "true" },
                "LastPrimaryDeployment": { "@xsi:nil": "true" },
                "LastTestDeployment": { "@xsi:nil": "true" },
                "Version": { "@xsi:nil": "true" },
                "DataSourceName": "sproc283025_Recipe_Dip_Spin_Get",
                "ResultSets": {
                    "ResultSet": {
                        "RowCount": 2,
                        "Rows": {
                            "Row": [
                                {
                                    "Columns": {
                                        "Column": [
                                            { "Value": "DIP/SPIN LINE 21", "Name": "Str_Production_Line" },
                                            { "Value": 0, "Name": "Int_Angle_Of_Tilt" },
                                            { "Value": "DGZ 0000 - 1", "Name": "Intpk_Part_Step_Ds_Id" },
                                            { "Value": 6828526, "Name": "Intpk_Part_Step_Id" }
                                        ]
                                    }
                                },
                                {
                                    "Columns": {
                                        "Column": [
                                            { "Value": "DIP/SPIN LINE 22", "Name": "Str_Production_Line" },
                                            { "Value": 20, "Name": "Int_Angle_Of_Tilt" },
                                            { "Value": "DGZ 0000 - 1", "Name": "Intpk_Part_Step_Ds_Id" },
                                            { "Value": 6828528, "Name": "Intpk_Part_Step_Id" }
                                        ]
                                    }
                                }
                            ]
                        }
                    }
                }
            }
        }
    }
}
From this point on I just use JsonItem getter/setter on oJson object to delve into the data and convert it from/to my particular app plain-old-data-objects.

cheers,
</wqw>