Help Required in parsing the WSMAN Doc in C

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Help Required in parsing the WSMAN Doc in C

Kumar, Dheeraj

HI Sir,


I am working on one project , in that I am using WSMAN C library to enumerate the resources.

I need some help on doc parsing part, which is in XML.

 

The project I imported from the openwsman github and I can see so many XML files are given but I am unable to find which file I should use.

 

 

 

Please help me on this part as I stuck in this parsing thing from last 1 week.

 

Any other information if you want, I will be giving here

 

Thanks

 

 

 

Dheeraj  Kumar |  Associate Software Engineer |  GTCI

Unisys  | 135/1 Purva Premier Residency Road  |  Bangalore  | 9538051387|  7573463

<img border=0 width=15 height=15 id="_x0000_i1031" src="file:///C:\Users\KumarD1\AppData\Roaming\Microsoft\Signatures\Required_Images\pin_01YouTube.gif"> <img border=0 width=15 height=15 id="_x0000_i1030" src="file:///C:\Users\KumarD1\AppData\Roaming\Microsoft\Signatures\Required_Images\pin_02Facebook.gif"> <img border=0 width=15 height=15 id="_x0000_i1029" src="file:///C:\Users\KumarD1\AppData\Roaming\Microsoft\Signatures\Required_Images\pin_03Linkedin.gif"> <img border=0 width=15 height=15 id="_x0000_i1028" src="file:///C:\Users\KumarD1\AppData\Roaming\Microsoft\Signatures\Required_Images\pin_04Twitter.gif"> <img border=0 width=15 height=15 id="_x0000_i1027" src="file:///C:\Users\KumarD1\AppData\Roaming\Microsoft\Signatures\Required_Images\pin_05Unisys.gif">

<img border=0 width=125 height=56 id="_x0000_i1026" src="file:///C:\Users\KumarD1\AppData\Roaming\Microsoft\Signatures\Required_Images\Unisys_Logo.gif">

https://www.blogger.com/img/blogger-logo-small.png
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.

 

 


------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://p.sf.net/sfu/Zoho
_______________________________________________
Openwsman-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openwsman-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Help Required in parsing the WSMAN Doc in C

Klaus Kaempf
* Kumar, Dheeraj <[hidden email]> [Oct 13. 2014 14:02]:
> HI Sir,
>
>
> I am working on one project , in that I am using WSMAN C library to enumerate the resources.
> I need some help on doc parsing part, which is in XML.

Dheeraj,

Openwsman is basically exposing functions from the libxml2 system
library.
You might want to start with one of the script language bindings for
Openwsman and use i.e. Python or Ruby for prototyping.

Parsing (WS-Management) XML requires good knowledge about the
WS-Management 1.1 standard. Printing a string representation of the
WsXmlDoc via ws_xml_dump_memory_node_tree_enc() is also helpful.

Then accessing specific XML elements (WsXmlNode) by name (see
ws_xml_get_soap_element(), ws_xml_find_in_tree()), extracting element
data (see ws_xml_get_node_text(), ws_xml_get_node_name_ns(),
ws_xml_get_node_attr(), ...), and iterating children (see
xml_parser_get_next_child()) should be straightforward.

Hth,

Klaus
--
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg)
Maxfeldstraße 5, 90409 Nürnberg, Germany

------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://p.sf.net/sfu/Zoho
_______________________________________________
Openwsman-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openwsman-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Help Required in parsing the WSMAN Doc in C

Kumar, Dheeraj
Thanks Klaus,

This really helped me in resolving the issue.

Thanks a lot.

Regards
Dheeraj

-----Original Message-----
From: Klaus Kaempf [mailto:[hidden email]]
Sent: Monday, October 13, 2014 6:11 PM
To: Kumar, Dheeraj
Cc: [hidden email]; '[hidden email]'
Subject: Re: [Openwsman-devel] Help Required in parsing the WSMAN Doc in C

* Kumar, Dheeraj <[hidden email]> [Oct 13. 2014 14:02]:
> HI Sir,
>
>
> I am working on one project , in that I am using WSMAN C library to enumerate the resources.
> I need some help on doc parsing part, which is in XML.

Dheeraj,

Openwsman is basically exposing functions from the libxml2 system
library.
You might want to start with one of the script language bindings for
Openwsman and use i.e. Python or Ruby for prototyping.

Parsing (WS-Management) XML requires good knowledge about the
WS-Management 1.1 standard. Printing a string representation of the
WsXmlDoc via ws_xml_dump_memory_node_tree_enc() is also helpful.

Then accessing specific XML elements (WsXmlNode) by name (see
ws_xml_get_soap_element(), ws_xml_find_in_tree()), extracting element
data (see ws_xml_get_node_text(), ws_xml_get_node_name_ns(),
ws_xml_get_node_attr(), ...), and iterating children (see
xml_parser_get_next_child()) should be straightforward.

