Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Better XML parsing for the results #22

Closed
FreddyKaiser opened this issue Oct 16, 2013 · 2 comments
Closed

Better XML parsing for the results #22

FreddyKaiser opened this issue Oct 16, 2013 · 2 comments
Assignees
Milestone

Comments

@FreddyKaiser
Copy link
Contributor

The actual parsing with sed may have some race conditions as (luckily) it takes the last XML element of the defined values. There are more than one xml tag having the same value that are parsed out.

@ghost ghost assigned FreddyKaiser Oct 16, 2013
@FreddyKaiser
Copy link
Contributor Author

Parsing in mobileid.sigh.sh:

RES_TRANSID=$(sed -n -e 's/.*AP_TransID="\(.*\)" AP_.*/\1/p' $SOAP_REQ.res)
RES_MSISDNID=$(sed -n -e 's/.*<mss:MSISDN>\(.*\)<\/mss:MSISDN>.*/\1/p' $SOAP_REQ.res)
RES_RC=$(sed -n -e 's/.*<mss:StatusCode Value="\(.*\)"\/>.*/\1/p' $SOAP_REQ.res)
RES_ST=$(sed -n -e 's/.*<mss:StatusMessage>\(.*\)<\/mss:StatusMessage>.*/\1/p' $SOAP_REQ.res)
           sed -n -e 's/.*<mss:Base64Signature>\(.*\)<\/mss:Base64Signature>.*/\1/p' $SOAP_REQ.res > $SOAP_REQ.sig
RES_MSSPID=$(sed -n -e 's/.*MSSP_TransID="\(.*\)" xmlns:mss.*/\1/p' $SOAP_REQ.res)
RES_ID_CERT_STATUS=$(sed -n -e 's/.*.sig.cert: //p' $SOAP_REQ.sig.cert.check)
RES_VALUE=$(sed -n -e 's/.*<soapenv:Value>\(.*\)<\/soapenv:Value>.*/\1/p' $SOAP_REQ.res)
RES_REASON=$(sed -n -e 's/.*<soapenv:Text.*>\(.*\)<\/soapenv:Text>.*/\1/p' $SOAP_REQ.res)
RES_DETAIL=$(sed -n -e 's/.*<ns1:detail.*>\(.*\)<\/ns1:detail>.*/\1/p' $SOAP_REQ.res)

with success:

<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><MSS_SignatureResponse xmlns=""><mss:MSS_SignatureResp MajorVersion="1" MinorVersion="1" MSSP_TransID="h42z5i" xmlns:mss="http://uri.etsi.org/TS102204/v1.1.2#" xmlns:fi="http://mss.ficom.fi/TS102204/v1.0.0#"><mss:AP_Info AP_ID="http://iam.swisscom.ch" AP_TransID="AP.TEST.19799.1800" AP_PWD="disabled" Instant="2013-10-16T15:59:02.000+02:00"/><mss:MSSP_Info Instant="2013-10-16T15:59:14.870+02:00"><mss:MSSP_ID><mss:URI>http://mid.swisscom.ch/</mss:URI></mss:MSSP_ID></mss:MSSP_Info><mss:MobileUser><mss:MSISDN>+41798440457</mss:MSISDN></mss:MobileUser><mss:MSS_Signature><mss:Base64Signature>MIIIKQYJKoZIhvcNAQcCoIIIGjCCCBYCAQExCzAJBgUrDgMCGgUAMBQGCSqGSIb3DQEHAaAHBAVIZWxsb6CCBekwggXlMIIEzaADAgECAhA/EWAYYCftmSp78mqkqt0YMA0GCSqGSIb3DQEBCwUAMGUxCzAJBgNVBAYTAmNoMREwDwYDVQQKEwhTd2lzc2NvbTElMCMGA1UECxMcRGlnaXRhbCBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczEcMBoGA1UEAxMTU3dpc3Njb20gUnViaW4gQ0EgMjAeFw0xMzA4MjYwOTQ0MDFaFw0xNjA4MjYwOTQ0MDFaMDYxGTAXBgNVBAUTEE1JRENIRThZNDQwVVNYWjAxDDAKBgNVBAMTAzpQTjELMAkGA1UEBhMCQ0gwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCNhMF8YtvXtWcMcHA5Pofaq0YRurQ6HUYNtjbp6LxuRloqXA7wawcNGSS9u5jx4Dk9xmstbUJgoDJHgDGIWLTWEcfU+PiHjgKtl4R+RLFbUqs+Ac2K/v9OcsK2VAAre954nZUDycv4fmvQC8jI2f5L/EraB/hwaM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hEOpA3Jws2n0XKWgZhA41otdxCke6IaQH5m+fVHvPBJHFvL2wTGUTf5mcFLm7IkD2M=</mss:Base64Signature></mss:MSS_Signature><mss:SignatureProfile><mss:mssURI>http://mid.swisscom.ch/MID/v1/AuthProfile1</mss:mssURI></mss:SignatureProfile><mss:Status><mss:StatusCode Value="500"/><mss:StatusMessage>SIGNATURE</mss:StatusMessage></mss:Status></mss:MSS_SignatureResp></MSS_SignatureResponse></soapenv:Body></soapenv:Envelope>

with error:

<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><soapenv:Fault><soapenv:Code><soapenv:Value>soapenv:Receiver</soapenv:Value><soapenv:Subcode xmlns:mss="http://uri.etsi.org/TS102204/v1.1.2#" xmlns:fi="http://mss.ficom.fi/TS102204/v1.0.0#"><soapenv:Value>mss:_401</soapenv:Value></soapenv:Subcode></soapenv:Code><soapenv:Reason><soapenv:Text xml:lang="en" xmlns:xml="http://www.w3.org/XML/1998/namespace">USER_CANCEL</soapenv:Text></soapenv:Reason><soapenv:Node>http://mid.swisscom.ch/</soapenv:Node><soapenv:Role>http://uri.etsi.org/TS102207/v1.1.3#role_HomeMSSP</soapenv:Role><soapenv:Detail><ns1:detail xmlns:ns1="http://kiuru.methics.fi/mssp">Fault received from URL: https://b-hmssp.prod.mobileid:8443/soap/services/MSS_SignaturePort
At node: http://b-ae.prod.mobileid/</ns1:detail><ns1:detail xmlns:ns1="http://kiuru.methics.fi/mssp">User Cancelled the request</ns1:detail></soapenv:Detail></soapenv:Fault></soapenv:Body></soapenv:Envelope>

@FreddyKaiser FreddyKaiser modified the milestones: 2014.Summer, 2014.Spring Jul 3, 2014
@FreddyKaiser
Copy link
Contributor Author

Fixed with Mobile ID providing only one element in the elements. Especially the Detail

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant