VoiceGuide IVR Software Main Page
Jump to content

Webservice Content Analysis

Recommended Posts

I try to create tracking script.

 

answer from source server looks like this:

 

<?xml version="1.0" encoding="UTF-8"?>
<Odpowiedz>
<Wyniki>
<DaneTrackingowe>
<Przesylka>
<NumerPrzesylki>830224172</NumerPrzesylki>
<Status>Magazyn nadający</Status>
<DataNadania>2013-11-25 11:55:54</DataNadania>
<DataDoreczenia></DataDoreczenia>
<HistoriaLista>
<Historia>
<Data>2013-11-25</Data>
<Godzina>10:45:40</Godzina>
<Status>Wprowadzona</Status>
<Komentarz>Wprowadzona do systemu i oczekuje na przyjazd kuriera</Komentarz>
<DaneDodatkowe></DaneDodatkowe>
<Oddzial>Warszawa</Oddzial>
</Historia>
<Historia>
<Data>2013-11-25</Data>
<Godzina>11:55:54</Godzina>
<Status>Przyjęta</Status>
<Komentarz>Przyjęta przez kuriera w miejscu nadania</Komentarz>
<DaneDodatkowe>dddd</DaneDodatkowe>
<Oddzial>Warszawa</Oddzial>
</Historia>
<Historia>
<Data>2013-11-25</Data>
<Godzina>12:01:43</Godzina>
<Status>Magazyn nadający</Status>
<Komentarz>Przesyłka została wprowadzona na magazyn nadający</Komentarz>
<DaneDodatkowe></DaneDodatkowe>
<Oddzial>Warszawa</Oddzial>
</Historia>
</HistoriaLista>
</Przesylka>
</DaneTrackingowe>
</Wyniki>
</Odpowiedz>

 

In VG logs I see:

153747.417 22 49 17 rv add kex_http_resp_hdr_Connection|close
153747.417 22 49 17 rv add kex_http_resp_hdr_Content-Type|text/html
153747.417 22 49 17 rv add kex_http_resp_hdr_Date|Wed, 27 Nov 2013 14:38:01 GMT
153747.418 22 49 17 rv add kex_http_resp_hdr_Server|IdeaWebServer/v0.80
153747.418 22 49 17 rv add NumerPrzesylki|830224172
153747.418 22 49 17 rv add NumerPrzesylki_1|830224172
153747.418 22 49 17 rv add Status|Magazyn nadający
153747.418 22 49 17 rv add Status_1|Magazyn nadający
153747.418 22 49 17 rv add DataNadania|2013-11-25 11:55:54
153747.419 22 49 17 rv add DataNadania_1|2013-11-25 11:55:54
153747.419 22 49 17 rv add Data|2013-11-25
153747.419 22 49 17 rv add Data_1|2013-11-25
153747.419 22 49 17 rv add Godzina|10:45:40
153747.419 22 49 17 rv add Godzina_1|10:45:40
153747.419 22 49 17 rv add Status_2|Wprowadzona
153747.421 22 49 17 rv add Komentarz|Wprowadzona do systemu i oczekuje na przyjazd kuriera
153747.421 22 49 17 rv add Komentarz_1|Wprowadzona do systemu i oczekuje na przyjazd kuriera
153747.421 22 49 17 rv add Oddzial|Warszawa
153747.421 22 49 17 rv add Oddzial_1|Warszawa
153747.422 22 49 17 rv add Data_2|2013-11-25
153747.422 22 49 17 rv add Godzina_2|11:55:54
153747.422 22 49 17 rv add Status_3|Przyjęta
153747.422 22 49 17 rv add Komentarz_2|Przyjęta przez kuriera w miejscu nadania
153747.422 22 49 17 rv add DaneDodatkowe|dddd
153747.422 22 49 17 rv add DaneDodatkowe_1|dddd
153747.422 22 49 17 rv add Oddzial_2|Warszawa
153747.423 22 49 17 rv add Data_3|2013-11-25
153747.423 22 49 17 rv add Godzina_3|12:01:43
153747.423 22 49 17 rv add Status_4|Magazyn nadający
153747.423 22 49 17 rv add Komentarz_3|Przesyłka została wprowadzona na magazyn nadający
153747.423 22 49 17 rv add Oddzial_3|Warszawa
153747.423 22 49 17 rv add kex_Result_Code|OK
153747.424 22 49 17 rv add kex_Result_Desc|OK

 

How to recognize data like last <Historia>...</Historia> content?

 

I can't change or customize source data.

 

I need to read (tts) each Historia (history) record, but for example variable Status in history 3rd listed data has number Status_4 because on top is current Status as Status_1

 

How to count how many elements (or max value) including data? eg. max Status_X value?

 

 

 

Share this post


Link to post

Looks like you are using a Web Service module ( http://www.voiceguide.com/vghelp/source/html/modws.htm ) to issue a http message, and the quoted XML is the response sent back to VoiceGuide. correct?

 

You can see in the 'created $RVs' trace that all entries within each of the <Historia> sections are extracted and added as separate $RVs.

 

To use the correct Status entries you would need to use a counter that starts at 2.

 

Or pass the entire response to your own parser (called using Run Program or Run Script modules)

 

Max Status_X value could be ascertained by checking if the $RV contains a value.(eg. check if length of data contained in $RV is 0) If it does not contain any data then you can assume there is no more data.

Share this post


Link to post

I know basic web service module functionality, but I need to be prepared to different counts of Historia sections or other and after downloading webpage easy to find searched data.

 

Tracking include several data in xml tree so we need to sort and order data so question is how to find data?

 

maybe other names of variables in WS including xml tags tree structure?

 

<Historia_1_Data>2013-11-25</Historia_1_Data>

<Historia_1_Godzina>10:45:40</Historia_1_Godzina>
<Historia_1_Status>Wprowadzona</Historia_1_Status>

<Historia_1_Komentarz>Wprowadzona do systemu i oczekuje na przyjazd kuriera</Historia_1_Komentarz>
<Historia_1_DaneDodatkowe></Historia_1_DaneDodatkowe>
<Historia_1_Oddzial>Warszawa</Historia_1_Oddzial>

 

 

I'm looking for a system solution for reading xml data.

Share this post


Link to post

The approach outlined before (checking whether $RV contains any data) should meet your requirements.

 

Any more complex parsing would require custom scripting/programming.

We can assist in creating these if needed. If you would require custom modules or programs/scripts please contact sales@voiceguide.com with your requirements.

 

 

NB. If $RV names were to include the XML path and include array indices then this would result in $RV in this case looking like this:

 

$RV[Odpowiedz_Wyniki_DaneTrackingowe_Przesylka_HistoriaLista_Historia_1_Data]

 

and/or like this:

 

$RV[Odpowiedz_1_Wyniki_1_DaneTrackingowe_1_Przesylka_1_HistoriaLista_1_Historia_1_Data]

 

this is why a simpler approach of just using end element name as $RV name was used to simplify the use of $RVs later on.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×