Results 1 to 2 of 2

Thread: Help with XML

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2005
    Posts
    14

    Help with XML

    I am having a problem trying to parse thrugh my xml response. It does not get all the information in the response. Here is what my xml soap message looks like:

    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <soapenv:Body>
    	  <ns1:getCardResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://services.com">
          <getCardReturn href="#id0" />
        </ns1:getCardResponse>
        <multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:Card" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="http://www.mccoymyers.com/CardMaint">
          <addrOne xsi:type="xsd:string">6200 Bell</addrOne>
          <addrTwo xsi:type="xsd:string">
          </addrTwo>
          <atmOflLimit xsi:type="xsd:long">200</atmOflLimit>
          <atmOnlLimit xsi:type="xsd:long">300</atmOnlLimit>
          <cardAccounts soapenc:arrayType="ns2:CardAccount[4]" xsi:type="soapenc:Array">
            <cardAccounts href="#id1" />
            <cardAccounts href="#id2" />
            <cardAccounts href="#id3" />
            <cardAccounts href="#id4" />
          </cardAccounts>
          <cardType xsi:type="xsd:string">MD</cardType>
          <chkOflLimit xsi:type="xsd:long">100</chkOflLimit>
          <chkOnlLimit xsi:type="xsd:long">200</chkOnlLimit>
          <city xsi:type="xsd:string">Bumsville</city>
          <custName xsi:type="xsd:string">Test User</custName>
          <expDate xsi:type="xsd:string">1010</expDate>
          <issueDate xsi:type="xsd:string">0605</issueDate>
          <issueStatus xsi:type="xsd:string">1</issueStatus>
          <maxAtmTrans xsi:type="xsd:long">100</maxAtmTrans>
          <maxOflLimit xsi:type="xsd:long">400</maxOflLimit>
          <maxOnlLimit xsi:type="xsd:long">700</maxOnlLimit>
          <maxPosTrans xsi:type="xsd:long">200</maxPosTrans>
          <memberNbr xsi:type="xsd:int">1</memberNbr>
          <nbrIssued xsi:type="xsd:string">1</nbrIssued>
          <orderCard xsi:type="xsd:string">N</orderCard>
          <orderPin xsi:type="xsd:string">N</orderPin>
          <pan xsi:type="xsd:string">9999999999999999999</pan>
          <pinOffset xsi:type="xsd:string">0000</pinOffset>
          <pposOflLimit xsi:type="xsd:long">200</pposOflLimit>
          <pposOnlLimit xsi:type="xsd:long">400</pposOnlLimit>
          <state xsi:type="xsd:string">TX</state>
          <status xsi:type="xsd:string">0</status>
          <waiveSerChg xsi:type="xsd:string">A</waiveSerChg>
          <zip xsi:type="xsd:string">79109</zip>
        </multiRef>
        <multiRef id="id4" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns3:CardAccount" xmlns:ns3="http://www.mccoymyers.com/CardMaint" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
          <acctDesc xsi:type="xsd:string">Savings number two</acctDesc>
          <acctType xsi:type="xsd:string">11</acctType>
          <id xsi:type="xsd:string">4</id>
          <num xsi:type="xsd:string">1234567851</num>
          <status xsi:type="xsd:string">1</status>
        </multiRef>
        <multiRef id="id3" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns4:CardAccount" xmlns:ns4="http://www.mccoymyers.com/CardMaint" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
          <acctDesc xsi:type="xsd:string">Savings number one</acctDesc>
          <acctType xsi:type="xsd:string">11</acctType>
          <id xsi:type="xsd:string">3</id>
          <num xsi:type="xsd:string">1234567850</num>
          <status xsi:type="xsd:string">1</status>
        </multiRef>
        <multiRef id="id2" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns5:CardAccount" xmlns:ns5="http://www.mccoymyers.com/CardMaint" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
          <acctDesc xsi:type="xsd:string">Checking number two</acctDesc>
          <acctType xsi:type="xsd:string">01</acctType>
          <id xsi:type="xsd:string">2</id>
          <num xsi:type="xsd:string">1234567801</num>
          <status xsi:type="xsd:string">1</status>
        </multiRef>
        <multiRef id="id1" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns6:CardAccount" xmlns:ns6="http://www.mccoymyers.com/CardMaint" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
          <acctDesc xsi:type="xsd:string">Checking number one</acctDesc>
          <acctType xsi:type="xsd:string">01</acctType>
          <id xsi:type="xsd:string">1</id>
          <num xsi:type="xsd:string">1234567800</num>
          <status xsi:type="xsd:string">1</status>
        </multiRef>
      </soapenv:Body>
    </soapenv:Envelope>
    Here is what my vb code looks like:

    VB Code:
    1. Option Explicit
    2.  
    3. Dim oChild As IXMLDOMNode
    4. Dim Nodes As IXMLDOMNodeList
    5. Dim str As String
    6.  
    7.  
    8. Private Sub cmdGetTestCard_Click()
    9.    
    10.    
    11.     Dim maintClient As SoapClient30
    12.     Set maintClient = New SoapClient30
    13.     maintClient.MSSoapInit "http://zeus:8080/Portal/services/CardMaint?wsdl", "CardMaintService", "CardMaint"
    14.    
    15.     Dim valTok As String
    16.    
    17.    
    18.     frmKeyMgr.Visible = False
    19.     valTok = frmKeyMgr.crypt(txtVersion.Text)
    20.     Dim map As New Dictionary
    21.    
    22.    
    23.     'this doesn't work... the server receives the message and sends a response, but the response needs
    24.     'to be mapped.
    25.    
    26.    
    27.     Set Nodes = maintClient.getCard(valTok, "REED01", "000", "7001", "9999999999999999999")
    28.    
    29.   Dim cnt as integer
    30.    
    31.     For Each oChild In Nodes
    32.         cnt = cnt + 1
    33.         If cnt > 4 Then
    34.             rtbCardInfo.Text = rtbCardInfo.Text & vbCrLf & oChild.Text
    35.          
    36.         End If
    37.  
    38.     Next oChild
    39.    
    40.     If Err <> 0 Then
    41.         MsgBox Err.Description & vbCrLf & _
    42.                "faultCode=" & maintClient.FaultCode & vbCrLf & _
    43.                "faultString=" & maintClient.FaultString & vbCrLf & _
    44.                "faultActor=" & maintClient.FaultActor & vbCrLf & _
    45.                "detail=" & maintClient.Detail
    46.     End If
    47. End Sub

    This is what I get in my textbox:

    Code:
    6200 Bell
    
    200
    300
    
    MD
    100
    200
    Amarillo
    Test User
    1010
    0605
    1
    100
    400
    700
    200
    1
    1
    N
    N
    9999999999999999999
    0000
    200
    400
    TX
    0
    A
    79109
    I am missing all my cardAccount info. I have tried to load it into an DOM Document but not able to also tried putting my response in a string but I keep getting an error "Invalid property assignment". I get a "type mismatch " when I try to put it in a DOM document. Any help would be appreciated.

  2. #2
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654

    Re: Help with XML

    Take a look into attributes. Basically the same kind of array stuff you've done with the nodes, just that you need to work out the attributes for each node. If you're not sure how to access attributes, open up Object Browser and look from there what you need, the naming convention is similar (IXMLDOMAttributes or something).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width