How to add a certificate to keystore using keytool?
Hi all,
I am trying to connect a server from my application which requires a certificate for secure connection.
I am using Jdeveloper. Should I use command prompt and use keytool command after going to jdk home of jdeveloper and add the certificate?
What password should I use?
Sam
Consult for example:
http://www.thatsjava.com/java-tech/38248/
http://www.oracle.com/technology/sample_code/tech/java/codesnippet/ejb/applettoejb/HowTo_Applet_talks_to_Session_bean.html
http://oraforms.blogspot.com/2009/02/setting-up-jdeveloper-for-httpsssl.html
NA
http://nickaiva.blogspot.com
Similar Messages
-
How to add a certificate to IIS global "Server Certificates" list using PowerShell?
Hi, been surfing the web for an example on how to add a certificate to the "global" IIS "Server Certificates" list using PowerShell but to no luck. I already have code in place on how to tie / associate a specific website with a specific cert but not how
to add the new .cer file using the "Complete Certificate Request..." wizard using PowerShell.... I dont expect the final code to become published but if someone had an idea on howto integrate / get an entry point on where to interact between the "Server Certificate"
list in IIS and POSH I would be super happy! :|
I am runnign IIS on a Windows 2008R2 x64 Standard Edition if that helps..... of course, I would saddle for an CLI if there is no other way, but POSH is of course the way to go! :)
Thanks for the help in advance guys, take care!
br4tt3Hi and thanks for the suggestions!
Although it comes close, the suggested code example points on howto import / incorporate .pfx files - I am getting fed by .cer files which I need to add into the IIS console using POSH.
I tried explore the IIS.CertObj object but was not able to work out if this one could be used for importing / adding .cer files into IIS! However, launching the following command from a POSH console with Import-Module Webadministration already
loaded into that shell;
$certMgr = New-Object -ComObject IIS.CertObj returns the following error message:
New-Object : Cannot load COM type IIS.CertObj
From an IIS perspective I have the following components installed;
[X] Web Server (IIS) Web-Server
[X] Web Server Web-WebServer
[ ] Common HTTP Features Web-Common-Http
[ ] Static Content Web-Static-Content
[ ] Default Document Web-Default-Doc
[ ] Directory Browsing Web-Dir-Browsing
[ ] HTTP Errors Web-Http-Errors
[ ] HTTP Redirection Web-Http-Redirect
[ ] WebDAV Publishing Web-DAV-Publishing
[X] Application Development Web-App-Dev
[ ] ASP.NET
Web-Asp-Net
[X] .NET Extensibility Web-Net-Ext
[ ] ASP
Web-ASP
[ ] CGI
Web-CGI
[ ] ISAPI Extensions Web-ISAPI-Ext
[ ] ISAPI Filters Web-ISAPI-Filter
[ ] Server Side Includes Web-Includes
[ ] Health and Diagnostics Web-Health
[ ] HTTP Logging Web-Http-Logging
[ ] Logging Tools Web-Log-Libraries
[ ] Request Monitor Web-Request-Monitor
[ ] Tracing
Web-Http-Tracing
[ ] Custom Logging Web-Custom-Logging
[ ] ODBC Logging Web-ODBC-Logging
[X] Security
Web-Security
[ ] Basic Authentication Web-Basic-Auth
[ ] Windows Authentication Web-Windows-Auth
[ ] Digest Authentication Web-Digest-Auth
[ ] Client Certificate Mapping Authentic... Web-Client-Auth
[ ] IIS Client Certificate Mapping Authe... Web-Cert-Auth
[ ] URL Authorization Web-Url-Auth
[X] Request Filtering Web-Filtering
[ ] IP and Domain Restrictions Web-IP-Security
[ ] Performance Web-Performance
[ ] Static Content Compression Web-Stat-Compression
[ ] Dynamic Content Compression Web-Dyn-Compression
[X] Management Tools Web-Mgmt-Tools
[X] IIS Management Console Web-Mgmt-Console
[X] IIS Management Scripts and Tools Web-Scripting-Tools
[ ] Management Service Web-Mgmt-Service
[ ] IIS 6 Management Compatibility Web-Mgmt-Compat
[ ] IIS 6 Metabase Compatibility Web-Metabase
[ ] IIS 6 WMI Compatibility Web-WMI
[ ] IIS 6 Scripting Tools Web-Lgcy-Scripting
[ ] IIS 6 Management Console Web-Lgcy-Mgmt-Console
[X] FTP Server Web-Ftp-Server
[X] FTP Service Web-Ftp-Service
[X] FTP Extensibility Web-Ftp-Ext
[ ] IIS Hostable Web Core Web-WHC
More or less the one thing that I am trying to get up and running is an automated FTPS solution - I just use the IIS console to be able to troubleshoot / compare how things scripted from POSH interacts in the MMC representation. The error I am getting
might be that I am lacking some IIS components to be in place to be able to automate some parts of the IIS - as suggested by the IIS.CertObj object listed in the example..... I will get back if I can track down which component needs to be added to be
able to reference the IIS.CertObj object.
Br4tt3 signing out...
br4tt3 -
How to add an image over another using af:image
How to add an image over another using af:image
Thanks,
Veerai have a image which is black strip. i have added that to af:image
<af:image source="image1" id="image" />
on the black strip, i need to add company logo.
how to achieve it.
Thanks,
Veera. -
How to add target to jmsSystemResource MBean using JMX
Does anybody know how to add target to jmsSystemResource MBean using JMX in WebLogic 9.0?(I am not using WSLT) I always get "NoSuchMethodException":
[jmsServer] Caused by: java.lang.NoSuchMethodException: addTarget(weblogic.management.configuration.
TargetMBean,) for com.bea:Name=admin01DefaultJMSServer,Type=JMSSystemResourcego to the object which u want to compare
go to->version management->select the TR request no->and select remote comparision there->and give the system where u need to compare this object
and next press compare
hope it will work
cheer
s.janagar -
HT5654 how to add videos to the ipad using the latest version of itunes
how to add videos to the ipad using the latest version of itunes ?
Hello zaraa90,
After reviewing your post, I have located an article that can help with syncing content. It contains a number of troubleshooting steps and helpful advice for the issue you are experiencing:
Sync your iPhone, iPad and iPod with iTunes using USB
Thank you for contributing to Apple Support Communities.
Cheers,
BobbyD -
How to add discussions to Collaboration Room using Rooms API
Hi All,
How to add discussions to any room using the Rooms API?
I looked at the NW04s javadocs, but could not find which would help?
Any pointers will be appreciated.
Regards,SandipHi All,
Any help!
Any help from SAP? Are the discussion APIs available?
Any input is appreciated. Thanks
Regards
Sandip
Message was edited by:
Sandip Agarwal -
How to add URLs in apage without using edit mode
Hello everybody.
We have Portal 9.0.4.1 under Solaris, and we are just beggining using it :-)
We created a section for links (to urls) in the home page of each user. We would like our users to add links to their most used pages (for example, metalink.oracle.com), but we do not want them to enter in edit mode, we would like some functionallity like the "add portlet" in the customize option.
Any help will be very apreciated.
Thanks in advance.
LisandroThe example is generic and not hardcoded to any region on the page ... but has the same "warning" that Mark mentioned about this example not working in future versions if Oracle changes the URL structure:
The Add Item example shows how to create a new item type ...adding an item of this type to any region allows you to add content to that region
The Edit Item example show how to show a edit link or icon next to the item in view mode.
Add Item
++++++++++++++++++++++++++++++++++++++++++++++++++++++++
This code sample shows how to create an item allows the content contributor to add items to the page group/page/region that the sample item is placed in.
If you want your content contributor to add items to multiple regions on a page, add the sample item to all regions that you wish to expose this functionality in.
Step 1: Create a PL/SQL procedure
Create the following procedure:
Create or Replace Procedure <schema>.ADDITEM_URL
p_itemid IN VARCHAR2,
p_pageid IN VARCHAR2,
p_siteid IN VARCHAR2)
as
v_url varchar2(2000);
v_region varchar2(2000);
v_looplink varchar2(2000);
v_host varchar2(2000);
begin
select folder_region_id into v_region
from portal.wwsbr_all_items
where id = p_itemid and
caid = p_siteid;
if instr(portal.wwctx_api.get_host, ':') = 0 then
v_host := portal.wwctx_api.get_host;
else
v_host := substr(portal.wwctx_api.get_host,
1,
(instr(portal.wwctx_api.get_host, ':')-1))
|| '%3A'
|| substr(portal.wwctx_api.get_host,
(instr(portal.wwctx_api.get_host, ':')+1));
end if;
v_looplink := 'http%3A%2F%2F'
|| v_host
|| '%2Fportal%2Fpage%3F_pageid%3D'
|| p_siteid
|| '%2C'
|| p_pageid
|| '%26_dad%3D'
|| portal.wwctx_api.get_dad_name
|| '%26_schema%3D'
|| portal.wwctx_api.get_product_schema
|| '&p_containerpageid='
|| p_pageid;
v_url := portal.wwctx_api.get_base_url
|| 'portal.wwv_additem.selectitemtype?'
|| 'p_cornerid=' || p_pageid
|| '&p_siteid=' || p_siteid
|| '&p_regionid=' || v_region
|| '&p_looplink=' || v_looplink;
htp.p('<a href="' || v_url || "><img src="/images/additem.gif"</a>');
exception
when others then
htp.p('error');
end;
Once the procedure has been created, grant EXECUTE permission to PUBLIC.
Step 2: Create a custom item type
This custom item type will be associated with the PL/SQL procedure created above. Placing an item of this type on a page will give the content contributor something to click on while the page is in view mode to call the add item wizard.
Go to the Procedures tab of the new item type and associate with PL/SQL procedure.
Ensure the âDisplay Procedure Results With Itemâ checkbox is checked.
Step 3: Add item of type âAdd_Itemâ to a page.
1. Configure the Page Group to allow items of your new type to be added
2. Add an item of type âadd_itemâ to your page.
3. For the region containing your new item, in the properties, ensure the âAssociated Functionsâ attribute is in the Displayed Attributes list.
Edit Item
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
This code sample draws an Edit icon for content contributors to click on while the page is in view mode to edit the item with the default Edit Item wizard.
Step 1: Create a PL/SQL procedure
Create or Replace Procedure <schema>.EDITITEM_URL
p_itemid IN VARCHAR2,
p_pageid IN VARCHAR2,
p_siteid IN VARCHAR2)
as
v_looplink varchar2(2000);
v_url varchar2(2000);
v_subtype varchar2(2000);
v_itemtype varchar2(2000);
v_catid varchar2(2000);
v_catcaid varchar2(2000);
v_parentid varchar2(2000);
v_host varchar2(2000);
begin
select subtype
,itemtype
,category_id
,category_caid
,parent_item_id
into v_subtype
,v_itemtype
,v_catid
,v_catcaid
,v_parentid
from portal.wwsbr_all_items
where id = p_itemid and
caid = p_siteid;
if instr(portal.wwctx_api.get_host, ':') = 0 then
v_host := portal.wwctx_api.get_host;
else
v_host := substr(portal.wwctx_api.get_host,
1,
(instr(portal.wwctx_api.get_host, ':')-1))
|| '%3A'
|| substr(portal.wwctx_api.get_host,
(instr(portal.wwctx_api.get_host, ':')+1));
end if;
v_looplink := 'http%3A%2F%2F'
|| v_host
|| '%2Fportal%2Fpage%3F_pageid%3D'
|| p_siteid
|| '%2C'
|| p_pageid
|| '%26_dad%3D'
|| portal.wwctx_api.get_dad_name
|| '%26_schema%3D'
|| portal.wwctx_api.get_product_schema
|| '&p_containerpageid='
|| p_pageid;
v_url := portal.wwctx_api.get_base_url
|| 'portal.wwv_edit_tab.edititem?'
|| 'p_thingid=' || p_itemid
|| '&p_cornerid=' || p_pageid
|| '&p_siteid=' || p_siteid
|| '&p_subtype=' || v_subtype
|| '&p_itemtype=' || v_itemtype
|| '&p_topicid=' || v_catid
|| '&p_topicsiteid=' || v_catcaid
|| '&p_cornerlinkid='
|| '&p_parentid=' || v_parentid
|| '&p_action=update'
|| '&p_currcornerid=' || p_pageid
|| '&p_language='
|| portal.wwctx_api.get_nls_language
|| '&p_looplink=' || v_looplink;
htp.p('<a href="' || v_url || "><img src="/images/ed-item.gif"</a>');
exception
when others then
null;
end;
Step 2: Associate Procedure with Item Types
For every item type that you wish to supply an edit icon to show while the page is in view mode, call the EDITITEM_URL procedure created in the step above.
Step 3: Show Associated Function attribute
In order for the procedure associated with the item type to execute, you must ensure the region properties are set on the Style/Attributes tab have the Associated Function listed as one of the Displayed Attributes. -
How to add phone number to MBP using Mtn Lion OS X 10.8.3
I have Ipad , Iphone 4s and a mbp using the OS 10.8.3
I have no idea of how to add my phone number to the list of available options to send iMessages from my MBP.
I only have emails.
Any suggestions..
Thanks in advance.Hi,
The presumption in the Linked article is that the Apple ID has been added to the iPhone before it is added elsewhere including the Mac version.
If you have not already done so then add the ID to the iPhone.
If after a few minutes the Mac version has not had the pop to say the iPhone is using it's Number and the Apple ID then restart the app on the Mac.
7:58 PM Saturday; March 30, 2013
iMac 2.5Ghz 5i 2011 (Mountain Lion 10.8.3)
G4/1GhzDual MDD (Leopard 10.5.8)
MacBookPro 2Gb (Snow Leopard 10.6.8)
Mac OS X (10.6.8),
Couple of iPhones and an iPad
"Limit the Logs to the Bits above Binary Images." No, Seriously -
How to add language to a 9780 using Mac desktop software
Hi, I recently updated my Bold 9780 on Mac and the updated deleted all my languages, I need to know, how to add language using mac desktop software.
Hello hjmatias and welcome to the BlackBerry Support Community Forums.
You can use the Desktop Software for Mac, available for download at www.blackberry.com/mac to install additional languages.
Here is an article from the BlackBerry Technical Solution Center that will take you through the steps to add applications: KB19937
-HMthePirate
Come follow your BlackBerry Technical Team on twitter! @BlackBerryHelp
Be sure to click Kudos! for those who have helped you.Click Solution? for posts that have solved your issue(s)! -
How to add fragment in jsf page using include tag in jdeveloper
Hi all
Can you tell me wat is syntax of using include tag .or how to add fragment in jsf page ..
Edited by: 947228 on Jul 18, 2012 5:01 AMHi,
Why do you want to do that?
Check [url https://blogs.oracle.com/jheadstart/entry/avoid_use_of_jspinclude_where]this out before proceeding further.
Btw, always mention your JDev version, clear usecase to get help.
-Arun -
How to add composition to Media Encoder using Script?
On AE CS6 I used to add compositions to render queue using scripts. (jsx). Since Adobe depreciated some encoders scripts can not use those presents. I want to switch to Adobe Encoder and I want to add compositions to its queue using scripts.
Is there a way to tell adobe to add certain composition to Adobe Encoder queue using jsx script?
Is there any scripting guide for Adobe CC?You will probably have to resort to calling the respective menu command and/ or write your own AME render list. I'm not aware of any specific support or commands for this otherwise, though presumably one might be able to intercept the stuff sent between the programs and build a little helper utility to mimic this functionality....
Mylenium -
Problem in installation of free SSL certificate on Weblogic using keytool
We tried to install SSL certificate on weblogic certificate using Keystore ..but it is giving error in console at startup and server shutdowns automatically...
Steps followed:-
1) To generate keystore and private key and digital cerficate:-
keytool -genkey -alias mykey2 -keyalg RSA -keystore webconkeystore.jks -storepass webconkeystorepassword
2) To generate CSR
keytool -certreq -alias mykey2 -file webconcsr1.csr -keyalg RSA -storetype jks -keystore webconkeystore.jks -storepass webconkeystorepassword
3) CSR is uploaded on verisign site to generate free ssl certificate.All certificate text received is paste into file (cacert.pem)
4) Same certificate is put into same keystore using following command
keytool -import -alias mykey2 -keystore webconkeystore.jks -trustcacerts -file cacert.pem
5) Before step 4), we have also installed root /intermediate certificate to include chain using following command.
(intermediateCa.cer file is downloaded from verisign site)
keytool -import -alias intermediateca -keystore webconkeystore.jks -trustcacerts -file intermediateCa.cer
6) After this configuration we used weblogic admin module to configure Keystore and SSL.
7) For KeyStore tab in weblogic admin module, we have select option Custom Identity And Custom Trust provided following details under Identity and Trust columns:-
Private key alias: mykey2
PassKeyphrase: webconkeystorepassword
Location of keystore: location of webconkeystore.jks file on server
8) For SSL tab in weblogic admin module, we have select option KeyStores for Identity and Trust locations.
Error on console:
<Nov 3, 2009 3:00:17 PM IST> <Emergency> <Security> <BEA-090034> <Not listening for SSL, java.io.IOException: Failed to retrieve identity key/certificate from keystore /home/cedera/bea9.0/weblogic90/server/lib/webconkeystore.jks under alias mykey2 on server AdminServer.>
<Nov 3, 2009 3:00:17 PM IST> <Emergency> <Security> <BEA-090087> <Server failed to bind to the configured Admin port. The port may already be used by another process.>
<Nov 3, 2009 3:00:17 PM IST> <Critical> <WebLogicServer> <BEA-000362> <Server failed. Reason: Server failed to bind to any usable port. See preceeding log message for details.>
<Nov 3, 2009 3:00:17 PM IST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to FAILED>
<Nov 3, 2009 3:00:17 PM IST> <Error> <WebLogicServer> <BEA-000383> <A critical service failed. The server will shut itself down>
<Nov 3, 2009 3:00:17 PM IST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to FORCE_SHUTTING_DOWN>
If anyone knows the solution ,please help us out.Thanx in advance.
I was really happy to get reply yesterday from "mv".I was not expecting such instant response.Thanx all guys for your interest and support.
I have solved this issue.
We have weblogic 9 on unix env.
Following steps which I followed:
#generate private key
keytool -genkey -v -alias uinbrdcsap01_apac_nsroot_net -keyalg RSA -keysize 1024 -dname "CN=linuxbox042, OU=ASIA, O=Citigroup, L=CALC, S=MH, C=IN" -validity 1068 -keypass "webconkeystorepassword" -keystore "cwebconkeystore"
#generate csr
keytool -certreq -v -alias uinbrdcsap01_apac_nsroot_net -file linuxbox042.csr -keypass "webconkeystorepassword" -keystore "cwebconkeystore" -storepass webconkeystorepassword
Then we uploaded this csr on verisigns free ssl certificate to generate and receive certificate text.
We copied that text file in "ert4nov2009.crt" rt file used below.
Apart from that , mail which we received from verisign also contains links to download root ca certificate and intermediate ca certificate.We downloaded them.
roo ca in "root4nov2009.cer" file.
intermediate ca in "intermediateca4nov2009.cer"
both these files used in
#import root certificate
keytool -import -alias rootca -keystore "cwebconkeystore" -storepass "webconkeystorepassword" -trustcacerts -file "root4nov2009.cer"
#import intermediate ca certificate
keytool -import -alias intermediateca -keystore "cwebconkeystore" -storepass "webconkeystorepassword" -trustcacerts -file "intermediateca4nov2009.cer"
#install free ssl certifiate
keytool -import -alias uinbrdcsap01_apac_nsroot_net -file "cert4nov2009.crt" -trustcacerts -keypass "webconkeystorepassword" -keystore "cwebconkeystore" -storepass "webconkeystorepassword"
#after this admin configuration
In weblogic admin console module, we did following settings:-
1. under Configuration tab
a. Under KeyStore tab
For keystore , we selected "Custom identity and Custom Trust"
Under Identity,
Custom Identity Keystore:location of keystore "webconkeystore" on weblogic server
Custom Identity Keystore Type: JKS
Custom Identity Keystore Passphrase:password for keystore mentioend above.In our case, webconkeystorepassword
Same we copied Under "Trust", as we have not created separate keystore for trust.
Save setting.
b. Under SSL tab
Identity and Trust Locations: select "Keystores"
Private Key Alias: alias used while creating private keyi.e. in our case "uinbrdcsap01_apac_nsroot_net"
Save setting.
c. Under General tab
Check checkbox "SSL Listen Port Enabled"
and mention ssl port "SSL Listen Port"
Save setting.
After this activate changes.You might see error on admin module.
Using command prompt, stop the server and again restart and then try to access using https and port ...
you will definately get output...
in our case issue might be due to key size..we used 1024 key size ..it solve problem.
for your further reference plz find link below..it is also helpful.
http://download.oracle.com/docs/cd/E13222_01/wls/docs81/plugins/nsapi.html#112674 -
How to store the certificate file by using import java.security package?
Hi,
I have a certificate file whose extension is .p12(So, it conforms to pkcs 12 standart).
I wanna store this file which is in my file system in my pc. and I wann to store this file to smart card?
// this two row just load the specified file
KeyStore keyStore = KeyStore.getInstance("PKCS12");
keyStore.load(new java.io.FileInputStream(pkcs12File), keyPassword);
// I need to store keyStore object to smart card. but I do not know how to? Any idea????This is not adding external p12 f�le inside the smart card ? Am I right? I want a p12 f�le to add this this file to smart card indside
-
How to PrivateKey from Certificate or keystore
Hello,
I need to get a PrivateKey from my keystore, but neither of my attempts below were successful.
Any thoughts on how I can get around this?
Thanks
// this part appears to be working
KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
ks.load(ksbufin, ksPassword.toCharArray());
Certificate privCert = ks.getCertificate(ksPrivAlias);
PublicKey pubKey = privCert.getPublicKey();
The following two approaches fails:
PrivateKey privKey = (PrivateKey) ks.getKey(ksPrivAlias, ksPassword.toCharArray ());
privKey in this case is null.
I also tried:
KeyStore.PrivateKeyEntry pkEntry = (KeyStore.PrivateKeyEntry)ks.getEntry (ksPrivAlias, new KeyStore.PasswordProtection(ksPassword.toCharArray ()));
PrivateKey privKey = pkEntry.getPrivateKey();
Here I get the following exception:
java.lang.UnsupportedOperationException: trusted certificate entries are not password-protected
at java.security.KeyStoreSpi.engineGetEntry(KeyStoreSpi.java:438)
at java.security.KeyStore.getEntry(KeyStore.java:1218)
at ..AuthenticateImpl.createSignature(AuthenticateImpl.java:179)enderw wrote:
Hello,
I need to get a PrivateKey from my keystore, but neither of my attempts below were successful.
Any thoughts on how I can get around this?
Thanks
// this part appears to be working
KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
ks.load(ksbufin, ksPassword.toCharArray());
Certificate privCert = ks.getCertificate(ksPrivAlias);
PublicKey pubKey = privCert.getPublicKey();I hope that your use of the prefix 'priv' is just a misnomer because certificates have nothing to do with 'private', they are always 'public'.
>
The following two approaches fails:
PrivateKey privKey = (PrivateKey) ks.getKey(ksPrivAlias, ksPassword.toCharArray ());There is no keystore key entry with the name referenced by ksPrivAlias. What makes you think there is a private key with that alias?
>
privKey in this case is null.
I also tried:
KeyStore.PrivateKeyEntry pkEntry = (KeyStore.PrivateKeyEntry)ks.getEntry (ksPrivAlias, new KeyStore.PasswordProtection(ksPassword.toCharArray ()));
PrivateKey privKey = pkEntry.getPrivateKey();
Here I get the following exception:
java.lang.UnsupportedOperationException: trusted certificate entries are not password-protected
at java.security.KeyStoreSpi.engineGetEntry(KeyStoreSpi.java:438)
at java.security.KeyStore.getEntry(KeyStore.java:1218)
at ..AuthenticateImpl.createSignature(AuthenticateImpl.java:179)It looks to me like the alias you are providing is that of a certificate and not a private key. -
How to add record in Qualified table using MDM Java API
Hi experts,
I am trying to add a record into a Table.
but I am facing the problem in setFieldValue method.
//Getting Field-ID to pass in setFieldValue() method.
FieldId[] fields = new FieldId[6];
fields[0] = repSchema.getFieldId("GTINs", "Description");
fields[1] = repSchema.getFieldId("GTINs", "Unit_Descriptor");
fields[2] = repSchema.getFieldId("GTINs", "GTIN");
fields[3] = repSchema.getFieldId("GTINs", "Alternate_Item_Classifications");
fields[4] = repSchema.getFieldId("GTINs", "Country_Of_Origin");
fields[5] = repSchema.getFieldId("GTINs", "Bar_Coded");
Record rec = RecordFactory.createEmptyRecord(mainTableId);
rec.setFieldValue(fields, );
but I am not getting how to assign the value to these fields using MDMvalue Interface.
Can anyone provide me the code sample or Code flow so that I can do this.
Plz help me it'll be great help for me.
Thanks
Tarun
Edited by: Tarun Sharma on Feb 4, 2008 11:39 AM
==========================================================================================
Hi Gurus
I found the way to add the MDMValue in setFieldValue Method.
we can set like this:
setFieldValue(<fieldId object like fieldId[], <MdmValue like this> new StringValue("ABC"));
Now I am facing problem in adding value to lookup flat table.
According to the setFieldValue method we can assign the loookup like this:
setFieldValue(<fieldId[0]>, new LookpValue(<here we have to pass the recordID of lookup table>);
so I want to know how I can pass the recordId of lookup table here.
Please suggest.
Thanks
Tarun Sharma
Edited by: Tarun Sharma on Feb 4, 2008 3:15 PM
Edited by: Tarun Sharma on Feb 4, 2008 3:25 PM
Edited by: Tarun Sharma on Feb 8, 2008 6:58 PMHi Andrea,
I tried your suggestion but now i am getting Type Mismatch Error.
Please suggest me what I can do?
//TableId for Lookup[Flat].
TableId lookupTableId = repSchema.getTableId("Return_Goods_Policies");
FieldId[] ReturnGoodsPolicyTableIdFields = new FieldId[1];
ReturnGoodsPolicyTableIdFields[0] = repSchema.getFieldId("Return_Goods_Policies", "Name");
Record recLookup = RecordFactory.createEmptyRecord(lookupTableId);
try{
recLookup.setFieldValue(ReturnGoodsPolicyTableIdFields[0], new StringValue("New_Brand"));
}catch(Exception ex){
System.out.println(ex);
//Creating Record in Qualified Table - Request Details
CreateRecordCommand createLookupcommand = new CreateRecordCommand(simpleConnection);
createLookupcommand.setSession(session);
createLookupcommand.setRecord(recLookup);
createLookupcommand.execute();
//Getting the recordId of Lookup record.
RecordId lookupRecordId = createLookupcommand.getRecord().getId();
//Table Id for Qualified table.
TableId qualifiedTableId = repSchema.getTableId("Ext_Hardlines");
FieldId[] ExtHardlinesFields = new FieldId[3];
ExtHardlinesFields[0] = repSchema.getFieldId("Ext_Hardlines", "Name");//Text
ExtHardlinesFields[1] = repSchema.getFieldId("Ext_Hardlines", "Pieces_Per_Trade_item");//Integer
ExtHardlinesFields[2] = repSchema.getFieldId("Ext_Hardlines","Return_Goods_Policy");
Record recQualified = RecordFactory.createEmptyRecord(qualifiedTableId);
try{
recQualified.setFieldValue(ExtHardlinesFields[0], new StringValue("Qualified Value"));
recQualified.setFieldValue(ExtHardlinesFields[1], new StringValue("Qualified Description"));
recQualified.setFieldValue(ExtHardlinesFields[2], new LookupValue(lookupRecordId));
}catch(Exception ex){
System.out.println(ex);
//Creating Record in Qualified Table - Request Details
CreateRecordCommand createQualifiedCommand = new CreateRecordCommand(simpleConnection);
createQualifiedCommand.setSession(session);
createQualifiedCommand.setRecord(recQualified);
createQualifiedCommand.execute(); I am getting this Type match here, but i m not getting what mistake i did.
RecordId qualifiedRecordId = createQualifiedCommand.getRecord().getId();
//Adding to Main Table
TableId mainTableId = repSchema.getTableId("GTINs");
FieldId[] gtinsFields = new FieldId[1];
gtinsFields[0] = repSchema.getFieldId("GTINs","Ext_Hardlines");
Record recMain = RecordFactory.createEmptyRecord(mainTableId);
//Adding the new record to Qualifed Lookup value and setting the Yes Qualifiers
QualifiedLookupValue qualifiedLookupValue = new QualifiedLookupValue();
qualifiedLookupValue.createQualifiedLink(qualifiedRecordId);
try{
recMain.setFieldValue(gtinsFields[0], new QualifiedLookupValue(qualifiedLookupValue));
}catch(Exception ex){
System.out.println(ex);
CreateRecordCommand createCmd = new CreateRecordCommand(simpleConnection);
createCmd.setSession(session);
createCmd.setRecord(recMain);
createCmd.execute();
Could you help me out?
Thanks
Tarun
Maybe you are looking for
-
OSS, vmix and AC3 pass through
I've been battling OSS for a few weeks now. I have an ALC889 motherboard chip, and oss-mercurial 4.1-3 package (from AUR installed). - Vmix works fine, goes through my optical jack out to my receiver, most apps and sounds play through fine, except fo
-
.PDF file transfer(SAP XI ) along with file name to SAP R3
I would like to transfer a .PDF file along with its file name to target system.I need to have target structure like, <Target> <field1> <Field2> /Target> Field1should be mapped to file name( i can do this by using dynamic configuration and a
-
Hi I have msi Mega stick 128 and it is not working. When I turn on my MSI there is an eror. On screen is a message "MEDIA EROR"! After a five seconds it automaticlu shut-down. Please help me to fix this problem! TAHNKS!!!!!!!!!!!!
-
ABAP Query insterting 'NO' on output
Hi Gurus! I've created an ABAP Query which reads various Infotypes in HR. There are screen modifications which hide\display certain fields on Infotypes depending on the Country Grouping. However, on my Query, when I run for a Country for which a fiel
-
CR 2008 report not displaying until Group Tree clicked
We are having an issue with our CR 2008 web based reports. The reports run correctly locally, but not when launched from a Windows 2008 Server on which we installed Crystal Reports 2008 Fix Pack 3.3 - Redist Install. This is a web based application