Parsing xml string

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Parsing xml string

xzdead
Hi all


I have a web service that returns the following xml string to my form:


<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soap:Body><lc_xml_generate11Response xmlns="http://www.tedial.com/localcaptureservice/"><lc_xml_generate11Result>LC_RET_NOERROR</lc_xml_generate11Result><xmlContents><?xml version="1.0" encoding="utf-16"?> <Results xmlns="tedial"> <fecha_insercion>31/01/2008 10:04:16</fecha_insercion> <fecha_inicio>22/03/2007 9:00:00</fecha_inicio> <fecha_fin>22/03/2007 9:01:29</fecha_fin> <clipid>08_000400_225_0</clipid> <categoria_primaria>Catalogados</categoria_primaria> <categoria_secundaria>Grabaciones Institucionales</categoria_secundaria> <codigo_legislatura>08</codigo_legislatura> <descripcion_legislatura>VIII</descripcion_legislatura> <codigo_organo>0004000</codigo_organo> <nombre_completo_organo>Pleno</nombre_completo_organo> <nombre_abreviado_organo>Pleno</nombre_abreviado_organo> <numero_sesion>225</numero_sesion> <signatura_topografica_archivo>sigt archivo</signatura_topografica_archivo> <signatura_topografica_prensa>sigt prensa</signatura_topografica_prensa> <signatura_topografica_externa>sigt externa</signatura_topografica_externa> <realizador>jjurado</realizador> <nombre_organo_publicacion>Programa de Teresa Viejo</nombre_organo_publicacion> <fecha>22/03/2007</fecha> <descripcion_intervalo>tarde del jueves</descripcion_intervalo> <codigo_punto>1</codigo_punto> <cod_subsecuencia_punto>1</cod_subsecuencia_punto> <cod_subsecuencia_punto>1</cod_subsecuencia_punto> <cod_subsecuencia_punto>RATIFICACIÓN DE LA PONENCIA DESIGNADA PARA INFORMAR LA SIGUIENTE INICIATIVA LEGISLATIVA ELABORADO POR LA PONENCIA SOBRE</cod_subsecuencia_punto> </Results></xmlContents></lc_xml_generate11Response></soap:Body></soap:Envelope>


my question is how can i parse the value of "<xmlContents>" and display the information in textboxes? i have looked at the FAQ but the example doesn't say anything clear to me... Don't know how to parse the response, nor how to put the values in textboxes

Any help would be appreciated

Thanks    
Reply | Threaded
Open this post in threaded view
|

RE: Parsing xml string

Steve Bayliss
I'd suggest that you have in your page-flow.xml a model xpl pipeline for
this page, this model pipeline would (a) call the web service and then (b)
use some xslt to extract the <xmlContents> part of the SOAP response and
reformat into an instance document suitable for passing to your view for
this page.

Regards
Steve

-----Original Message-----
From: xzdead [mailto:[hidden email]]
Sent: 26 March 2008 10:33
To: [hidden email]
Subject: [ops-users] Parsing xml string



Hi all


I have a web service that returns the following xml string to my form:


<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soap:Body><lc_xml_gen
erate11Response
xmlns="http://www.tedial.com/localcaptureservice/"><lc_xml_generate11Result>
LC_RET_NOERROR</lc_xml_generate11Result><xmlContents><?xml
version="1.0" encoding="utf-16"?> <Results xmlns="tedial">
<fecha_insercion>31/01/2008 10:04:16</fecha_insercion>
<fecha_inicio>22/03/2007 9:00:00</fecha_inicio> <fecha_fin>22/03/2007
9:01:29</fecha_fin> <clipid>08_000400_225_0</clipid>
<categoria_primaria>Catalogados</categoria_primaria>
<categoria_secundaria>Grabaciones Institucionales</categoria_secundaria>
<codigo_legislatura>08</codigo_legislatura>
<descripcion_legislatura>VIII</descripcion_legislatura>
<codigo_organo>0004000</codigo_organo>
<nombre_completo_organo>Pleno</nombre_completo_organo>
<nombre_abreviado_organo>Pleno</nombre_abreviado_organo>
<numero_sesion>225</numero_sesion> <signatura_topografica_archivo>sigt
archivo</signatura_topografica_archivo> <signatura_topografica_prensa>sigt
prensa</signatura_topografica_prensa> <signatura_topografica_externa>sigt
externa</signatura_topografica_externa> <realizador>jjurado</realizador>
<nombre_organo_publicacion>Programa de Teresa
Viejo</nombre_organo_publicacion> <fecha>22/03/2007</fecha>
<descripcion_intervalo>tarde del jueves</descripcion_intervalo>
<codigo_punto>1</codigo_punto>
<cod_subsecuencia_punto>1</cod_subsecuencia_punto>
<cod_subsecuencia_punto>1</cod_subsecuencia_punto>
<cod_subsecuencia_punto>RATIFICACIÓN DE LA PONENCIA DESIGNADA PARA INFORMAR
LA SIGUIENTE INICIATIVA LEGISLATIVA ELABORADO POR LA PONENCIA
SOBRE</cod_subsecuencia_punto>
</Results></xmlContents></lc_xml_generate11Response></soap:Body></soap:Envel
ope>