Hth,

Klaus
--
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg)
Maxfeldstraße 5, 90409 Nürnberg, Germany
------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
_______________________________________________
Openwsman-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openwsman-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Help Required in parsing the WSMAN Doc in C

Kumar, Dheeraj
In reply to this post by Klaus Kaempf
Hi, Greetings to all
I need some help on how to count the total number of return items in enumeration, in WSMAN C api,
As I need to store those values in some structure, so I need the count.


Thanks

Dheeraj
-----Original Message-----
From: Kumar, Dheeraj
Sent: Tuesday, October 14, 2014 10:55 AM
To: 'Klaus Kaempf'
Cc: [hidden email]; '[hidden email]'
Subject: RE: [Openwsman-devel] Help Required in parsing the WSMAN Doc in C

Thanks Klaus,

This really helped me in resolving the issue.

Thanks a lot.

Regards
Dheeraj

-----Original Message-----
From: Klaus Kaempf [mailto:[hidden email]]
Sent: Monday, October 13, 2014 6:11 PM
To: Kumar, Dheeraj
Cc: [hidden email]; '[hidden email]'
Subject: Re: [Openwsman-devel] Help Required in parsing the WSMAN Doc in C

* Kumar, Dheeraj <[hidden email]> [Oct 13. 2014 14:02]:
> HI Sir,
>
>
> I am working on one project , in that I am using WSMAN C library to enumerate the resources.
> I need some help on doc parsing part, which is in XML.

Dheeraj,

Openwsman is basically exposing functions from the libxml2 system
library.
You might want to start with one of the script language bindings for
Openwsman and use i.e. Python or Ruby for prototyping.

Parsing (WS-Management) XML requires good knowledge about the
WS-Management 1.1 standard. Printing a string representation of the
WsXmlDoc via ws_xml_dump_memory_node_tree_enc() is also helpful.

Then accessing specific XML elements (WsXmlNode) by name (see
ws_xml_get_soap_element(), ws_xml_find_in_tree()), extracting element
data (see ws_xml_get_node_text(), ws_xml_get_node_name_ns(),
ws_xml_get_node_attr(), ...), and iterating children (see
xml_parser_get_next_child()) should be straightforward.

Hth,

Klaus
--
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg)
Maxfeldstraße 5, 90409 Nürnberg, Germany
------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
_______________________________________________
Openwsman-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openwsman-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Help Required in parsing the WSMAN Doc in C

Klaus Kaempf
* Kumar, Dheeraj <[hidden email]> [Oct 14. 2014 12:46]:
> Hi, Greetings to all
> I need some help on how to count the total number of return items in enumeration, in WSMAN C api,
> As I need to store those values in some structure, so I need the count.

Look at ws_xml_get_child_count_by_qname().


Klaus
--
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg)
Maxfeldstraße 5, 90409 Nürnberg, Germany

------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
_______________________________________________
Openwsman-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openwsman-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Help Required in parsing the WSMAN Doc in C

Kumar, Dheeraj
Hi

Thanks but I had a different problem, the situation is that "The enumeration is returning a WSMAN doc which is having so many number of XML in a single doc ",

I want to calculate the number of these repeat instances.


Please see in attached file.

This is having 3 xml in a single doc, similarly my doc is containing so many xmls. So I want a count which can tell these number of xmls in doc.


Thanks

-----Original Message-----
From: Klaus Kaempf [mailto:[hidden email]]
Sent: Tuesday, October 14, 2014 4:26 PM
To: Kumar, Dheeraj
Cc: [hidden email]; '[hidden email]'
Subject: Re: [Openwsman-devel] Help Required in parsing the WSMAN Doc in C

* Kumar, Dheeraj <[hidden email]> [Oct 14. 2014 12:46]:
> Hi, Greetings to all
> I need some help on how to count the total number of return items in enumeration, in WSMAN C api,
> As I need to store those values in some structure, so I need the count.

Look at ws_xml_get_child_count_by_qname().


Klaus
--
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg)
Maxfeldstraße 5, 90409 Nürnberg, Germany

------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
_______________________________________________
Openwsman-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openwsman-devel

