CallOut Utility: UTL_DBWS.INVOKE Removes Attributes From The Request Message (Doc ID 1202963.1)

Last updated on JULY 26, 2017

Applies to:

JPublisher - Version 10.2.0.1 to 11.1.0.7 [Release 10.2 to 11.1]
Information in this document applies to any platform.

Symptoms

When  invoking a web service using UTL_DBWS callout utility, the UTL_DBWS.INVOKE procedure appears to be stripping out non namespace attributes from the request XML. For example the XML submitted and the XML sent are not the same. The example code below utilizes either:

10.2.0.1 w/10g callout utility per:
<Document: 428775.1> DBWS Callout Utilities User's Guide for RDBMS 10.1 or 10.2
Or
11.2.0.1 w/11g callout utilility per:
<Document: 469588.1> DBWS Callout Utilities User's Guide for RDBMS 11.1



In the example code, although the public web service does not need the stripped attributes, it still demonstrates the problem.


Example code:

set serveroutput on;

DECLARE
service_ sys.UTL_DBWS.service;
call_ sys.UTL_DBWS.call;
service_qname sys.UTL_DBWS.qname;
port_qname sys.UTL_DBWS.qname;
operation_qname sys.UTL_DBWS.qname;
string_type_qname sys.UTL_DBWS.qname;
l_namespace VARCHAR2(1000);
retx SYS.XMLTYPE;
xml_string SYS.XMLTYPE;
l_str LONG;
BEGIN
DBMS_JAVA.set_output(100000);
l_namespace := 'http://xmlme.com/WebServices';
service_qname := sys.UTL_DBWS.to_qname(l_namespace, 'Shakespeare');

service_ := sys.UTL_DBWS.create_service(service_qname);

