Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Calling GenericSoapService with WS-Security settings in JDeveloper using a Web Service Proxy (Doc ID
1332308.1)
In this Document
Goal
Solution
Still have questions?
References
APPLIES TO:
GOAL
This document contains instructions on how to call the UCM 11g GenericSoapService from JDeveloper when the service requires WS-Security
policies.
SOLUTION
In the UCM domain, a default keystore is available and can be used for testing the GenericSoapService using WS-Policy security settings.
For more information on Web Services in UCM 11g, see the Developer's Guide, Chapter 7 and the note below. This contains steps on
creating a custom keystore. For illustrative purposes, the default-keystore.jks is used in the following example.
Document 1334029.1 - Configuring a Keystore in UCM 11g for Use With Web Services
Note: A keystore must be configured. See section 12.4.2 of the Developer's Guide for "Configuring SAML Support".
http://download.oracle.com/docs/cd/E17904_01/doc.1111/e10807/c12_web_services.htm#CHDDIJJB
Locate the following directory on the machine where UCM 11g is running:
$MW_HOME/user_projects/domains/<ucm-domain>/config/fmwconfig
Several files must be copied to the client machine for the web service test to use the keystore. The files needed in this directory are:
a. cwallet.sso
b. default-keystore.jks (this file must be created on the server before it can be copied. See section 12.4.2 of the Developer's Guide.)
c. jps-config-jse.xml
1 of 13 1/24/2016 3:14 PM
Document 1332308.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state...
Copy these file to the local directory, to a path where JDeveloper can reference them. For this example, they are moved to a Windows
machine in the path C:\fmwconfig.
2 of 13 1/24/2016 3:14 PM
Document 1332308.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state...
2. Add to the project a Web Service Proxy. Right click on the Project and select "New". In the window that opens, select Web Services ->
Web Service Proxy. Click OK.
3 of 13 1/24/2016 3:14 PM
Document 1332308.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state...
4. Enter the WSDL location for the GenericSoapService (GenericSoapPort). This URL for UCM 11g is of the following format. Click next.
JDeveloper will parse the WSDL and create Java classes for use in calling the web service.
4 of 13 1/24/2016 3:14 PM
Document 1332308.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state...
http://<host>:<port>/idcws/GenericSoapPort?WSDL
Example:
http://192.168.2.4:16200/idcws/GenericSoapPort?WSDL
5. Accept all defaults by clicking next until the "Policy" screen is displayed. On the Security section, add the appropriate policy that is used
for the web service.
5 of 13 1/24/2016 3:14 PM
Document 1332308.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state...
Below this line is the place to add code to call UCM services.
6 of 13 1/24/2016 3:14 PM
Document 1332308.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state...
8. You will need to import certain packages and classes at the top of the client class in order for this sample code to compile. JDeveloper
may import the packages/classes automatically, but if not, the imports needed for running this test are as follows:
import com.oracle.ucm.Field;
import com.oracle.ucm.Generic;
import com.oracle.ucm.Service;
import com.oracle.ucm.ResultSet;
import com.oracle.ucm.Row;
import com.oracle.ucm.File;
import java.util.List;
import java.util.Map;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.WebServiceRef;
import weblogic.wsee.jws.jaxws.owsm.SecurityPolicyFeature;
9. Before calling the web service, keystore and username credentials must be set in the client class. Here is a snippet:
GenericSoapPortType genericSoapPortType =
genericSoapService.getGenericSoapPort(securityFeatures);
// Add your code to call the desired methods.
7 of 13 1/24/2016 3:14 PM
Document 1332308.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state...
((BindingProvider)genericSoapPortType).getRequestContext();
requestContext.put(BindingProvider.USERNAME_PROPERTY, "weblogic");
requestContext.put(BindingProvider.PASSWORD_PROPERTY, "welcome1");
10. To call the service, the service and parameters must be declared and set. The following snippet shows how to setup the service and call
it.
A CHECKIN_NEW service requires additional code. Notice that a File must be inserted into the request. This sample inserts a file called
HelloWorld.txt into the request.
request.setWebKey("cs");
Service service = new Service();
request.setService(service);
service.setIdcService("CHECKIN_NEW");
Service.Document document = new Service.Document();
service.setDocument(document);
helloWorld.setName("primaryFile");
8 of 13 1/24/2016 3:14 PM
Document 1332308.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state...
11. Once the service is called, the response must be parsed and printed to determine success/failure and obtain values. Note that this
snippet only prints the LocalData portion of the returned values, not the ResultSets and OptionLists. The full example of the class listed later
in this file contains code to print ResultSets.
12. A full sample client class file follows that performs a CHECKIN_NEW service call.
package genericsoap;
import com.oracle.ucm.Field;
import com.oracle.ucm.Generic;
import com.oracle.ucm.ResultSet;
import com.oracle.ucm.Row;
import com.oracle.ucm.Service;
import com.oracle.ucm.File;
import java.util.List;
import java.util.Map;
import javax.activation.DataHandler;
import javax.activation.FileDataSource;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.WebServiceRef;
import weblogic.wsee.jws.jaxws.owsm.SecurityPoliciesFeature;
// !THE CHANGES MADE TO THIS FILE WILL BE DESTROYED IF REGENERATED!
// This source file is generated by Oracle tools
// Contents may be subject to change
// For reporting problems, use the following
// Version = Oracle WebServices (11.1.1.0.0, build 101221.1153.15811)
9 of 13 1/24/2016 3:14 PM
Document 1332308.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state...
//Call UCM web service DOC_INFO, giving dID of 1 as parameter. Change the dID to a valid value for your UCM
environment.
Generic request = new Generic();
//WebKey for calling UCM 11g GenericSoapService must be the relative web root.
//Example: If UCM 11g url is http://localhost:16200/cs, the webkey for service calls should be "cs".
request.setWebKey("cs");
Service service = new Service();
request.setService(service);
//Set IdcService
//service.setIdcService("DOC_INFO");
service.setIdcService("CHECKIN_NEW");
//service.setIdcService("GET_SEARCH_RESULTS");
//service.setIdcService("UPDATE_DOCINFO");
Service.Document document = new Service.Document();
service.setDocument(document);
//****************************
//CHECKIN_NEW - Note that checkin has to pass in a File object, using a javax.activation.DataHandler
parameter.
//****************************
Field securityGroup = new Field();
securityGroup.setName("dSecurityGroup");
securityGroup.setValue("Public");
fields.add(securityGroup);
// Dump resultsets
List<ResultSet> rsets = doc.getResultSet();
for (ResultSet rset : rsets) {
System.out.println("@ResultSet " + rset.getName());
List<Row> rowYourBoat = rset.getRow();
if (rowYourBoat.size() > 0) {
// Print out the columns
10 of 13 1/24/2016 3:14 PM
Document 1332308.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state...
}
}
Note: Since web services secured by OWSM WS-Security policies cannot use MTOM, the size of a file that can be uploaded USING
CHECKIN_NEW or CHECKIN_UNIVERSAL is limited. Streaming upload such as MTOM currently does not work with OWSM policies. If
large file are uploaded this way, the web service proxy client may experience this OutOfMemoryError. This error occurred in a test once
files exceeded 25 mb. For checking in large files to the content server, consider using RIDC as the client.
11 of 13 1/24/2016 3:14 PM
Document 1332308.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state...
Note:
In SR 3-9056237611 we found that the code throws a NPE if a file is checked in to a folders_g folder (that has default
metadata applied to it).
The issue was fixed by adding a reference to "primaryFile" to the file payload.
e.g.
12 of 13 1/24/2016 3:14 PM
Document 1332308.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state...
<Field name="xCollectionID">659771925421000004</Field>
<Field name="dDocAuthor">weblogic</Field>
<Field name="primaryFile">readme.txt</Field>
<File name="primaryFile" href="D:\readme.txt"><Contents></Contents></File>
</Document>
</Service>
</GenericRequest>
</S:Body>
</S:Envelope>
To discuss this information further with Oracle experts and with other Oracle customers, we encourage you to review, ask questions,
join, or start a new discussion in the My WebCenter Content Community.
REFERENCES
13 of 13 1/24/2016 3:14 PM