0% found this document useful (0 votes)
54 views11 pages

Calling Webservic Through PL SQL

This document describes the three main steps to call a web service through a PL/SQL procedure: 1) Create a request, 2) Add parameters to the request, and 3) Invoke the web service to get a response. It provides examples of creating a request, adding parameters, and invoking the web service. The sample code shows the full process of calling a web service to verify a credit card transaction.

Uploaded by

Kranthi-Juvva
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views11 pages

Calling Webservic Through PL SQL

This document describes the three main steps to call a web service through a PL/SQL procedure: 1) Create a request, 2) Add parameters to the request, and 3) Invoke the web service to get a response. It provides examples of creating a request, adding parameters, and invoking the web service. The sample code shows the full process of calling a web service to verify a credit card transaction.

Uploaded by

Kranthi-Juvva
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 11

Calling webservice through pl/sql

procedure
(xxiris_om_common_soapui_k)

Author:
Sonia Kamra
11/24/2009

It has three main steps:


1. Create Request
2. Add Parameters
3. Invoke the webservice to get the
response

Step1:Creating a request
FUNCTION new_request
(method IN VARCHAR2,
submethod IN VARCHAR2,
namespace IN VARCHAR2)
RETURN request;

Example
g_namespace VARCHAR2(500):= 'http://uhg.iris.service/types/';
x_req xxiris_om_common_soapui_k.request;
x_request:= xxiris_om_common_soapui_k.new_request
('TrustCommerceRequest',
'customerData',
'xmlns="' || g_namespace || '"'
);

Step 2: Add Parameters


PROCEDURE add_parameter( req IN OUT NOCOPY request,
name IN VARCHAR2,
type IN VARCHAR2,
value IN VARCHAR2);

Example:
xxxiris_om_common_soapui_k.ADD_PARAMETER (x_request,
'transactionId',
'xsd:string',
12345'
);
At this point we add all the parameters in the order how its mentioned in WSDL.

Step 3: Invoke
FUNCTION invoke (
req
IN OUT NOCOPY request,
url
IN
VARCHAR2,
action IN
VARCHAR2
)
RETURN response

Example:

x_resp xxxiris_om_common_soapui_k.response;
x_resp :=
xxxiris_om_common_soapui_k.invoke (x_req,
http://apsp9040.uhc.com:7784/TrustCommerce/TrustCommerceWSSoapHttpPort?wsdl,
'http://uhg.iris.service//performAction'
);

Sample Code
DECLARE
x_request xxiris_om_common_soapui_k.request;
x_resp
xxiris_om_common_soapui_k.response;
g_namespace VARCHAR2 (500)
:= 'http://uhg.iris .service/types/';
buf
VARCHAR2 (32767);
BEGIN
x_request :=
xxiris_om_common_soapui_k.new_request ('TrustCommerceRequest', 'customerData','xmlns="' || g_namespace || '"');
xxiris_om_common_soapui_k.ADD_PARAMETER (x_request,'transactionId','xsd:string', '');
xxiris_om_common_soapui_k.ADD_PARAMETER (x_request,'action','xsd:string','verify');
xxiris_om_common_soapui_k.ADD_PARAMETER (x_request, 'avs', 'xsd:string','');
xxiris_om_common_soapui_k.ADD_PARAMETER (x_request,'cardName','xsd:string','');
xxiris_om_common_soapui_k.ADD_PARAMETER (x_request,'cardNumber','xsd:string','4111111111111111');
xxiris_om_common_soapui_k.ADD_PARAMETER (x_request,'cardBrand','xsd:string','VISA');
xxiris_om_common_soapui_k.ADD_PARAMETER (x_request,'message','xsd:string','');
xxiris_om_common_soapui_k.ADD_PARAMETER (x_request,'status','xsd:string',);
xxiris_om_common_soapui_k.ADD_PARAMETER (x_request,'address1','xsd:string','1);
xxiris_om_common_soapui_k.ADD_PARAMETER (x_request,'amount','xsd:string','');
xxiris_om_common_soapui_k.ADD_PARAMETER (x_request,'keyId','xsd:string','12345');
xxiris_om_common_soapui_k.ADD_PARAMETER (x_request,'result','xsd:string','');
xxiris_om_common_soapui_k.ADD_PARAMETER (x_request,'state','xsd:string','');
xxiris_om_common_soapui_k.ADD_PARAMETER (x_request,'zip','xsd:string','920001');
xxiris_om_common_soapui_k.ADD_PARAMETER (x_request,'expDate','xsd:string','1215');
xxiris_om_common_soapui_k.ADD_PARAMETER (x_request,'city','xsd:string','Somewhere');
xxiris_om_common_soapui_k.ADD_PARAMETER (x_request,'billingId','xsd:string','');
x_resp :=
xxiris_om_common_soapui_k.invoke
(x_request,
vg_ws_address,
'http://uhg.iris.service//performAction'
);
END;

Request sent
- <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <SOAP-ENV:Body>
- <TrustCommerceRequest xmlns="http://uhg.iris.service/types/">
- <customerData>
<transactionId xsi:type="xsd:string" />
<action xsi:type="xsd:string">verify</action>
<avs xsi:type="xsd:string" />
<cardName xsi:type="xsd:string">Raj</cardName>
<cardNumber xsi:type="xsd:string">4111111111111111</cardNumber>
<cardBrand xsi:type="xsd:string">VISA</cardBrand>
<message xsi:type="xsd:string" />
<status xsi:type="xsd:string" />
<address1 xsi:type="xsd:string">123 Test St.</address1>
<instrID xsi:type="xsd:string" />
<amount xsi:type="xsd:string" />
<keyid xsi:type="xsd:string">12345</keyid>
<result xsi:type="xsd:string" />
<state xsi:type="xsd:string" />
<zip xsi:type="xsd:string" />
<expDate xsi:type="xsd:string">1215</expDate>
<city xsi:type="xsd:string">Somewhere</city>
<billingId xsi:type="xsd:string" />
</customerData>
</TrustCommerceRequest>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Response Received
<TrustCommerceResponse>
<Result>
<transactionId>024-0073107562</transactionId>
<action nil="1"/>
<avs nil="1"/>
<cardName nil="1"/>
<cardNumber nil="1"/>
<cardBrand nil="1"/>
<message> - avs: A</message>
<media>cc</media>
<status>approved</status>
<address1 nil="1"/>
<instrID nil="1"/>
<amount nil="1"/>
<keyId>12345</keyId>
<result nil="1"/>
<state nil="1"/>
<zip nil="1"/>
<expDate nil="1"/>
<city nil="1"/>
<billingId nil="1"/>
</Result>
</TrustCommerceResponse>

You might also like