Issue With UTL_HTTP and SOAP ENVELOP.
Hi Friends,
I am facing isuue with the function mentioned below.
I got this program from OTN itself and I modified this program and used with in my sample WSDL it's working fine but the problem is with the below one.
Infact if i am not passing any values in the SOAP_ENVELOP just as SOAP_ENVELOPE constant varchar2(32767) := ' ' then also i am getting the error mentiond at the bottom.
Active on net - Original WSDL URL is http://125.21.166.27/cordys/com.eibus.web.tools.wsdl.WSDLGateway.wcp?service=http%3A%2F%2Fschemas.cordys.com%2Fbpm%2FCommissionPassing%2FRunProcess_CommissionPassing&organization=o%3DWIPRO%2Ccn%3Dcordys%2Co%3Ditgi.co.in
And the Authentication is
User : AmolNigam
Pwd : 'sdccp400'
create or replace function LocalHostWS_Cordys3 return xmlType is
SOAP_URL constant varchar2(1000) :=
'http://125.21.166.27/cordys/com.eibus.web.soap.Gateway.wcp?organization=o=WIPRO,cn=cordys,o=itgi.co.in';
SOAP_ENVELOPE constant varchar2(32767) :=
'<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP:Body>
<RunProcess_CommissionPassing xmlns="http://schemas.cordys.com/bpm/CommissionPassing">
<MethodNameCommissionnpassing>
<REQMSG1>
<copybook filename="SESSIONI.TXT">
<SESSIONI-REC>
<MSGID>SESSIONI</MSGID>
<MSGLNG>10</MSGLNG>
<MSGCNT>1</MSGCNT>
<FILLER/>
<SESSIONI-COMPANY>1</SESSIONI-COMPANY>
<SESSIONI-BRANCH>DZ</SESSIONI-BRANCH>
<SESSIONI-LANGUAGE>E</SESSIONI-LANGUAGE>
<SESSIONI-ACCTYR/>
<SESSIONI-ACCTMN/>
</SESSIONI-REC>
</copybook>
</REQMSG1>
<REQMSG2>
<copybook filename="LDRHDR.TXT">
<LEADER-HEADER>
<MSGREFNO/>
<USRPRF/>
<WKSID>1</WKSID>
<OBJID>PBOPYCTL</OBJID>
<VRBID>CLMPAY</VRBID>
<TOTMSGLNG/>
<OPMODE>0</OPMODE>
<CMTCONTROL>E</CMTCONTROL>
<RSPMODE>I</RSPMODE>
<MSGINTENT>R</MSGINTENT>
<MORE-IND>N</MORE-IND>
<ERRLVL>0</ERRLVL>
<FILLER/>
</LEADER-HEADER>
</copybook>
</REQMSG2>
<REQMSG3>
<copybook filename="PBOPAY01I.TXT">
<PBOPAY01I-REC>
<MESSAGE-HEADER>
<MSGID>PBOPAY01I</MSGID>
<MSGLNG>32</MSGLNG>
<MSGCNT>1</MSGCNT>
<FILLER/>
</MESSAGE-HEADER>
<MESSAGE-DATA>
<BGEN-S2201>
<BGEN-REFNUM>000000234857</BGEN-REFNUM>
<BGEN-S2201-PAYEESEL>00000939</BGEN-S2201-PAYEESEL>
<BGEN-S2201-REQNTYPE>5</BGEN-S2201-REQNTYPE>
</BGEN-S2201>
</MESSAGE-DATA>
</PBOPAY01I-REC>
</copybook>
</REQMSG3>
<REQMSG4>
<copybook filename="PBO2200I.TXT">
<PBO2200I-REC>
<MESSAGE-HEADER>
<MSGID>PBO2200C</MSGID>
<MSGLNG>140</MSGLNG>
<MSGCNT>2</MSGCNT>
<FILLER/>
</MESSAGE-HEADER>
<MESSAGE-DATA>
<BGEN-S2200>
<BGEN-S2200-BANKCODE>C3</BGEN-S2200-BANKCODE>
<BGEN-S2200-CHEQNO>12346</BGEN-S2200-CHEQNO>
<BGEN-S2200-DOCORIGAMT>0</BGEN-S2200-DOCORIGAMT>
<BGEN-S2200-SCRATE>0</BGEN-S2200-SCRATE>
<BGEN-S2200-TRANDATEX>20100802</BGEN-S2200-TRANDATEX>
<FILLER/>
<BGEN-S2200-SFL>
<BGEN-S2200-DISACC>12346</BGEN-S2200-DISACC>
<BGEN-S2200-ENTITY>10000062</BGEN-S2200-ENTITY>
<BGEN-S2200-ORIGAMT>6812.00</BGEN-S2200-ORIGAMT>
<BGEN-S2200-ORIGCCY>*</BGEN-S2200-ORIGCCY>
<BGEN-S2200-SACSCODE>AG</BGEN-S2200-SACSCODE>
<BGEN-S2200-SACSTYPW>PC</BGEN-S2200-SACSTYPW>
<BGEN-S2200-SLRATE>0</BGEN-S2200-SLRATE>
<BGEN-S2200-TRANDESC>TEST DESC</BGEN-S2200-TRANDESC>
</BGEN-S2200-SFL>
</BGEN-S2200>
</MESSAGE-DATA>
<MESSAGE-DATA>
<BGEN-S2200>
<BGEN-S2200-BANKCODE>C3</BGEN-S2200-BANKCODE>
<BGEN-S2200-CHEQNO>12346</BGEN-S2200-CHEQNO>
<BGEN-S2200-DOCORIGAMT>0</BGEN-S2200-DOCORIGAMT>
<BGEN-S2200-SCRATE>0</BGEN-S2200-SCRATE>
<BGEN-S2200-TRANDATEX>20100826</BGEN-S2200-TRANDATEX>
<FILLER/>
<BGEN-S2200-SFL>
<BGEN-S2200-DISACC>12346</BGEN-S2200-DISACC>
<BGEN-S2200-ENTITY>10000182</BGEN-S2200-ENTITY>
<BGEN-S2200-ORIGAMT>-6812.00</BGEN-S2200-ORIGAMT>
<BGEN-S2200-ORIGCCY>*</BGEN-S2200-ORIGCCY>
<BGEN-S2200-SACSCODE>AG</BGEN-S2200-SACSCODE>
<BGEN-S2200-SACSTYPW>PC</BGEN-S2200-SACSTYPW>
<BGEN-S2200-SLRATE>0</BGEN-S2200-SLRATE>
<BGEN-S2200-TRANDESC>TEST DESC</BGEN-S2200-TRANDESC>
</BGEN-S2200-SFL>
</BGEN-S2200>
</MESSAGE-DATA>
</PBO2200I-REC>
</copybook>
</REQMSG4>
</MethodNameCommissionnpassing>
</RunProcess_CommissionPassing>
</SOAP:Body>
</SOAP:Envelope>';
-- proxyURL varchar2(4000);
request UTL_HTTP.req;
response UTL_HTTP.resp;
buffer varchar2(32767);
httpData clob;
eof boolean;
soapEnvelope varchar2(32767);
soapAction varchar2(100); -- := 'NumberToWords';
xml xmlType;
username VARCHAR2(20);
password VARCHAR2(20);
begin
username := 'AmolNigam';
password := 'sdccp400';
-- formatting the soap envelope
--soapEnvelope := replace( SOAP_ENVELOPE, '$NUMBER', n );
-- our "browser" settings
UTL_HTTP.set_response_error_check( true );
UTL_HTTP.set_detailed_excp_support( true );
UTL_HTTP.set_cookie_support( true );
UTL_HTTP.set_transfer_timeout( 30 );
UTL_HTTP.set_follow_redirect( 3 );
UTL_HTTP.set_persistent_conn_support( true );
-- setting our proxy (only needed when a web proxy is needed for net access)
--proxyURL := 'http://scott:tiger@my-domain.com';
--UTL_HTTP.set_proxy( proxyURL, 'my-domain.com' );
-- we perform a HTTP post (sending the SOAP envelope to the server)
request := UTL_HTTP.begin_request( SOAP_URL, 'POST', UTL_HTTP.HTTP_VERSION_1_1 );
utl_http.set_authentication(request, username, password);
UTL_HTTP.set_header( request, 'User-Agent', 'Mozilla/4.0 (compatible)' );
UTL_HTTP.set_header( request, 'Content-Type', 'text/xml; charset=utf-8' );
UTL_HTTP.set_header( request, 'Content-Length', length(soapEnvelope) );
UTL_HTTP.set_header( request, 'SOAPAction', soapAction );
UTL_HTTP.write_text( request, soapEnvelope );
-- DBMS_OUTPUT.put_line('Firs 1');
-- we receive the XML response from the web service (saving it as a CLOB)
response := UTL_HTTP.get_response( request );
DBMS_LOB.CreateTemporary( httpData, true );
-- DBMS_OUTPUT.put_line('Firs 2');
eof := false;
loop
exit when eof;
begin
UTL_HTTP.read_text( response, buffer, 32767 );
if (buffer is not null) and length(buffer)>0 then
DBMS_LOB.writeAppend( httpData, length(buffer), buffer );
DBMS_OUTPUT.put_line('Inside Loop');
end if;
exception when UTL_HTTP.END_OF_BODY then
eof := true;
end;
end loop;
UTL_HTTP.end_response( response );
xml := xmlType( httpData );
-- DBMS_OUTPUT.put_line('printing XML');
DBMS_LOB.FreeTemporary( httpData );
return( xml );
exception when OTHERS then
UTL_HTTP.end_response( response );
if httpData is not null then
DBMS_LOB.FreeTemporary( httpData );
end if;
raise;
end;
/
--------------------------------------------------------------------------------
select LocalHostWS_Cordys3 from dual;
ORA-29261: bad argument
ORA-06512: at "SYS.UTL_HTTP", line 1387
ORA-06512: at "APPS.LOCALHOSTWS_CORDYS3", line 187
ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00229: input source is empty
Error at line 0
Please help
Thanks in Advance
Bachan.