Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CDATA #30

Open
victorgp89 opened this issue Oct 17, 2018 · 8 comments
Open

CDATA #30

victorgp89 opened this issue Oct 17, 2018 · 8 comments
Labels

Comments

@victorgp89
Copy link

Hi,
It's possible extract CDATA when XML is generate?
Thanks for advance.

@goetas
Copy link
Member

goetas commented Oct 17, 2018

Can you elaborate?

@victorgp89
Copy link
Author

victorgp89 commented Oct 17, 2018

Yes, I have this request:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP:Envelope xmlns:SOAP="http://www.w3.org/2003/05/soap-envelope">
 <SOAP:Header xmlns:SOAP="http://www.w3.org/2003/05/soap-envelope">
   <ns-7067d4bd:user_validation xmlns:ns-7067d4bd="http://ws.link.hotelresb2b.com/login">
     <ns-7067d4bd:usr_code><![CDATA[IGM]]></ns-7067d4bd:usr_code>
     <ns-7067d4bd:usr_name><![CDATA[IGM_WEB_P]]></ns-7067d4bd:usr_name>
     <ns-7067d4bd:usr_pwd><![CDATA[igm_98ghot]]></ns-7067d4bd:usr_pwd>
     <ns-7067d4bd:language><![CDATA[1]]></ns-7067d4bd:language>
   </ns-7067d4bd:user_validation>
 </SOAP:Header>
 <SOAP:Body>
   <ns-8022e3d1:request_books xmlns:ns-8022e3d1="http://ws.link.hotelresb2b.com/hotel">
     <ns-8022e3d1:hotel>
       <ns-8022e3d1:hotel_code><![CDATA[139719]]></ns-8022e3d1:hotel_code>
       <ns-8022e3d1:hotel_user><![CDATA[OGUCSF]]></ns-8022e3d1:hotel_user>
       <ns-8022e3d1:hotel_pwd><![CDATA[HA139719]]></ns-8022e3d1:hotel_pwd>
     </ns-8022e3d1:hotel>
     <ns-8022e3d1:start_date>2018-10-15</ns-8022e3d1:start_date>
     <ns-8022e3d1:end_date>2018-10-16</ns-8022e3d1:end_date>
   </ns-8022e3d1:request_books>
 </SOAP:Body>
</SOAP:Envelope>

I know prefic in namespace is just randomly generated. But when I send to channel it return void response. Without it the response is OK.

It means that his XML compilant is not working sure?

It only happens when the SOAP:Header or the SOAP:Body have prefixes. If only one of the two has it works correctly

@goetas
Copy link
Member

goetas commented Oct 17, 2018

It means that his XML compilant is not working sure?

Most likely yes

if you want to get rid or CDATA, you have to set cdata: false in the metadata files (see https://jmsyst.com/libs/serializer/master/reference/yml_reference)

@victorgp89
Copy link
Author

And is it possible to change the prefix: ns-8022e3d1 for an ns1 for example?

@goetas
Copy link
Member

goetas commented Oct 17, 2018

not easily, you will have to set them on your metadata somehow

@victorgp89
Copy link
Author

I see in YamlConverter.php

In line: 150

$data["xml_root_name"] = "ns-" . substr(sha1($data["xml_root_namespace"]), 0, 8) . ":" . $data["xml_root_name"];

Then modifying it in the metadata will not solve the problem, will it?

@goetas
Copy link
Member

goetas commented Oct 17, 2018

yes, it that, but you need to find one that does not conflict with other

@victorgp89
Copy link
Author

For example add attribute in metadatas and set it in Schema.php.
xml_element:
prefix: 'ns1'
namespace: 'http://ws.link.hotelresb2b.com/hotel'

For xml-sematics prefix should be almost irrelevant but for some clients is not the same for some reason...

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

No branches or pull requests

2 participants