Author |
Message
|
syedimtiyaz1234 |
Posted: Mon Feb 05, 2018 1:32 pm Post subject: Special Character Handling |
|
|
Apprentice
Joined: 22 Jan 2018 Posts: 30
|
Hi All,
we have one WSDL and in the response sometime Special Character is sent and now by default all Special Char is escaped like "$amp; $gt; etc.
now due to this there is some issue and so we wanted to un-escape it before we send it.
So we added this function AsisElementContent and i could verify it in SOAPUI that it works fine meaning response is coming as '&,<,> etc.' but now the Problem is that the response message is not a SOAP message. It's not validating in SOAPUI and it is failing in application as well as.
This is happening when there is some special Char in the response.
Could anyone please suggest anything.
Thank You
Imtiyaz |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Feb 06, 2018 5:32 am Post subject: Re: Special Character Handling |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
syedimtiyaz1234 wrote: |
Hi All,
we have one WSDL and in the response sometime Special Character is sent and now by default all Special Char is escaped like "$amp; $gt; etc.
now due to this there is some issue and so we wanted to un-escape it before we send it.
So we added this function AsisElementContent and i could verify it in SOAPUI that it works fine meaning response is coming as '&,<,> etc.' but now the Problem is that the response message is not a SOAP message. It's not validating in SOAPUI and it is failing in application as well as.
This is happening when there is some special Char in the response.
Could anyone please suggest anything.
Thank You
Imtiyaz |
You only want to escape the special character. You can't escape all characters indiscriminately or you won't have a valid XML / SOAP message anymore...
example
value of pwd is "</>"
So you would have <pwd></></pwd> or something like it.
Hope that helps  _________________ MQ & Broker admin |
|
Back to top |
|
 |
syedimtiyaz1234 |
Posted: Tue Feb 06, 2018 6:24 am Post subject: |
|
|
Apprentice
Joined: 22 Jan 2018 Posts: 30
|
Hi,
I could not get you. could you please explain me little more.
Or if i understand correctly what you are saying that i can't escape discrimantly as where there is no special Char , the SOAP reply is a valid SOAP.
Yes i only want for special Char if present. i am not sure which special Char would come from backend, it could be &,<,> etc. or if it will come but whenever it comes it should be as it is when IIB reply.
Thank You |
|
Back to top |
|
 |
Vitor |
Posted: Tue Feb 06, 2018 6:29 am Post subject: Re: Special Character Handling |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
syedimtiyaz1234 wrote: |
now due to this there is some issue and so we wanted to un-escape it before we send it. |
What issue? If these are no escaped the XML is invalid. Behold....
syedimtiyaz1234 wrote: |
now the Problem is that the response message is not a SOAP message. It's not validating in SOAPUI and it is failing in application as well as. |
It's not just not a SOAP message, it's not valid XML.
syedimtiyaz1234 wrote: |
This is happening when there is some special Char in the response. |
Because without an improperly escaped special character the XML is fine.
syedimtiyaz1234 wrote: |
Could anyone please suggest anything.
|
Fix the "issue" that you believe mean you need to send special characters unescaped. Presumably someone's homebrewed XML parser that's a bit rubbish. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
syedimtiyaz1234 |
Posted: Tue Feb 06, 2018 7:38 am Post subject: |
|
|
Apprentice
Joined: 22 Jan 2018 Posts: 30
|
The issue is that lets say front end they are expecting only 200 Char length in that element and now from Back end it is 200 with &,or <,> as these are 1 Char size.
Now When IIB sends it is changing it to & thus increasing the size thus validation fails.
We are trying from our side if by any way we could send it as it is.
2nd we are also suggesting to front end if possible can they un-escape those char and then do validation this way they was 200 Char.
and we can not also substring the message to make it 200. |
|
Back to top |
|
 |
Vitor |
Posted: Tue Feb 06, 2018 9:02 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
syedimtiyaz1234 wrote: |
The issue is that lets say front end they are expecting only 200 Char length in that element and now from Back end it is 200 with &,or <,> as these are 1 Char size.
Now When IIB sends it is changing it to & thus increasing the size thus validation fails. |
Wrong. If the front end is using a compliant XML parser, the escaped characters will turn back into their unescaped forms automatically. Imagine if every time you sent "Dun & Bradstreet" in XML, you had to manually take the & out.
syedimtiyaz1234 wrote: |
We are trying from our side if by any way we could send it as it is. |
Not as a valid SOAP or other XML document.
syedimtiyaz1234 wrote: |
2nd we are also suggesting to front end if possible can they un-escape those char and then do validation this way they was 200 Char. |
See above. Their parser should be doing this. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
timber |
Posted: Tue Feb 06, 2018 1:49 pm Post subject: |
|
|
 Grand Master
Joined: 25 Aug 2015 Posts: 1292
|
I agree with Vitor. IIB is behaving correctly, and it is emitting a valid XML document. The front end application has some weird restrictions on the length of the XML.
Also, it sounds as if the people who are trying to fix this need to read the XML specification. Trying to un-escape *all* escaped characters in the XML is very unprofessional.
Quote: |
So we added this function AsisElementContent |
...but you did not follow the advice in the IIB Knowledge Center which says: "The value is written directly to the output bit stream. No character substitutions are performed. Use this element with care." |
|
Back to top |
|
 |
mpong |
Posted: Tue Feb 06, 2018 9:38 pm Post subject: |
|
|
Disciple
Joined: 22 Jan 2010 Posts: 164
|
|
Back to top |
|
 |
|