my question is how can i parse the value of "<xmlContents>" and display the
information in textboxes? i have looked at the FAQ but the example doesn't
say anything clear to me... Don't know how to parse the response, nor how to
put the values in textboxes

Any help would be appreciated

Thanks    

-----
http://www.victorgil.es http://www.victorgil.es 
--
View this message in context:
http://www.nabble.com/Parsing-xml-string-tp16299639p16299639.html
Sent from the ObjectWeb OPS - Users mailing list archive at Nabble.com.




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: Parsing xml string

xzdead
Hi and thanks for your answer


It took me some time to get this working without using xpl.... .is there any way to do it without pipelines?


Thanks


Steve Bayliss wrote
I'd suggest that you have in your page-flow.xml a model xpl pipeline for
this page, this model pipeline would (a) call the web service and then (b)
use some xslt to extract the <xmlContents> part of the SOAP response and
reformat into an instance document suitable for passing to your view for
this page.

Regards
Steve

-----Original Message-----
From: xzdead [mailto:vgil@tedial.com]
Sent: 26 March 2008 10:33
To: ops-users@ow2.org
Subject: [ops-users] Parsing xml string



Hi all


I have a web service that returns the following xml string to my form:


<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soap:Body><lc_xml_gen
erate11Response
xmlns="http://www.tedial.com/localcaptureservice/"><lc_xml_generate11Result>
LC_RET_NOERROR</lc_xml_generate11Result><xmlContents><?xml
version="1.0" encoding="utf-16"?> <Results xmlns="tedial">
<fecha_insercion>31/01/2008 10:04:16</fecha_insercion>
<fecha_inicio>22/03/2007 9:00:00</fecha_inicio> <fecha_fin>22/03/2007
9:01:29</fecha_fin> <clipid>08_000400_225_0</clipid>
<categoria_primaria>Catalogados</categoria_primaria>
<categoria_secundaria>Grabaciones Institucionales</categoria_secundaria>
<codigo_legislatura>08</codigo_legislatura>
<descripcion_legislatura>VIII</descripcion_legislatura>
<codigo_organo>0004000</codigo_organo>
<nombre_completo_organo>Pleno</nombre_completo_organo>
<nombre_abreviado_organo>Pleno</nombre_abreviado_organo>
<numero_sesion>225</numero_sesion> <signatura_topografica_archivo>sigt
archivo</signatura_topografica_archivo> <signatura_topografica_prensa>sigt
prensa</signatura_topografica_prensa> <signatura_topografica_externa>sigt
externa</signatura_topografica_externa> <realizador>jjurado</realizador>
<nombre_organo_publicacion>Programa de Teresa
Viejo</nombre_organo_publicacion> <fecha>22/03/2007</fecha>
<descripcion_intervalo>tarde del jueves</descripcion_intervalo>
<codigo_punto>1</codigo_punto>
<cod_subsecuencia_punto>1</cod_subsecuencia_punto>
<cod_subsecuencia_punto>1</cod_subsecuencia_punto>
<cod_subsecuencia_punto>RATIFICACIÓN DE LA PONENCIA DESIGNADA PARA INFORMAR
LA SIGUIENTE INICIATIVA LEGISLATIVA ELABORADO POR LA PONENCIA
SOBRE</cod_subsecuencia_punto>
</Results></xmlContents></lc_xml_generate11Response></soap:Body></soap:Envel
ope>


my question is how can i parse the value of "<xmlContents>" and display the
information in textboxes? i have looked at the FAQ but the example doesn't
say anything clear to me... Don't know how to parse the response, nor how to
put the values in textboxes

Any help would be appreciated

Thanks    

-----
http://www.victorgil.es http://www.victorgil.es 
--
View this message in context:
http://www.nabble.com/Parsing-xml-string-tp16299639p16299639.html
Sent from the ObjectWeb OPS - Users mailing list archive at Nabble.com.




--
You receive this message as a subscriber of the ops-users@ow2.org mailing list.
To unsubscribe: mailto:ops-users-unsubscribe@ow2.org
For general help: mailto:sympa@ow2.org?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: RE: Parsing xml string

fl.schmitt(ops-users)
hi xzdead,

> It took me some time to get this working without using xpl.... .is there any
> way to do it without pipelines?

Maybe the weather web serice examples in the xforms sandbox could be a guide to
achieve this:

http://www.orbeon.com/ops/xforms-sandbox/sample/web-service-weather

It's not very difficult: there are two instances for the web service, the
request and the response. A xforms:submission sends the request, the response is
written into the response instance. The result is already XML data, so you don't
need to parse the response. Using xforms:group, the result is only shown if
there's a response.

HTH
florian



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: RE: Parsing xml string

xzdead
Hi

Correct me if I'm wrong but the weather web service doesn't use an xpl pipeline, does it? I have looked at the code and finally to be sure I deleted get-files.xpl, sandbox-view.xpl and upload-action.xpl and the example still works.

can you tell me if xsl code in point 5.7 in F.A.Q. goes in a xpl file?



and... two more questions:  

If I wanted to change and use xpl, would I have to place the code that calls the webservice in the xpl file?

Is there any simple example about using a pipeline to connect to a webservice?


thanks in advance

:o)

fs(ops-users) wrote
hi xzdead,

> It took me some time to get this working without using xpl.... .is there any
> way to do it without pipelines?

Maybe the weather web serice examples in the xforms sandbox could be a guide to
achieve this:

http://www.orbeon.com/ops/xforms-sandbox/sample/web-service-weather

It's not very difficult: there are two instances for the web service, the
request and the response. A xforms:submission sends the request, the response is
written into the response instance. The result is already XML data, so you don't
need to parse the response. Using xforms:group, the result is only shown if
there's a response.

HTH
florian



--
You receive this message as a subscriber of the ops-users@ow2.org mailing list.
To unsubscribe: mailto:ops-users-unsubscribe@ow2.org
For general help: mailto:sympa@ow2.org?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: RE: Parsing xml string

fl.schmitt(ops-users)
hi xzdead,

> Correct me if I'm wrong but the weather web service doesn't use an xpl
> pipeline, does it? I have looked at the code and finally to be sure I
> deleted get-files.xpl, sandbox-view.xpl and upload-action.xpl and the
> example still works.

thats true - it doesn't use a XPL. I thougt you were interested in an example
without using a XPL :-)

> can you tell me if xsl code in
> http://www.orbeon.com/ops/doc/home-faq#parse-xml-string point 5.7 in F.A.Q.
> goes in a xpl file?

You can call it from a XPL pipeline using the xslt processor [1]. This processor
has, besides other inputs, an "config" input that takes the transformation rules
(xslt stylesheet, for example).

> and... two more questions:  :confused:

> If I wanted to change and use xpl, would I have to place the code that calls
> the webservice in the xpl file?

Yes.  I suppose there are two ways to call a web service: using the
xforms-submission processor [2] or the delegation processor [3].

> Is there any simple example about using a pipeline to connect to a
> webservice?

hmm - i found only "incomplete" examples showing only the processor code that
has to be placed into a pipeline.

If you use the xforms-submission processor, you could take the xforms:submission
element from the weather web service example and paste it into the processor
with some little modifications (the @ref, @instance and @replace attributes will
be obsolete, i suppose).

Refgarding the delegation rpcessor, you cpould take a look at the example code here:

http://www.orbeon.com/ops/doc/integration-webservices#d48e20


[1].http://www.orbeon.com/ops/doc/processors-xslt
[2] http://www.orbeon.com/ops/doc/processors-submission#http-post
[3] http://www.orbeon.com/ops/doc/integration-webservices


HTH
florian



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws