KBACE TECHNOLOGIES PVT LTD
J.P. Techno Park,
3/1, Millers Road,
Bangalore - 560086 ORCHESTRATE. ACCELERATE. LIBERATE.
Main: 91-80-41121700
Fax: 91-80-41122605
www.kbace.com
Invoking a Web Service using Web Service Proxy Client
Author: Amrith Ganesh, KBACE Technologies Pvt. Ltd.
Creation Date: APRIL 24, 2013
Last Updated: APRIL 24, 2013
Version: 1.0
Copyright © 2013 KBACE
Document Control
Change Record
Date Author Version Change Reference
04/24/2013 Amrith 1.0 No Previous Document
Reviewers
Reviewer Position
Distribution
Copy No. Name Location
1
2
3
4
Note to Holders:
If you receive an electronic copy of this document and print it out, please write your name on the equivalent of the
cover page, for document control purposes.
If you receive a hard copy of this document, please write your name on the front cover, for document control
purposes.
Page ii
Copyright © 2013 KBACE
Table of Contents
Document Control ................................................................................................................................................................................... ii
Change Record .................................................................................................................................................................................. ii
Reviewers .......................................................................................................................................................................................... ii
Distribution........................................................................................................................................................................................ ii
Steps ........................................................................................................................................................................................................ 4
Open and Closed Issues ........................................................................................................................................................................ 17
Open Issues ..................................................................................................................................................................................... 17
Closed Issues ................................................................................................................................................................................... 17
Page iii
Copyright © 2013 KBACE
Steps
Steps:
1. Create a Generic Application and give appropriate name. Ex: ‘FusionApplicationTest’
Click Next
Page 4 of 17
Copyright © 2013 KBACE
2. Crete a generic Project and name the project . Ex ‘CurrencyRatesTest’. Give the Directory path.
Click Finish
Page 5 of 17
Copyright © 2013 KBACE
3. Right click on Project Name and click on New
4. Choose Web Service Proxy and click Ok
Click Next
Page 6 of 17
Copyright © 2013 KBACE
5. Select JAX-WS Style and click Next
Page 7 of 17
Copyright © 2013 KBACE
6. Enter the URL of the WSDL in the format:
http://<HostName:PortNumber>/finGlCurrManageRate/CurrencyAPIService?WSDL
EX: http://erpfusionapp.kbace.com:23603/finGlCurrManageRate/CurrencyAPIService?WSDL
The Host and Port can be obtained from the Link : http://erpfusionidm.kbace.com:7777/URL/urllist.txt
The Host and Port is fetched for the Financial Domain, since this example is for Current Rates.
Deselect Copy WSDL into Project
Click Next
Page 8 of 17
Copyright © 2013 KBACE
7. Click Next
Page 9 of 17
Copyright © 2013 KBACE
8. Click Next
Page 10 of 17
Copyright © 2013 KBACE
9. Click Next
Page 11 of 17
Copyright © 2013 KBACE
10. Select oracle/wss_username_token_client_policy and click Next
This means that the Webservice is protected by a policy ‘wss_username_token_client_policy’.
You will not get the desired response if you try to invoke a protected web service without providing proper
Username token on the client side.
Page 12 of 17
Copyright © 2013 KBACE
11. Click Next and Finish
Page 13 of 17
Copyright © 2013 KBACE
Page 14 of 17
Copyright © 2013 KBACE
12. Double click on CurrencyAPIServiceSoapHttpPortClient.java which is the file to be updated to invoke the
Currency Rates Web Service. The code should be as below. Add your custom code here.
package com.oracle.xmlns.apps.financials.generalledger.currencies.managerate.manageratepublicservice.applicationmodule;
import com.sun.xml.ws.api.addressing.AddressingVersion;
import com.sun.xml.ws.api.addressing.WSEndpointReference;
import com.sun.xml.ws.developer.WSBindingProvider;
import com.sun.xml.ws.message.StringHeader;
import java.util.UUID;
import javax.xml.ws.WebServiceRef;
import weblogic.wsee.jws.jaxws.owsm.SecurityPolicyFeature;
// Version = Oracle WebServices (11.1.1.0.0, build 111209.0821.28162)
public class CurrencyAPIServiceSoapHttpPortClient {
@WebServiceRef
private static CurrencyAPIService_Service currencyAPIService_Service;
private static final AddressingVersion WS_ADDR_VER = AddressingVersion.W3C;
public static void main(String[] args) throws ServiceException {
System.out.println("Enter the Main");
//setup security feature with OWSM policy
SecurityPolicyFeature[] securityFeature =
new SecurityPolicyFeature[] { new SecurityPolicyFeature("policy:oracle/wss_username_token_client_policy") };
currencyAPIService_Service = new CurrencyAPIService_Service();
CurrencyAPIService currencyAPIService =
currencyAPIService_Service.getCurrencyAPIServiceSoapHttpPort(securityFeature);
// Get the request context to set the outgoing addressing properties
WSBindingProvider wsbp = (WSBindingProvider)currencyAPIService;
WSEndpointReference replyTo =
new WSEndpointReference("http://erpfusionapp.kbace.com:23603/manageRate-FinGlCurrManageRatePublicModel-context-
root/CurrencyAPIService",
WS_ADDR_VER);
String uuid = "uuid:" + UUID.randomUUID();
wsbp.setOutboundHeaders(new StringHeader(WS_ADDR_VER.messageIDTag,
uuid),
replyTo.createHeader(WS_ADDR_VER.replyToTag));
//Add security headers below if any authentication is required.Application Username and password
wsbp.getRequestContext().put(WSBindingProvider.USERNAME_PROPERTY,
Page 15 of 17
Copyright © 2013 KBACE
"kbadmin");
wsbp.getRequestContext().put(WSBindingProvider.PASSWORD_PROPERTY,
"Oracle12");
// Add your code to call the desired methods.
String variableGetEuroCode = currencyAPIService.getEuroCode();
String variableGetConversionType =
currencyAPIService.getDefaultConversionType();
System.out.println("Received from CurrencyAPIService: " +
variableGetEuroCode);
System.out.println("Received from variableGetConversionType: " +
variableGetConversionType);
}
}
13. Create a java concurrent program by giving the execution file name as class file name of
‘CurrencyAPIServiceSoapHttpPortClient’ and execution file path as class file path where the class file is residing
in server (OR) use the classes and methods in program code to invoke particular method. Place the Project .jar
file in the CLASSPATH.
This java program can be called from various Application like ADF, OAF etc.
To test this from Jdev. Rebuild the Project and run the CurrencyAPIServiceSoapHttpPortClient.java file.
You should be able to see the response from the Web Service.
Page 16 of 17
Copyright © 2013 KBACE
Open and Closed Issues
Open Issues
ID Issue Resolution Owner Target Date Impact Date
Closed Issues
ID Issue Resolution Owner Target Date Impact Date
Page 17 of 17
Copyright © 2013 KBACE