Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Problem with parsing an ampersand '&'

Hi all,

In my PL/SQL procedure I use apex_web_service.make_request to call a BIP report. The returned data is in XML format and one of the fields(customer name) has an ampersand('&') in the name.

here is the block where i call it:

-- -- Get the XML response from the web service.
l_xml := apex_web_service.make_request(
p_url => p_pod_name || '/xmlpserver/services/ExternalReportWSSService',
p_action => 'http://xmlns.oracle.com/oxp/service/PublicReportService/ExternalReportWSSService/runReportRequest',
p_envelope => l_envelope,
p_version => '1.2',
p_username => v_auth_user,
p_password => v_auth_pwd
);

if i then store the l_xml to a table and query it just to see how it looks, i get the below :

<env:Envelope
xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Header/>
<env:Body>
<env:Fault>
<env:Code>
<env:Value
xmlns:env="http://www.w3.org/2003/05/soap-envelope">env:Sender
</env:Value>
</env:Code>
<env:Reason>
<env:Text xml:lang="en-US">com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character ' ' (code 32) (missing name?)
at [row,col {unknown-source}]: [14,60]</env:Text>
</env:Reason>
<env:Role></env:Role>
</env:Fault>
</env:Body>
</env:Envelope>

I've tried to replace it in my BIP like this replace(party_name,'&','&') and in the pl/sql call too, but still no joy and the l_xml is still with the same error:

l_xml_clob :=
replace(apex_web_service.make_request(
p_url => p_pod_name || '/xmlpserver/services/ExternalReportWSSService',
p_action => 'http://xmlns.oracle.com/oxp/service/PublicReportService/ExternalReportWSSService/runReportRequest',
p_envelope => l_envelope,
p_version => '1.2',
p_username => v_auth_user,
p_password => v_auth_pwd
).getClobVal , '&', '&')

;

Any ideas, please?

select * from v$version

Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

Thanks in advance,

Aleks

This post has been answered by BluShadow on Aug 25 2023
Jump to Answer
Comments
Post Details
Added on Aug 24 2023
4 comments
908 views