你不neex PL/SQL;你可以使用一個XQuery在普通的SQL:
select XMLQuery('declare namespace wsse = "http://schemas.xmlsoap.org/ws/2002/12/secext"; (::)
/wsse:Security/wsse:BinarySecurityToken/text()'
passing XMLType('<wsse:Security xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext">
<wsse:BinarySecurityToken valueType="String" EncodingType="wsse:Base64Binary">expectedToken</wsse:BinarySecurityToken>
</wsse:Security>')
returning content)
from dual;
XMLQUERY('DECLARENAMESPACEWSSE="HTTP://SCHEMAS.XMLSOAP.ORG/WS/2002/12/SECEXT";(:
--------------------------------------------------------------------------------
expectedToken
如果您已經獲得在PL/SQL響應,並希望繼續使用它,那麼如果SOAP值是一個字符串變量,你可以這樣做:
set serveroutput on
declare
soap varchar2(500);
token varchar2(200);
begin
soap := '<wsse:Security xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext">
<wsse:BinarySecurityToken valueType="String" EncodingType="wsse:Base64Binary">expectedToken</wsse:BinarySecurityToken>
</wsse:Security>';
select XMLQuery('declare namespace wsse = "http://schemas.xmlsoap.org/ws/2002/12/secext"; (::)
/wsse:Security/wsse:BinarySecurityToken/text()'
passing XMLType(soap)
returning content).getStringVal()
into token
from dual;
dbms_output.put_line(token);
end;
/
PL/SQL procedure successfully completed.
expectedToken
嘿亞歷克斯,非常感謝你!問候 –