doedje / jquery.soap

This script uses $.ajax to send a SOAP:Envelope. It can take XML DOM, XML string or JSON as input and the response can be returned as either XML DOM, XML string or JSON too.
352 stars 147 forks source link

Problem with CDATA when value has newline char #87

Closed Aradesh closed 8 years ago

Aradesh commented 9 years ago

Hi. I had a problem with sending values with newlines. Method toString converts <![CDATA[value\nvalue]]> value to <![CDATA[value\nvalue]]> before it will be send to server. Need to change regexp that detect CDATA to /<![CDATA[[\s\S]*]]>/

doedje commented 9 years ago

I am afraid I don't quite understand what the problem is.... Can you give me an example of your $.soap call that shows me what goes in, what comes out and what you think should come out.... You could use the demo testbed to play around and copy-paste the call and soap.envelope here...

I tried your suggested change but I don't see a difference.

doedje commented 9 years ago

I am currently a bit in doubt with this issue... If there is a problem, please give me an example... Else I am afraid I am gonna close the issue.... Sending a pull request which fixes your example would be sweet! ;)

Aradesh commented 9 years ago

Hi, sorry. Here you can see that this regexp don't math the string: https://regex101.com/r/tZ2bC5/1

doedje commented 9 years ago

Now I understand... but the regexp you supplied one matches newlines.... it should be anything within CDATA

Aradesh commented 9 years ago

What do you mean? :)

Aradesh commented 9 years ago

Sorry, my first post has not correct strings :) This code

<![CDATA[value\nvalue]]>

converts to this

&laquo;![CDATA[value\nvalue]]&raquo;

and my xml fails

doedje commented 9 years ago

Ah, now I see!!! (I made a typo, in my previous message but also in the code, trying it, but it works now.....) Care to send me a PR? =]

doedje commented 9 years ago

I saw your branch, I'll will merge it next week.... no need to send a PR

doedje commented 8 years ago

fixed

Aradesh commented 8 years ago

thanks :+1: