Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > what's so wrong with my code?? Just trying to save a single node outof a SOAP Envelope

Reply
Thread Tools

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

 
 
monsalvo@gmail.com
Guest
Posts: n/a
 
      08-07-2008
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/" xmlnssd="http://www.w3.org/2001/XMLSchema"
xmlnssi="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
 
Reply With Quote
 
 
 
 
Joe Fawcett
Guest
Posts: n/a
 
      08-08-2008


<> wrote in message
news:36b652eb-52fb-4e8e-a022-...
> 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/" xmlnssd="http://www.w3.org/2001/XMLSchema"
> xmlnssi="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


 
Reply With Quote
 
 
 
 
monsalvo@gmail.com
Guest
Posts: n/a
 
      08-12-2008
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" <joefawc...@hotmail.com> wrote:
> <monsa...@gmail.com> wrote in message
>
> news:36b652eb-52fb-4e8e-a022-...
>
>
>
> > 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/" xmlnssd="http://www.w3.org/2001/XMLSchema"
> > xmlnssi="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 -


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to suppress methodName element in soap:Body of envelope with SOAP::Lite droesler Perl Misc 2 08-31-2010 04:54 AM
xsl variable $node/text() but $node can non-node-set help! Tjerk Wolterink XML 2 08-24-2006 03:28 AM
OutOf Memory exception under Eclipse when using relatively small amount of heap lennyw@comcast.net Java 2 05-24-2006 08:13 PM
How to set the node indent property between the parent node and the leaf node viveknatani@gmail.com ASP .Net 0 02-13-2006 07:11 PM
Unable to create envelope from given source because the root element is not named Envelope cxc Java 0 05-20-2005 10:02 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57