Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

parsing BSTR as a SOAP response message

SeleniaSelenia Member Posts: 8
I've been looking for a way to parse text which is written in xml/soap format, and "extract" the responses in the message. Such as the following message:



<?xml version="1.0" encoding="UTF-8"?>
....
...
SAYMYNAME

....

....



This is all text stored in a bstr string. What I want to know is, is it possible to parse that text as a SOAP message, and get the response, "SAYMYNAME"?

Comments

  • manucpmanucp Member Posts: 34
    Yes, you can use MSXML. You only have to create the document object and set your string as its text (or load it from a stream object). Then you can navigate the nodes tree. If you have got the schemas you can do validation too.

    : I've been looking for a way to parse text which is written in
    : xml/soap format, and "extract" the responses in the message. Such as
    : the following message:
    :
    :
    :
    : <?xml version="1.0" encoding="UTF-8"?>
    : ....
    : ...
    : SAYMYNAME
    :
    : ....
    :
    : ....
    :
    :
    :
    : This is all text stored in a bstr string. What I want to know is, is
    : it possible to parse that text as a SOAP message, and get the
    : response, "SAYMYNAME"?
    :
    :
  • manucpmanucp Member Posts: 34
    I've seen your previous post and I think they are related... :-)

    Think of this: It doesn't matter if the text that you are building (or parsing) is a request or a response. As long as you can set it in a MSXMLDOMDocument you can navigate it.

    So, you can build a document node by node to get the whole text or you can set the content of an empty document from your text and then navigate its nodes. Both ways are pretty straightforward.

    Hope this helps.


    : I've been looking for a way to parse text which is written in
    : xml/soap format, and "extract" the responses in the message. Such as
    : the following message:
    :
    :
    :
    : <?xml version="1.0" encoding="UTF-8"?>
    : ....
    : ...
    : SAYMYNAME
    :
    : ....
    :
    : ....
    :
    :
    :
    : This is all text stored in a bstr string. What I want to know is, is
    : it possible to parse that text as a SOAP message, and get the
    : response, "SAYMYNAME"?
    :
    :
  • SeleniaSelenia Member Posts: 8
    Thanks for your comments, I actually took a look at MSXML and was moderately confused. I found a solution which just converts it to a basic string, and although this might not be the most "optimal solution", it allows me to parse it just fine. If I have time, I'll look into this more carefully so I can improve on my crude method. Thanks again for your comments! : )

    : I've seen your previous post and I think they are related... :-)
    :
    : Think of this: It doesn't matter if the text that you are building
    : (or parsing) is a request or a response. As long as you can set it
    : in a MSXMLDOMDocument you can navigate it.
    :
    : So, you can build a document node by node to get the whole text or
    : you can set the content of an empty document from your text and then
    : navigate its nodes. Both ways are pretty straightforward.
    :
    : Hope this helps.
    :
    :
Sign In or Register to comment.