How to apply security paramters in a main program to interact with webservi

Hi ,
I am working with weblogic 10.1.3 and running build.xml in eclipse for EE
I would like to know the steps to include security parameters to authenticate with weblogic server and call webservice
I have written a build.xml that takes input as wsdl , When I run the build.xml it generates
all the necessary stubs and interfaces
I have written a main program that imports generated classes and invoke the webservice method
below are buidl.xml and two classes( main program and one java class) which I used to invoke webservice
Build.xml
=====
<project name="webservices-simple_client" default="all">
     <!-- set global properties for this      -->
     <property name="wls.hostname" value="localhost" />
     <property name="wls.port" value="8002" />
     <property name="example-output" value="output" />
     <property name="clientclass-dir" value="${example-output}/srcclasses" />
     <property name="clientclassfiles-dir" value="${example-output}/classfiles" />
     <path id="client.class.path">
          <pathelement path="${clientclass-dir}" />
          <pathelement path="${java.class.path}" />
     </path>
     <taskdef name="clientgen" classname="weblogic.wsee.tools.anttasks.ClientGenTask" />
     <target name="clean">
          <delete dir="${clientclass-dir}" />
          <delete dir="../src/com/bea/wlcp/wlng/ws/presence" />
          <delete dir="../src/org/csapi/schema/paralyx/common/v2_1" />
          <delete dir="../src/org/csapi/schema/paralyx/presence/consumer/v2_3/local" />
          <delete dir="../src/org/csapi/schema/parlayx/presence/v2_3" />
          <echo message="Cleaning Completed" />
     </target>
     <target name="build-client">
          <clientgen wsdl="http://${wls.hostname}:${wls.port}/parlayx21/presence/PresenceConsumer?WSDL" destdir="${clientclass-dir}" generatepolicymethods="true" packageName="com.bea.wlcp.wlng.ws.presence" />
          <javac srcdir="${clientclass-dir}" destdir="${clientclassfiles-dir}" includes="**/*.java" />
          <copy overwrite="true" todir="../src">
               <fileset dir="${clientclass-dir}" />
          </copy>
          <copy overwrite="true" todir="../src">
               <fileset dir="${clientclassfiles-dir}" />
          </copy>
          <delete dir="${clientclass-dir}" />
          <delete dir="${clientclassfiles-dir}" />
          <echo message="Building Completed" />
     </target>
     <target name="all" depends="clean,build-client" />
</project>
======================================================
import java.net.URI;
import javax.xml.rpc.Stub;
import javax.xml.ws.BindingProvider;
import java.net.Proxy;
import java.net.InetSocketAddress;
import java.util.ArrayList;
import java.util.List;
import weblogic.webservice.wsdl.WsdlPort;
import weblogic.wsee.connection.transport.http.HttpTransportInfo;
import weblogic.wsee.jaxrpc.ServiceImpl;
import org.csapi.schema.parlayx.common.v2_1.PolicyException;
import org.csapi.schema.parlayx.common.v2_1.SimpleReference;
import org.csapi.schema.parlayx.presence.consumer.v2_3.local.SubscribePresence;
import org.csapi.schema.parlayx.presence.consumer.v2_3.local.SubscribePresenceResponse;
import com.bea.wlcp.wlng.et.core.module.session_manager.GTUsernameTokenPolicy;
import com.bea.wlcp.wlng.et.core.module.session_manager.SessionManagerService_Impl;
import com.bea.wlcp.wlng.ws.presence.PresenceConsumer;
import com.bea.wlcp.wlng.ws.presence.PresenceConsumerService_Impl;
import com.bea.wlcp.wlng.ws.sessionmanager.SessionManager;
import com.bea.wlcp.wlng.ws.sessionmanager.SessionManagerService;
import weblogic.wsee.security.unt.ClientUNTCredentialProvider;
import weblogic.xml.crypto.wss.WSSecurityContext;
import weblogic.xml.crypto.wss.provider.CredentialProvider;
@SuppressWarnings("deprecation")
public class Main {
     @SuppressWarnings("unchecked")
     public static void main(String[] args) throws javax.xml.rpc.ServiceException,PolicyException{
     try{
     /*PresenceConsumerService_Impl pcs_impl = new PresenceConsumerService_Impl("http://localhost:8002/parlayx21/presence/PresenceConsumer?WSDL");
     PresenceConsumer pc = (PresenceConsumer) pcs_impl.getPresenceConsumer();
     UserCredentialsvalidation gt = new UserCredentialsvalidation("sdpai","sdp");*/
     SimpleReference rf = new SimpleReference();
     rf.setCorrelator("correlatorid");
     rf.setEndpoint(URI.create("http://localhost:8002/PresenceConsumerService/services/PresenceConsumer"));
     rf.setInterfaceName("PresenceConsumer");
     SubscribePresence sb = new SubscribePresence();
     sb.setApplication("sdp");
     sb.setPresentity(URI.create("tel:1234"));
     sb.setReference(rf);
     System.out.println(" Before calling subscribe presence ==" );
     //SubscribePresenceResponse spr = pc.subscribePresence(sb);
     System.out.println(" Hi There here 2226678565");
     System.out.println(" Hi There here 333");
     //raja
     String strUrl = "http://localhost:8002/parlayx21/presence/PresenceConsumer?WSDL";
     Stub objStub = (Stub) new PresenceConsumerService_Impl().getPresenceConsumer();
     objStub._setProperty(javax.xml.rpc.Stub.USERNAME_PROPERTY,"sdpai");
     objStub._setProperty(javax.xml.rpc.Stub.PASSWORD_PROPERTY,"sdp");
     objStub._setProperty(javax.xml.rpc.Stub.ENDPOINT_ADDRESS_PROPERTY,strUrl);
     PresenceConsumer port = (PresenceConsumer) objStub;
     String returnVal = "";
     System.out.println(" Hi There here 77");
     SubscribePresenceResponse spr = port.subscribePresence(sb);
     System.out.println(spr);
     //ended here
          catch(Exception e)
               e.printStackTrace();
=======================================
UserCredentialsvalidation.java
import com.bea.wlcp.wlng.et.core.module.session_manager.SessionManagerService_Impl;
import com.bea.wlcp.wlng.schema.ews.common.ServiceException;
import com.bea.wlcp.wlng.ws.sessionmanager.SessionManager;
import com.bea.wlcp.wlng.ws.sessionmanager.SessionManagerService;
import weblogic.wsee.security.unt.ClientUNTCredentialProvider;
import javax.xml.rpc.Stub;
import java.util.ArrayList;
import java.util.List;
public class UserCredentialsvalidation implements PolicyBase {
     private String username;
     private String password;
     public UserCredentialsvalidation(String username, String password) {
          this.username = username;
          this.password = password;
          String sessionManagerURL="http://localhost:8002/session_manager/SessionManager";
          SessionManagerService accessservice = null;
          try {
          accessservice = (SessionManagerService) new SessionManagerService_Impl(sessionManagerURL+"?WSDL");
          SessionManager port = accessservice.getSessionManager();
          System.out.println(" port >>>>>");
          System.out.println(" port >>>>>" +port);
          UserCredentialsvalidation pbase = new UserCredentialsvalidation();
          pbase.prepareStub((Stub)port,username,password);
          } catch (Exception e) {
               System.out.println(" helo helo");
               // TODO Auto-generated catch block
               e.printStackTrace();
     public UserCredentialsvalidation() {
          // TODO Auto-generated constructor stub
     public void prepareStub(Stub stub,String username,String password) throws Exception {
          List<ClientUNTCredentialProvider> credProviders = new ArrayList<ClientUNTCredentialProvider>();
          System.out.println(" username >>> " + username.getBytes());
          System.out.println(" password >>> " + password.getBytes());
          credProviders.add(new ClientUNTCredentialProvider(username.getBytes(),
                    password.getBytes()));
          System.out.println("setting standard wssec");
          stub._setProperty("weblogic.wsee.security.wss.CredentialProviderList",
                    credProviders);
          System.out.println("Getting property from stub== " + stub._getProperty("weblogic.wsee.security.wss.CredentialProviderList"));
     @Override
     public void prepareStub(Stub port) throws Exception {
          // TODO Auto-generated method stub
=========================================
When I run the main program I am getting below exception
Before calling subscribe presence ==
Hi There here 2226678565
Hi There here 333
Hi There here 77
java.rmi.RemoteException: SOAPFaultException - FaultCode [{http://schemas.xmlsoap.org/soap/envelope/}Server] FaultString [Unable to add security token for identity] FaultActor [null]No Detail; nested exception is:
     weblogic.wsee.jaxrpc.soapfault.WLSOAPFaultException: Unable to add security token for identity
     at com.bea.wlcp.wlng.ws.presence.PresenceConsumer_Stub.subscribePresence(PresenceConsumer_Stub.java:37)
     at Main.main(Main.java:62)
Caused by: weblogic.wsee.jaxrpc.soapfault.WLSOAPFaultException: Unable to add security token for identity
     at weblogic.wsee.codec.soap11.SoapCodec.decodeFault(SoapCodec.java:355)
     at weblogic.wsee.ws.dispatch.client.CodecHandler.decodeFault(CodecHandler.java:115)
     at weblogic.wsee.ws.dispatch.client.CodecHandler.decode(CodecHandler.java:100)
     at weblogic.wsee.ws.dispatch.client.CodecHandler.handleFault(CodecHandler.java:88)
     at weblogic.wsee.handler.HandlerIterator.handleFault(HandlerIterator.java:309)
     at weblogic.wsee.handler.HandlerIterator.handleResponse(HandlerIterator.java:269)
     at weblogic.wsee.ws.dispatch.client.ClientDispatcher.handleResponse(ClientDispatcher.java:213)
     at weblogic.wsee.ws.dispatch.client.ClientDispatcher.dispatch(ClientDispatcher.java:150)
     at weblogic.wsee.ws.WsStub.invoke(WsStub.java:87)
     at weblogic.wsee.jaxrpc.StubImpl._invoke(StubImpl.java:337)
     at com.bea.wlcp.wlng.ws.presence.PresenceConsumer_Stub.subscribePresence(PresenceConsumer_Stub.java:32)
     ... 1 more
Caused by: weblogic.xml.crypto.wss.WSSecurityException: Unable to add security token for identity
     at weblogic.wsee.security.wss.SecurityPolicyDriver.processIdentity(SecurityPolicyDriver.java:175)
     at weblogic.wsee.security.wss.SecurityPolicyDriver.processOutbound(SecurityPolicyDriver.java:73)
     at weblogic.wsee.security.WssClientHandler.processOutbound(WssClientHandler.java:71)
     at weblogic.wsee.security.WssClientHandler.processRequest(WssClientHandler.java:55)
     at weblogic.wsee.security.WssHandler.handleRequest(WssHandler.java:74)
     at weblogic.wsee.handler.HandlerIterator.handleRequest(HandlerIterator.java:141)
     at weblogic.wsee.handler.HandlerIterator.handleRequest(HandlerIterator.java:107)
     at weblogic.wsee.ws.dispatch.client.ClientDispatcher.dispatch(ClientDispatcher.java:132)
     ... 4 more
==========================================================
I am working for 3 days to solve this issue, but helpless :(
Please tell me I am going in right way , I read many forums and implemented different ways , but getting same problem, that too before calling webservice method .
Do i need to do anything more apart from adding username and password parameters
Please tell me the exact steps how to perform authentication with webservices
Your answer will help me a lot .
Thanks in Advance
Regards
Rajasekhar

Please ignore this thread

Similar Messages

  • I have a macbook pro from 2009 and the software is 10.5.8 how do i update it so i can have more interaction with the applications

    i have a macbook pro from 2009 and the software is 10.5.8 how do i update it so i can have more interaction with the applications

    Note some programs may not work with Lion or later
    Upgrading to 10.7 and above, don't forget Rosetta!

  • How to apply security to access procurement dashboard in RPD (BI Security)

    Hi All,
    How can I apply Security to access in RPD for Procurement dashboards only.
    Regards,
    Kumar
    Edited by: user597882 on Sep 13, 2009 2:20 AM

    Hi,
    If you want to apply security to a dashboard (object level security so that some people can see the dashboard and other can't), then you don't do this in the RPD but through the administration screens after logging into OBIEE. Here you can defined which webgroups can see a dashboard.
    Regards,
    Matt

  • How to apply security trimming control on Site Action (Gear) in SharePoint 2013?

    I want to apply security trimming control on Site Action (Gear) & change the position of the welcome control, but I am not able to find Site Action delegate control and welcome control in seattle.html or seattle.master page.
    Can you please let me know how to find Site Action & Welcome control?
    Thanks
    G Goyal

    If you would like to implement security trimming on site action through custom code then following could help you,
    In your visual studio project create a class which implements System.Web.UI.WebControls.WebControl. In the
    CreateChildControls Method you could get the FeatureMenuTemplate control which is SharePoint’s
    WelcomeMenuTemplate.
    After creating control, you could add it as an menu item into your site action menu using a
    customaction xml.  
    You could get the child controls from this and can remove them as required.
    Note: using this approach, if you have User profile service running then it will not remove the “About Me” link. But if you have forms authentication enabled then you could change your logic to remove this link.
    Hope I have contributed to your issue.

  • How to Apply Security or Remove in Batch using Acrobat X

    I’m using Acrobat X Pro. I’ve used Acrobat Pro 6-9. I need to remove security in batch and apply security to about 100 PDFs. I’m totally lost in Acrobat X. Where are all of the batch sequence commands that were in Acrobat 9? Can anyone point me to an article or tutorial on batch sequences and the new “Action Wizard”.
    Thanks.

    ---UPDATE:
    Found my answer! http://answers.acrobatusers.com/ViewQuestion.aspx?questionid=16649
    Basically, you have to change Acrobat's preferences (edit --> Preferences --> Action Wizard) to prompt for a password by default. That way, it can actually access the PDFs you're trying to work with.
    Ye olde message:
    So, I have the same goal (mass decrypt some PDFs), but a different problem.
    If I have a step saved in the Action Wizard to "encrypt" the PDFs, with the security method set to "none." I have a bunch of PDFs with encryption on, but no password saved.
    However, when I run the process, it doesn't actually remove the encryption.

  • How to apply security to pdf document

    Hi,
               we want to implement a plug-in in which we should apply new security settings to the pdf.
               To get security settings from user we are using  AVCryptDoStdSecurity function. from that we are able to get security settings. but next we want to set those security to the pdf.           For that we tried PDDocSetNewSecurityData function, but it is not setting, application crashes. what is the problem here, and how to set SecurityData to pdf.
    thank you,

    PDDocSetNewSecurityData should work.
    Can you post the part of your code how  you are applying new security settings?

  • How to apply Security Patch

    How do I apply the "DOS Attack" security patch for WLS 6.1 on Win2K
    Please help
    Thanks

    Balram,
    Put the jar file in the front of your classpath to apply the patch.
    Regards,
    Michael
    Stephane Kergozien wrote:
    Hi Balram,
    You will find security patches for WLS 6.1 in the following URL
    http://dev2dev.bea.com/index.jsp
    advisories and notifications Paragraph
    Regards
    Stephane
    Balram wrote:
    How do I apply the "DOS Attack" security patch for WLS 6.1 on Win2K
    Please help
    Thanks--
    Regards,
    Stephane Kergozien
    BEA Support--
    Michael Young
    Developer Relations Engineer
    BEA Support

  • I urgently need to find out how to apply behaviour to images in my webpage. Created with dreamweaver and linked J Query stylesheets.

    I have created a web page with a photo gallery of thumbnails that link to bigger images when you hover over them. When the bigger image opens there is an odd shape at the bottom right hand side , that when pressed, will take me back to the home page. But its not the correct sought of button or symbol. I dont know how to set this up properly. I have linked J.Query style sheets. But must have missed something. Can anyone help??? this is my first web page design. It is all done except for this.

    Very sensible advice. However, the second sentence in the following statement is incorrect:
    1.  Make sure that you have updated all recordsets to the latest (CS4) version. Older ones created before the GetSQLValueString function was introduced are vulnerable.
    The GetSQLValueString() function has always existed in Dreamweaver server behavior code. However, versions of this function prior to Dreamweaver 8.0.2 are vulnerable to SQL injection.
    Unfortunately, you can't update older server behaviors simply by deleting the old version of the function and replacing it with one from DW 8.0.2 or later. Other small changes were made in the server behavior code for compatibility with the revised function. PHP server behaviors created prior to DW 8.0.2 need to be deleted and rebuilt. Yes, it's a pain, but far less of a pain than being hacked.

  • How to apply patch for MSAHH02_0-10003081.ZIP( xMSA FOR HH (WITH CRM) 5.0 S

    Hi All,
    I am working on xapps for Mobile to implement CRM mobile sales for handheld using  CRMHH 5.0. For that I am using the WAR file MSAHH02_0-10003081.ZIP( xMSA FOR HH (WITH CRM) 5.0 SR02 ) available on SAP marketplace.
    Now I want to apply the patch available for the same i.e. MSAHH02P_4-10003081.ZIP(Patch for MSA FOR HH (WITH CRM) 5.0 SR02 )
    Can anyone please tell the  procedure to apply the patch.
    Thanks & Regards
    Sumit

    HI
    For latest patches you can check at
    http://service.sap.com/swdc -> Support Packages and
    Patches -> Entry by application -> Application Components
    -> SAP ERP -> ERP2004 -> SAP ECC Server
    There are two kinds of kernal files:
    SAPDBEXE and SAPEXE,one is DB dependent and one file is DB independent.
    For downloading the kernal patch:Follow the below path as per your OS and DB combination
    for downloading a kernel patch
    go through following
    service.sap.com/swdc
    downloads-> SAP Support packages -> My Company's Application Components -> SAP KERNEL 32 bit ->SAP KERNEL 4.6D 32-BIT ->SAP KERNEL 4.6D 32-BIT->Windows Server on IA32 32bit -> Select ur database->Windows Server on IA32 32bit
    Reward suitable points

  • How to apply a picture of human face onto spherical surface with 3D tools?

    I’m learning Photoshop CS5 3D features and looking for guidance/steps for the following task:
    With the 3D set of  tools, to create a sphere with shiny surface and apply (paste?)  on this spherical surface a photo of human face.
    I need to do it in such a way that the human face following the spherical surface  will get appropriately distorted by shape of the sphere.
    I've tried to do this with the help of Pshop manual but did not manage- I'm too new to this 3D features,sorry...
    No video tutorials, please - I need just to read the material and follow .
    Can someone skilled in Photoshop CS5 3D tools , please, help me with this task?
    Thank you in advance!

    Gloria,
    1.— Bold type is harder to read on screen,  Try to use it only sparingly to add emphasis to a word or concept only.  Thank you.
    GloriaMo wrote:
    …apply (paste?)  on this spherical surface…
    2.— If you used email to post your question, please be advised that you cannot upload an image to the forum by email.  It will just disappear into cyberspace and no one will be able to see it.  These forums are designed primarily to be accessed by a web browser through their web interface, not by email.  Another disadvantage of email is that you will never see the edits other make to their posts, so it will be easier for you to be misled when someone corrects an error contained in their original reply and the correction(s) they make will not reach you by email.
    To embed an image in your post, you need to be signed in to the forum and use the camera icon in the Reply Editor of the web interface of the forum.
    Thank you.
    Wo Tai Lao Le
    我太老了

  • How to find the name of the main program in the SM35

    Hi all,
    I have problems to find which program a batch input belongs to: may I explain myself...I can see in transaction SM35 several session names but no trace of the name of the program which is being used...I tried to find it with table APQI but no results so far. Does anyone know how can I get this information?
    Thanks a lot!

    Check table TBTCP
    Regards,
    Rich Heilman

  • How to Load Photoshop 5.0 LE & other programs on PC with Windows 7?

    I have had such a problem, but found the answer in here. Where there might be another
    way that works at times, the only way I found was given by Financetech back in 2011.
    His answer was the following:
    "you can copy across an old XP installation.
    On an XP machine copy the Photoshop 5.0 LE program folder from C:\Program\Adobe onto a USB stick. Then also copy the all the DLLs from C:\Windows (there are usually 6 or so), and also copy pcdlib32.dll from C:\Windows\system32.
    On the Windows 7 machine copy the Photoshop 5.0 LE folder from the USB stick across to C;\Program Files and also drop all the DLLs into the Photoshop folder.
    On the Windows 7 machine in the Photoshop folder right click on photosle.exe and choose Properties -
    Compatibility tab and then choose "Run this program in compatibility mode for Windows XP (service pack 3).
    John"
    Well, after trying several other methods I had found, this one was the only way it worked. BUT .... it also worked
    well on a program that was designed to be used in Windows for Workgroups, 3.11. Long before Win 95 came around.
    That was the last 16 bit OS of Windows where a user had absolute control over his computer. DOS was NOT
    inside Windows as it is today. DOS (being Disk Operating System that makes a PC work) was a separate loaded
    program before Windows was installed. One could even fix his computer by going to DOS if his PC crashed and
    would not let it open. In DOS the PC could be 'fixed'. Even some of the garbage that MS puts in their OS's could
    be removed without causing harm to the OS. Today, if Windows doesn't come up, neither will the DOS.
    Anyway, that old 16 bit program did load, and does work now in Windows 7 using the above method. Since XP was
    a 32 bit OS, many 16 bit applications would load in it. Not all, but many. So, if your 16 bit program will load into
    Win 95, 98, 2000, and XP, you can load it in Win 7.
    I copied the instructions to keep on hand in a file so that I will be able to help others who do not get into this forum.
    (Maybe also due to the fact that I forget a lot these days.)
    Dave.

    no, you don't have to remove those files.

  • How to increase the input gain within the program not just with hardware?

    Im guessing its probably the simplest thing Ive just overlooked,but can you increase the gain within the program its self. Ive just been doing it with my interface and I cant always get the amount I want.Any help would be great.Thanks

    As I understand, you'd like to record things louder than they appear on your audio interface input, don't you? This is not possible at all. But you can make it louder after recording and this can be done in several ways:
    1. Move the fader up (you can add 6db this way)
    2. Add the helper plugin Gain - this way you can add additional dbs
    3. Add any EQ plugin, they always have a gain fader but remember, EQs usually add some colour to the sound even if no other parameters are altered.
    The above were the ways to increase the voulme without altering the soundfile itself, the following alter the soundfile:
    4. doubleclick the file and it will appear in the sample editor. Now you can use 'normalize' to max the volume, you can use 'audio energizer' to make it louder but also to change the character.
    Hope this helps.
    EDIT
    If your audio interface has its own mixer which comes BEFORE the signal gets into your sequencer then you can increase the volume there. But I guess this is not your case.
    Message was edited by: samplaire
    Message was edited by: samplaire

  • How to create a modal dialog, which I can still interact with document when the dialog is show.

    HI,
        Now, I am developing an automation plugin, and want to create a modal dialog, which I still can interact with document when the dialog is show.
        I find photoshop has some modal dialog have this function, such as the dialog of Customize Proof Condition and the dialog of Color Settings. Are these dialogs not modal dialog?
         Thanks!

    The whole point of a modal dialog is that you cannot interact with other things while it is active.
    And Photoshop does not support plugins accessing the rest of Photoshop while any plugin UI is active.

  • How to install Security Patches.

    Could some one please update me.
    How to apply Security patches to 11i environment.
    If you are aware link that explains, Please post.
    JJ.

    There is a path application utility in 11i.
    You would require a metalink username and password to automatically apply patches. If you look careful in the OAM - Oracle Application Manager / Management Console after you login to an instance as sysadmin

Maybe you are looking for