what's so wrong with my code?? Just trying to save a single node outof a SOAP Envelope

Discussion in 'XML' started by monsalvo@gmail.com, Aug 7, 2008.

  1. Guest

    What's so wrong with my code?

    This line is part of a VBScript soap client part of a DTS wich is
    functional in a 90 percent.

    strText = .responseXML.selectSingleNode("//" login "loginReturn")

    Produces the following error
    Char: 46
    Error: Expeted )

    If I code it like this
    strText = .responseXML.selectSingleNode("//loginReturn")r

    I get this error..
    Char: 1
    Error: Object doesn't support this property or method


    If I Place ) in char 46 I get this error.
    Error is Expected end of Statement.


    I just want to extract a single node (loginReturn) out of the SOAP
    Envelope instead of saving the whole SOAP reponse. I'm able to save
    the full envelope to a file, but that is not what I want.
    It would be the same, what if I want to store the value of loginReturn
    in this case 481557228026 in a variable?


    Just in case what follows is the response envelop from my web service.


    <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:loginResponse soapenv:encodingStyle="http://
    schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://nn.nn.nn.com">
    <loginReturn xsi:type="xsd:string">481557228026</loginReturn>
    </ns1:loginResponse>
    </soapenv:Body>
    </soapenv:Envelope>

    Please forgive my ingnorance I'm totally a newcomer to XML and
    VBscript.


    Thanks in Advance.


    Martin
     
    , Aug 7, 2008
    #1
    1. Advertising

  2. Joe Fawcett Guest

    Re: what's so wrong with my code?? Just trying to save a single node out of a SOAP Envelope

    <> wrote in message
    news:...
    > What's so wrong with my code?
    >
    > This line is part of a VBScript soap client part of a DTS wich is
    > functional in a 90 percent.
    >
    > strText = .responseXML.selectSingleNode("//" login "loginReturn")
    >
    > Produces the following error
    > Char: 46
    > Error: Expeted )
    >
    > If I code it like this
    > strText = .responseXML.selectSingleNode("//loginReturn")r
    >
    > I get this error..
    > Char: 1
    > Error: Object doesn't support this property or method
    >
    >
    > If I Place ) in char 46 I get this error.
    > Error is Expected end of Statement.
    >
    >
    > I just want to extract a single node (loginReturn) out of the SOAP
    > Envelope instead of saving the whole SOAP reponse. I'm able to save
    > the full envelope to a file, but that is not what I want.
    > It would be the same, what if I want to store the value of loginReturn
    > in this case 481557228026 in a variable?
    >
    >
    > Just in case what follows is the response envelop from my web service.
    >
    >
    > <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:loginResponse soapenv:encodingStyle="http://
    > schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://nn.nn.nn.com">
    > <loginReturn xsi:type="xsd:string">481557228026</loginReturn>
    > </ns1:loginResponse>
    > </soapenv:Body>
    > </soapenv:Envelope>
    >
    > Please forgive my ingnorance I'm totally a newcomer to XML and
    > VBscript.
    >
    >
    > Thanks in Advance.
    >
    >
    > Martin

    Neither expression is not syntactically correct.
    You need, assuming you have mapped the namespace URIs to the prefixes
    'soapenv' and 'ser' as per my earlier response):
    Dim oLoginNode
    Set oLoginNode =
    ..responseXML.selectSingleNode("/*/soapenv:Body/ser:loginResponse/ser:loginReturn")
    MsgBox oLoginNode.text

    or for a more inefficient search:
    Set oLoginNode = .responseXML.selectSingleNode("//ser:loginReturn")

    If you are using the responseXML directly you should call:
    ..responseXML.setproperty "SelectionLanguage", "XPath"
    before using selectSingleNode or selectNodes.

    --

    Joe Fawcett (MVP - XML)
    http://joe.fawcett.name
     
    Joe Fawcett, Aug 8, 2008
    #2
    1. Advertising

  3. Guest

    Re: what's so wrong with my code?? Just trying to save a single nodeout of a SOAP Envelope

    Thanks a lot Joe!!
    I'll figuring things out. Wanna get your book on XML here in
    Argentina. They have it listed. Though delivery will take some 45
    days.

    Regards.

    Martin


    On Aug 8, 4:03 am, "Joe Fawcett" <> wrote:
    > <> wrote in message
    >
    > news:...
    >
    >
    >
    > > What's so wrong with my code?

    >
    > > This line is part of a VBScript soap client part of a DTS wich is
    > > functional in a 90 percent.

    >
    > > strText = .responseXML.selectSingleNode("//" login "loginReturn")

    >
    > > Produces the following error
    > > Char: 46
    > > Error: Expeted )

    >
    > > If I code it like this
    > > strText = .responseXML.selectSingleNode("//loginReturn")r

    >
    > > I get this error..
    > > Char: 1
    > > Error: Object doesn't support this property or method

    >
    > > If I Place ) in char 46 I get this error.
    > > Error is Expected end of Statement.

    >
    > > I just want to extract a single node (loginReturn) out of the SOAP
    > > Envelope instead of saving the whole SOAP reponse. I'm able to save
    > > the full envelope to a file, but that is not what I want.
    > > It would be the same, what if I want to store the value of loginReturn
    > > in this case 481557228026 in a variable?

    >
    > > Just in case what follows is the response envelop from my web service.

    >
    > > <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:loginResponse soapenv:encodingStyle="http://
    > > schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://nn.nn.nn.com">
    > >         <loginReturn xsi:type="xsd:string">481557228026</loginReturn>
    > >      </ns1:loginResponse>
    > >   </soapenv:Body>
    > > </soapenv:Envelope>

    >
    > > Please forgive my ingnorance I'm totally a newcomer to XML and
    > > VBscript.

    >
    > > Thanks in Advance.

    >
    > > Martin

    >
    > Neither expression is not syntactically correct.
    > You need, assuming you have mapped the namespace URIs to the prefixes
    > 'soapenv' and 'ser' as per my earlier response):
    > Dim oLoginNode
    > Set oLoginNode =
    > .responseXML.selectSingleNode("/*/soapenv:Body/ser:loginResponse/ser:loginR­eturn")
    > MsgBox oLoginNode.text
    >
    > or for a more inefficient search:
    > Set oLoginNode = .responseXML.selectSingleNode("//ser:loginReturn")
    >
    > If you are using the responseXML directly you should call:
    > .responseXML.setproperty "SelectionLanguage", "XPath"
    > before using selectSingleNode or selectNodes.
    >
    > --
    >
    > Joe Fawcett (MVP - XML)http://joe.fawcett.name- Hide quoted text -
    >
    > - Show quoted text -
     
    , Aug 12, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page