exampleDoc.txt (15K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Help Required in parsing the WSMAN Doc in C

Klaus Kaempf
* Kumar, Dheeraj <[hidden email]> [Oct 14. 2014 15:25]:
> Hi
>
> Thanks but I had a different problem, the situation is that "The enumeration is returning a WSMAN doc which is having so many number of XML in a single doc ",
>
> I want to calculate the number of these repeat instances.

I assume you want to count the number of

         <n1:SPAR_VirtualDisk>

xml blocks.

ws_xml_get_child_count_by_qname() should do just that, given the
element name ("SPAR_VirtualDisk") and element namespace (abbreviated as
'n1')

To find the real value for 'n1', look at the <s:Envelope> element
attributes which list all the namespace abbreviations.

This is what you need xmlns:n1="http://schema.unisys.com/wbem/wscim/1/cim-schema/2/spar/SPAR_VirtualDisk"


The correct call to ws_xml_get_child_count_by_qname() is

  int count = ws_xml_get_child_count_by_qname(document, "http://schema.unisys.com/wbem/wscim/1/cim-schema/2/spar/SPAR_VirtualDisk", "SPAR_VirtualDisk");


Klaus
--
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg)
Maxfeldstraße 5, 90409 Nürnberg, Germany

------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
_______________________________________________
Openwsman-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openwsman-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Help Required in parsing the WSMAN Doc in C

Kumar, Dheeraj
Hi Klaus

This function I got some undefined reference error.


I want to ask one more thing.

 Is there any wsmac c api or function is present, by which I can get the enumerations value in some map or structure and the parsing not required.

Actually In our project earlier we were using wsman client function to enumerate , The xml output we were writing in some file and by using perl we were parsing the xml for required values.

As resources is increased now and due to some performance issue we want to move to wsman C api for enumeration (As someone told us that C is efficient and parsing is not required, and it gives output in some structure> So it can save the parsing overhead).



I was looking in the project files from Openwsman-github project. But I failed in finding such things.

Is this thing is  available in openwsman perl library or python library??

Please guide me for this also.

Thanks in advance

Dheeraj



-----Original Message-----
From: Klaus Kaempf [mailto:[hidden email]]
Sent: Wednesday, October 15, 2014 2:23 PM
To: Kumar, Dheeraj
Cc: '[hidden email]'; [hidden email]
Subject: Re: [Openwsman-devel] Help Required in parsing the WSMAN Doc in C

* Kumar, Dheeraj <[hidden email]> [Oct 14. 2014 15:25]:
> Hi
>
> Thanks but I had a different problem, the situation is that "The enumeration is returning a WSMAN doc which is having so many number of XML in a single doc ",
>
> I want to calculate the number of these repeat instances.

I assume you want to count the number of

         <n1:SPAR_VirtualDisk>

xml blocks.

ws_xml_get_child_count_by_qname() should do just that, given the
element name ("SPAR_VirtualDisk") and element namespace (abbreviated as
'n1')

To find the real value for 'n1', look at the <s:Envelope> element
attributes which list all the namespace abbreviations.

This is what you need xmlns:n1="http://schema.unisys.com/wbem/wscim/1/cim-schema/2/spar/SPAR_VirtualDisk"


The correct call to ws_xml_get_child_count_by_qname() is

  int count = ws_xml_get_child_count_by_qname(document, "http://schema.unisys.com/wbem/wscim/1/cim-schema/2/spar/SPAR_VirtualDisk", "SPAR_VirtualDisk");


Klaus
--
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg)
Maxfeldstraße 5, 90409 Nürnberg, Germany
------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
_______________________________________________
Openwsman-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openwsman-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Help Required in parsing the WSMAN Doc in C

Klaus Kaempf
* Kumar, Dheeraj <[hidden email]> [Oct 15. 2014 16:46]:
> Hi Klaus
>
> This function I got some undefined reference error.

Well, I'd guess its about time to show me your code ;-)

>
>
> I want to ask one more thing.
>
>  Is there any wsmac c api or function is present, by which I can get the enumerations value in some map or structure and the parsing not required.

No, I'm not aware of any such function, sorry.

>
> Actually In our project earlier we were using wsman client function to enumerate , The xml output we were writing in some file and by using perl we were parsing the xml for required values.
>
> As resources is increased now and due to some performance issue we want to move to wsman C api for enumeration (As someone told us that C is efficient and parsing is not required, and it gives output in some structure> So it can save the parsing overhead).

Well, there is always parsing involved since WS-Management sends a
text representation of the XML structure via the network. Openwsman
already does the parsing and returns a WsXmlDoc structure for all
client callbacks (like wsmc_action_enumerate() and wsmc_action_pull()).

How about using the Perl (, Python, Ruby, or Java) bindings of
Openwsman and use a higher level language than C for your code ?

Have a look at
https://github.com/Openwsman/openwsman/tree/master/bindings/{java,perl,python,ruby}/tests
directories for example code.

>
>
>
> I was looking in the project files from Openwsman-github project. But I failed in finding such things.
>
> Is this thing is  available in openwsman perl library or python library??

Sorry, since I am a Perl and Python illiterate, only the Ruby bindings
have some 'syntactic sugar' added.


Klaus
--
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg)
Maxfeldstraße 5, 90409 Nürnberg, Germany

------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
_______________________________________________
Openwsman-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openwsman-devel
Loading...