port_qname := sys.UTL_DBWS.to_qname(l_namespace, 'ShakespeareSoap');
operation_qname := sys.UTL_DBWS.to_qname(l_namespace, 'GetSpeech');
call_ := sys.UTL_DBWS.create_call(service_, port_qname, operation_qname);
sys.UTL_DBWS.set_target_endpoint_address(call_,
http://www.xmlme.com/WSShakespeare.asmx');
sys.UTL_DBWS.set_property(call_, 'SOAPACTION_USE', 'TRUE');
sys.UTL_DBWS.set_property(call_, 'SOAPACTION_URI',
'http://xmlme.com/WebServices/GetSpeech');
sys.UTL_DBWS.set_property(call_, 'ENCODINGSTYLE_URI',
'http://schemas.xmlsoap.org/soap/encoding/');
sys.UTL_DBWS.set_property(call_, 'OPERATION_STYLE', 'document');
string_type_qname :=
sys.UTL_DBWS.to_qname('http://www.w3.org/2001/XMLSchema', 'string');
sys.UTL_DBWS.ADD_PARAMETER(call_, 'Request', string_type_qname,
'ParameterMode.IN');
sys.UTL_DBWS.set_return_type(call_, string_type_qname);

xml_string :=
xmltype(
'<?xml version="1.0" encoding="utf-8"?>
<GetSpeech test="this attribute will be stripped"
xmlns="http://xmlme.com/WebServices">
<Request test2="this one will be stripped too">To be, or not to be</Request>
</GetSpeech>'
);
retx := sys.UTL_DBWS.invoke(call_handle => call_, request => xml_string);

l_str := retx.EXTRACT('/*').getstringval();
LOOP
EXIT WHEN l_str IS NULL;
DBMS_OUTPUT.put_line(SUBSTR(l_str, 1, INSTR(l_str, CHR(10)) - 1));
l_str := SUBSTR(l_str, INSTR(l_str, CHR(10)) + 1);
END LOOP;

sys.UTL_DBWS.release_service(service_);
END;
.
============ output ==========================
.
ServiceFactory: oracle.j2ee.ws.client.ServiceFactoryImpl@78e2087c
WSDL: null
Service: oracle.j2ee.ws.client.BasicService@c2592d25
*** Created service: -677524827 -
oracle.jpub.runtime.dbws.DbwsProxy$ServiceProxy@42efc178 ***
ServiceProxy.get(-677524827) =
oracle.jpub.runtime.dbws.DbwsProxy$ServiceProxy@42efc178
getOperationInfo return NULL:
port={http://xmlme.com/WebServices}ShakespeareSoap,
operation={http://xmlme.com/WebServices}GetSpeech
setProperty(javax.xml.rpc.soap.http.soapaction.use, true)
setProperty(javax.xml.rpc.soap.http.soapaction.uri,
http://xmlme.com/WebServices/GetSpeech)
setProperty(javax.xml.rpc.encodingstyle.namespace.uri,
http://schemas.xmlsoap.org/soap/encoding/)
setProperty(javax.xml.rpc.soap.operation.style, document)
Attribute 0: this attribute will be stripped: test, this attribute will be
stripped
Attribute 1: http://xmlme.com/WebServices: xmlns,
http://xmlme.com/WebServices
createElement(GetSpeech,null,http://xmlme.com/WebServices)
Attribute 0: this attribute will be stripped: test, this attribute will be
stripped
Attribute 1: http://xmlme.com/WebServices: xmlns,
http://xmlme.com/WebServices
dbwsproxy.element.node.child.0: 1, null
Attribute 0: this one will be stripped too: test2, this one will be stripped
 too
createElement(Request,null,http://xmlme.com/WebServices)
Attribute 0: this one will be stripped too: test2, this one will be stripped
too
dbwsproxy.text.node.child.0: 3, To be, or not to be
request:
<GetSpeech xmlns="http://xmlme.com/WebServices">
<Request xmlns="http://xmlme.com/WebServices">To be, or not to be</Request>
</GetSpeech>
response:
<GetSpeechResponse xmlns="http://xmlme.com/WebServices">
<GetSpeechResult><SPEECH><PLAY>HAMLET</PLAY><SPEAKER>HAMLET</SPEA
KER>To be, or not to be: that is the question: Whether 'tis nobler in the
mind to suffer The slings and arrows of outrageous fortune, Or to take arms against a sea of troubles, And by opposing end them? To die: to sleep; No more; and by a sleep to say we end The heart-ache and the thousand natural shocks That flesh is heir to, 'tis a consummation Devoutly to be wish'd. To die, to sleep; To sleep: perchance to dream: ay, there's the rub; For in that sleep of death what dreams may come When we have shuffled off this mortal coil,
Must give us pause: there's the respect That makes calamity of so long life;
For who would bear the whips and scorns of time, The oppressor's wrong, the proud man's
contumely, The pangs of despised love, the law's delay, The insolence of office
and the spurns That patient merit of the unworthy takes, When he himself
might his quietus make With a bare bodkin? who would fardels bear, To grunt and sweat under a weary life,But that the dread of something after death, The undiscover'd country from whose bourn No traveller returns, puzzles the will And makes us rather bear those ills we have Than fly to others that we know not of? Thus conscience does make cowards of us all;
And thus the native hue of resolution Is sicklied o'er with the pale cast of
thought, And enterprises of great pith and moment With this regard their currents turn awry, And lose the name of action.--Soft you now! The fair Ophelia! Nymph, in thy orisons Be all
my sins remember'd.</SPEECH></GetSpeechResult
</GetSpeechResponse>
<GetSpeechResponse xmlns="http://xmlme.com/WebServices">
<GetSpeechResult><SPEECH><PLAY>HAMLET</PLAY><SPEAKER>HAM
LET</SPEAKER>To be, or not to be: that is the question: Whether &apos;tis
nobler in the mind to suffer The slings and arrows of outrageous fortune, Or
to
take arms against a sea of troubles, And by opposing end them? To die: to
sleep;
No more; and by a sleep to say we end The heart-ache and the thousand natural
shocks That flesh is heir to, &apos;tis a consummation Devoutly to be
wish&apos;d. To die, to sleep; To sleep: perchance to dream: ay, there&apos;s
the rub; For in that sleep of death what dreams may come When we have
shuffled
off this mortal coil, Must give us pause: there&apos;s the respect That makes
calamity of so long life; For who would bear the whips and scorns of time,
The
oppressor&apos;s wrong, the proud man&apos;s contumely, The pangs of despised
love, the law&apos;s delay, The insolence of office and the spurns That
patient
merit of the unworthy takes, When he himself might his quietus make With a
bare
bodkin? who would fardels bear, To grunt and sweat under a weary life, But
that
the dread of something after death, The undiscover&apos;d country from whose
bourn No traveller returns, puzzles the will And makes us rather bear those
ills
we have Than fly to others that we know not of? Thus conscience does make
cowards of us all; And thus the native hue of resolution Is sicklied
o&apos;er
with the pale cast of thought, And enterprises of great pith and moment With
this regard their currents turn awry, And lose the name of action.--Soft you
now! The fair Ophelia! Nymph, in thy orisons Be all my sins
remember&apos;d.</SPEECH></GetSpeechResult>
</GetSpeechResponse>
ServiceProxy.get(-677524827) =
oracle.jpub.runtime.dbws.DbwsProxy$ServiceProxy@42efc178
 .
PL/SQL procedure successfully completed.
.




If you look at the "request" section from the invoke logs.

request:


  Note: The request is not what was submitted.

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms