Problem with XForms and answer from a webservice

Having trouble installing Oxygen? Got a bug to report? Post it all here.
jeroen24
Posts: 1
Joined: Fri Nov 04, 2005 4:05 pm

Problem with XForms and answer from a webservice

Post by jeroen24 »

Ok, here's the thing: I made a simple form where you can enter a login and a password. This information is sent to an existing webservice by using SOAP, and the webservice returns a session id, and a session starttime.

Here is what the answer from the webservice looks like (after I've written it to a file) :

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<soapenv:Envelope soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001XMLSchema" xmlns:xsi="http://www.w3.org/2001XMLSchema-instance" xmlns:tns="urn:uniface:applic:services:synchroweb" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">

<soapenv:Body>
<tns:QUESTIONANDANSWER>
<return xsi:type="xsd:int">0</return>
<PIO_REQUEST xsi:type="xsd:string">
& lt;?xml version="1.0" encoding="utf-8" standalone="yes"?& gt;
& lt;LoginResponse& gt;
& lt;session& gt;EB46A231-B3DD-4FFB-B5CC-953AA3DCF053& lt;/session& gt;
& lt;sessionstarttime& gt;2005110413552100& lt;/sessionstarttime& gt;
& lt;/LoginResponse& gt;</PIO_REQUEST>
</tns:QUESTIONANDANSWER>
</soapenv:Body>
</soapenv:Envelope>



If I write to the file using the following code:

<xforms:submission id="write_file" method="put"
ref="instance('iResults')//PIO_REQUEST/child::text()"
replace="none"
action="file:/iResults.xml"
/>

Then the file iResults.xml looks like this:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
& lt;?xml version="1.0" encoding="utf-8" standalone="yes"?& gt;
& lt;LoginResponse& gt;
& lt;session& gt;8C8D4EC0-DF18-4892-836B-5D1945B10090& lt;/session& gt;
& lt;sessionstarttime& gt;2005110414061700& lt;/sessionstarttime& gt;
& lt;/LoginResponse& gt;

Does anybody know how I can access "session" and "sessionstarttime" that are inside LoginResponse? This has been bugging me for weeks...

(I added a space in & lt en & gt myself, so that you can see that it is really a string like that, that I recieve).

I really hope anybody can help.
Radu
Posts: 9051
Joined: Fri Jul 09, 2004 5:18 pm

Post by Radu »

Hello Jeroen

The server escapes the useful xml data it sends back so that it can incorporate it in the xml response. The problem is that the escaped data is not a valid XML file and you cannot do XPath on it. So you need some way to unescape the data after you save it to the file. Either in Oxygen open the file in the editor, select it all, right click, choose Source->Unescape selection or find an automated way to do that.


Regards, Radu.
Post Reply