How to specify a policy file in a WS client (AXIS2)

I am trying to access a dot net web service and i want to make use of the policy file they gave me. i read that AXIS2 supports WS-Policy in the client side but i still can not figure out how to tell the client to use the file. I searched thouroghly for examples and searched through diffirent forums with no success. I found only similar questions with no answer. if somebody could help it would be appreciated.
Thank you

We you codegen a Policy annotated WSDL, the policies are get included in the stub. Hence you don't have to specify a separate Policy file.
But if you need to use a separate policy then you need to set them in the AxisDescription object that you use in the ServiceClient and OperationClient.
e.g.
ServiceClient serviceClient = new ServiceClient();
OperationClient operationClient = serviceClient
.createClient(ServiceClient.ANON_OUT_IN_OP);
FileInputStream fis = new FileInputStream("path-to-policy.xml");
Policy servicePolicy = PolicyEngine.getPolicy(fis);
AxisService axisService = serviceClient.getAxisService();
axisService.getPolicyInclude().setPolicy(servicePolicy);
If you need more information please repost this to [email protected] with a [AXIS2] subject prefix.

Similar Messages

  • How to specify a mapping file using annotations?

    Hi,
    i am trying to deploy a WebService (with annotations) on oc4j 10.1.3.1.0. but all i get is the following exception:
    07/03/13 12:41:52 oracle.j2ee.ws.common.tools.api.ValidationException: test.datamodel.SimpleObjectId - Duplicate type name "test.datamodel.SimpleObjectId" for Java type "{http://tdeer.de/services/internal/test/1_0}SimpleObjectId" found. To remove this error do not specify a single typeNamespace for all value types or specify a mapping file. This error could also be caused when an erroneous type has been used more than once.
    07/03/13 12:41:52      at oracle.j2ee.ws.common.processor.modeler.rmi.RmiModeler.buildModel(RmiModeler.java:247)
    07/03/13 12:41:52      at oracle.j2ee.ws.common.processor.config.ModelInfo.buildModel(ModelInfo.java:173)
    07/03/13 12:41:52      at oracle.j2ee.ws.common.processor.Processor.runModeler(Processor.java:72)
    07/03/13 12:41:52      at oracle.j2ee.ws.common.metadata.annotation.DeploymentGenerator$DeploymentCompileTool.run(DeploymentGenerator.java:200)
    07/03/13 12:41:52      at oracle.j2ee.ws.common.metadata.annotation.DeploymentGenerator.generateDeploymentArtifacts(DeploymentGenerator.java:131)
    07/03/13 12:41:52      at oracle.j2ee.ws.common.metadata.annotation.EJBWebServiceAnnotationParser.parseAnnotatedBean(EJBWebServiceAnnotationParser.java:165)
    07/03/13 12:41:52      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    07/03/13 12:41:52      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    07/03/13 12:41:52      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    07/03/13 12:41:52      at java.lang.reflect.Method.invoke(Method.java:585)
    07/03/13 12:41:52      at oracle.j2ee.ws.server.deployment.oc4j.WebServiceAnnotationListener.parseAnnotatedClass(WebServiceAnnotationListener.java:85)
    07/03/13 12:41:52      at com.evermind.server.ejb.AnnotationParser.notifyAnnotationListeners(AnnotationParser.java:201)
    07/03/13 12:41:52      at com.evermind.server.ejb.AnnotationParser.parseAnnotations(AnnotationParser.java:73)
    07/03/13 12:41:52      at com.evermind.server.ejb.EJBPackageDeployment.parseMetaData(EJBPackageDeployment.java:939)
    07/03/13 12:41:52      at com.evermind.server.ejb.EJBContainer.postInit(EJBContainer.java:832)
    07/03/13 12:41:52      at com.evermind.server.ApplicationStateRunning.initializeApplication(ApplicationStateRunning.java:217)
    07/03/13 12:41:52      at com.evermind.server.Application.setConfig(Application.java:413)
    07/03/13 12:41:52      at com.evermind.server.Application.setConfig(Application.java:314)
    07/03/13 12:41:52      at com.evermind.server.ApplicationServer.addApplication(ApplicationServer.java:1853)
    07/03/13 12:41:52      at oracle.oc4j.admin.internal.ApplicationDeployer.addApplication(ApplicationDeployer.java:512)
    07/03/13 12:41:52      at oracle.oc4j.admin.internal.ApplicationDeployer.doDeploy(ApplicationDeployer.java:196)
    07/03/13 12:41:52      at oracle.oc4j.admin.internal.DeployerBase.execute(DeployerBase.java:93)
    07/03/13 12:41:52      at oracle.oc4j.admin.jmx.server.mbeans.deploy.OC4JDeployerRunnable.doRun(OC4JDeployerRunnable.java:52)
    07/03/13 12:41:52      at oracle.oc4j.admin.jmx.server.mbeans.deploy.DeployerRunnable.run(DeployerRunnable.java:81)
    07/03/13 12:41:52      at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:298)
    07/03/13 12:41:52      at java.lang.Thread.run(Thread.java:595)
    07/03/13 12:41:52 Caused by: oracle.j2ee.ws.common.processor.modeler.rmi.InvalidParameterException: test.datamodel.SimpleObjectId - Duplicate type name "test.datamodel.SimpleObjectId" for Java type "{http://tdeer.de/services/internal/test/1_0}SimpleObjectId" found. To remove this error do not specify a single typeNamespace for all value types or specify a mapping file. This error could also be caused when an erroneous type has been used more than once.
    07/03/13 12:41:52      at oracle.j2ee.ws.common.processor.modeler.rmi.LiteralTypeModeler.addTypeName(LiteralTypeModeler.java:1249)
    07/03/13 12:41:52      at oracle.j2ee.ws.common.processor.modeler.rmi.LiteralTypeModeler.processClass(LiteralTypeModeler.java:290)
    07/03/13 12:41:52      at oracle.j2ee.ws.common.processor.modeler.rmi.LiteralTypeModeler.modelTypeLiteral(LiteralTypeModeler.java:235)
    07/03/13 12:41:52      at oracle.j2ee.ws.common.processor.modeler.rmi.LiteralTypeModeler.modelTypeLiteral(LiteralTypeModeler.java:181)
    07/03/13 12:41:52      at oracle.j2ee.ws.common.processor.modeler.rmi.LiteralTypeModeler.modelSubclasses(LiteralTypeModeler.java:1048)
    07/03/13 12:41:52      at oracle.j2ee.ws.common.processor.modeler.rmi.RmiModeler.buildModel(RmiModeler.java:210)
    07/03/13 12:41:52      ... 25 more
    The Stateless-SessionBean has one WebMethod with the following Signature:
    public Element getElement(TestObjectId1 pObjectId1, TestObjectId2 pObjectId2) throws RemoteException
    TestObjectId1 and TestObjectId2 have the same Superclass, SimpleObjectId.
    How to specify a mapping file using annotations?
    Thanks
    tdeer

    We you codegen a Policy annotated WSDL, the policies are get included in the stub. Hence you don't have to specify a separate Policy file.
    But if you need to use a separate policy then you need to set them in the AxisDescription object that you use in the ServiceClient and OperationClient.
    e.g.
    ServiceClient serviceClient = new ServiceClient();
    OperationClient operationClient = serviceClient
    .createClient(ServiceClient.ANON_OUT_IN_OP);
    FileInputStream fis = new FileInputStream("path-to-policy.xml");
    Policy servicePolicy = PolicyEngine.getPolicy(fis);
    AxisService axisService = serviceClient.getAxisService();
    axisService.getPolicyInclude().setPolicy(servicePolicy);
    If you need more information please repost this to [email protected] with a [AXIS2] subject prefix.

  • How to specify the database file path when create FDM application

    Dear All,
    How to specify the database file path (MSSQL) when create FDM application?
    Right now, all data file are placed in the D:\ . I want to specify the database files (log and mdf file) in other place. How to do it?
    Thanks.

    Where is the highS2.xml located on the disk? If you add it to your project you should set its Build Action to Content and its Copy To Output Directory to Always in Visual Studio:
    Please remember to close your threads by marking helpful posts as answer once your issue has been solved and then start a new thread if you have a new question.

  • So how to specify different answer file for different install images in WDS snap-in?

    hello
    in WDS snap-in, in properties on server name, on client tab, we can define an answer file for unattended windows installation on WDS clients.
    my question is, maybe we have added multiple images in WDS snap-in (win xp image, win 7 , win 2008,...)
    now this one answer file applies to all of them ?
    so how to specify different answer file for different install images in WDS snap-in?
    thanks in advanced 

    Under the "Client" tab of WDS, you should only use an answer-file with settings relevant for the installation. This would be credentials for the WDS deployment share, international settings used during the setup and possibly also destination drive
    details (if you want the installation to take care of partitioning the disk etc). The settings relevant for unattend-files used under "Client" would only be of those in phase 1 (WinPE).
    However, if you would like to have specific unattend file for every installation, e.g. Win7, Server 2008, Win 8 etc, you can browse to the image under "Install Images" under the image Groups. There you can select properties for every image and
    have a personal unattend-file.
    hi Joel
    very cool. thanks a lot, that really helped me.
    best regards

  • Jaas How to specify the config file

    Hi
    I'm working on a web app based on Sun's App Server 8. I am implementing security using a Jaas LoginModule. I cant figure out how i can specify the config file because if i make the change in the java.security file the server throws all sorts of exceptions....... i'm not sure how i can go about that..
    Thanks..

    Read the documentation. There are several different files that you can use to specifiy the handler to use for a particular context. One is ${user.home}/.java.login.config

  • How to override weblogic.policy file?

    Hi Friends,
    I am using weblogic9.2
    What are the steps to follow override the webloic.policy file to give the access permission on a particular file?
    I tried but its not working. The following steps are i did
    1. i added one entry in weblogic.policy that was
    grant codeBase "http://localhost/SampleServlet/-" {
    permission java.io.FilePermission "c:\\kathir\\ErrorReport.txt", "read";
    2.startWeblogic.cmd
    -Djava.security.manager -Djava.security.policy==%WL_HOME%\server\lib\weblogic.policy
    modified this entry.
    But its not working...
    please help me
    Thanks in advance

    It would help if you could provide a much higher level description of your use case.
    Example: A servlet needs to read an arbitrary file on the local file system. Explain the security behavior you would like to see, etc.

  • Signed applets called from javascript - how/where to load policy file?

    I'm running into some apparently well-known problems with signed applets accessing a client machine's hard drive.
    So, I can get things to work if I place the following two lines in my 'local' JDK installation:
    permission java.io.FilePermission "${user.home}/x.properties", "read,write";
    permission java.util.PropertyPermission "user.home", "read";These let me a) read the user's home directory and b) read/write a file that's located there.
    What I don't want to do is edit the java.policy file, but I'm having problems loading a separate policy file. The app server we run with our product is jetty, and I'm assuming I would be passing in the '-Djava.security.policy=='filename' with the other jetty start-up parameters- is this a correct assumption? And, what path do I give for the file, will I need to put it somewhere in the .war file we distribute, or in the JDK installation on the server? If it's on the server, will client machine's know about these extra rights?
    I'd REALLY appreciate any help I could get on this...
    thanks in advance,
    +0^^

    Maybe you didn't realize but my previous post was sarcastically ment:
    "hello SUN security stop bugging me in writhing this malicious program"
    and
    "hello SUN security, I'm a good boy now trust what I'm doing"
    Are in a practical sense exactly the same.
    SUN should either remove the stack check or the doprivileged. The stack check takes up
    valuable resources for nothing since a malicious program can easily circumvent that.
    Your post about a malicious user abusing your (CA) signed applet to ruine someone's
    system is correct, it would not be difficult. A CA signed applet will not even ask a user to
    trust or not. This is one of the reasons we have the usepolicy in affect, but this cannot be
    used on "grandma's old PC" since it's too complicated for users to do such things.
    YOU seem to be the one to blame, not the hacker! (The user accepted YOUR
    certificate!).Actually you are to blame, because you made software that exposes a vonurability
    other people can take advantage of.
    what you can do before calling the doprivileged private method is check the call stack.
    So your signed applet has a public method checking the callstack, if this lookes OK
    that method will call the private doprivileged method.
    Here is the example
    package t;
    import java.util.Properties;
    import java.applet.Applet;
    public class test extends Applet {
             public test(){
                   startingPrivileged();
             public void startingPrivileged(){
                   System.out.println("this is the stack");
                   try{
                        throw new Exception("get the call stack");
                   }catch(Exception e){
                        StackTraceElement stack[] = e.getStackTrace();
                        for (int i=0; i<stack.length; i++) {
                             System.out.println("file: " + stack.getFileName() + " method: " + stack[i].getMethodName() + " class: " + stack[i].getClassName() + " at " + new Integer(i).toString());
                        // this is a really simple check to see if this method was started from the t. package
                        // a good hacker can just create it's own package named t and take advantage of this method
                        // if this method was started from the same package there is no reason to make this method
                        // public, protected would work.
                        // there must be a better way to check if this method was called by "your" or "trusted" code
                        if(stack[1].getClassName().startsWith("t.")){
                             dosomePrivileged();
              private void dosomePrivileged(){
                   System.out.println("this is the method that does privileged stuff");
         public static void main(String args[]) {
              new test();

  • How to specify the download file name??

    Hi guys~~~
    I have servlet which can generate a *.pdf file,I found if I didn't setContentType="application/pdf",I can download it!!But the download file name is my servlet file name.If I want to change the download file name,How do I do????
    thanx a lot!!!Best regard!

    Thanx for ur help...But I encounter a new charllenge now...
    I use a javascript(window.open("/myservlet")) to open the download file servlet.
    Everything is okay.But when I finish downloading the file which window I opened cant close itself automatically.
    I am really not understand the header parameter of the HTML header,could someone give me something about this??
    Thanx again!!!!

  • How to Specify the Log File address as RootDir/Logs/Error.log in Log4j

    I have a web application,
    How to configure the log4j Rolling file Appender in that.
    I want to logs to be redirected to the RootDir/logs/Error.log.
    Currently, I m using following configuration:
    # This file must live on the classpath of the jvm
    # Set root logger level to DEBUG and log to both stdout and rollingFile appenders
    # (see below for their definitions)
    # The set of possible levels are: DEBUG, INFO, WARN, ERROR and FATAL
    log4j.rootLogger=INFO, stdout, R
    ####### Console appender ######
    log4j.appender.stdout=org.apache.log4j.ConsoleAppender
    log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
    # Pattern to output the caller's file name and line number.
    # The pattern: Date Priority (Filename:Line Number) - Message\n
    log4j.appender.stdout.layout.ConversionPattern=%d %-5p (%F:%L) - %m%n
    #### Second appender writes to a file
    log4j.appender.R=org.apache.log4j.RollingFileAppender
    log4j.appender.R.File=Error.log
    # Control the maximum log file size
    log4j.appender.R.MaxFileSize=100KB
    # Archive log files (one backup file here)
    log4j.appender.R.MaxBackupIndex=1
    log4j.appender.R.layout=org.apache.log4j.PatternLayout
    log4j.appender.R.layout.ConversionPattern=%d %-5p (%F:%L) - %m%n
    Thanks for your replies in advance.

    Please follow the following steps, will work.
    To enable log4j logging to a file on lunar pages do the following:
    1) Create a servlet class that will initialize log4j. Here is
    the code:
    package logging;
    import org.apache.log4j.PropertyConfigurator;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    public class Log4jInit extends HttpServlet {
    public
    void init() {
    String prefix = getServletContext().getRealPath("/");
    String file = getInitParameter("log4j-init-file");
    // if the log4j-init-file is not set, then no point in trying
    if(file != null) {
    PropertyConfigurator.configure(prefix+file);
    public
    void doGet(HttpServletRequest req, HttpServletResponse res) {
    2) In your web.xml file add the following entry:
    <servlet>
    <servlet-name>log4j-init</servlet-name>
    <servlet-class>logging.Log4jInit</servlet-class>
    <init-param>
    <param-name>log4j-init-file</param-name>
    <param-value>WEB-INF/classes/log4j.lcf</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
    </servlet>
    3) Create a log4j.lcf file located in your WEB-INF/classes directory
    as with the following entries:
    log4j.rootLogger=debug, R
    # yourdirectory below is where your site lives.
    log4j.appender.R=org.apache.log4j.RollingFileAppender
    log4j.appender.R.File=/home/yourdirectory/public_html/logs/out.log
    log4j.appender.R.MaxFileSize=500KB
    # Keep one backup file
    log4j.appender.R.MaxBackupIndex=1
    log4j.appender.R.layout=org.apache.log4j.PatternLayout
    log4j.appender.R.layout.ConversionPattern=%d %-5p [%c] %m%n
    4) Add logging to your class. Here is an example:
    import org.apache.log4j.Logger;
    public class Example {
    static Logger logger = Logger.getLogger(Example.class);
    public void doSomething() {
    logger.debug("testing logging");
    5) make sure you have the log4j-1.2.8.jar file located in your WEB-INF/lib directory.
    That should do it!

  • How to specify term file when using static html to run webforms 10g

    I'm using static HTML to run forms
    document.writeln('<PARAM NAME="serverArgs" ');
    document.writeln(' VALUE="escapeParams=true module=genoa.fmx userid= sso_userid=%20 sso_formsid= sso_subDN= sso_usrDN= debug=no host= port= term=/forms90/hsd65html/genoa.res"> ');
    I'm specifying the term as term=/forms90/hsd65html/genoa.res.
    During forms startup I get the message unable to read the file. I can bwoense the file by http://server/forms90/hsd65html/genoa.res
    Any idea how to specify the term file in static html.
    Thanks

    term is not a http address, but a directory address. So, you have to specify the path on the server:
    term=c:\oracle\forms90\.....

  • Can i set the policy in code not in a policy file

    normally starting rmi client with a policy file. and start the client with such JVM parameters: java.security.policy and java.rmi.codebase.
    But in jsp how can i specify these JVM parameters.Or can i make the policy in code not in
    a file.

    You can specifiy inline with code otherwise malicious code would use it the grant all permissions before it wrecks havoc on the system.
    When your Servlet engine starts (Tomcat, JBoss, depends on which you are using) there will either be an option to pass in additional policy file, or a policy file will exist inthe servlet engine directory path for you to edit and add your entries to.

  • Security Manager and Policy Files

    Hi all,
    I am writing a simple java rmi application, but understand it wont run without a Security Manager installed and a policy file.
    I think I have installed the security manger using the following in the main() method of my client application:
    System.setSecurityManager(new RMISecurityManager());However I am unsure how to use a policy file with this. I have looked on the internet, but it does not seem to be very well documented
    Please could you advise me how to create a policy file that will work for my application and where to place it in my application so that my application can use it.
    Any help would be greatfuly appreciated
    Thanx
    Aaron

    An RMI application doesn't need a security manager unless you are using the codebase feature.

  • Multiple policy files

    Hi,
    using one policy file works well like the following code.
    java -Djava.security.manager -Djava.security.policy=mypolicy myprogram
    But I want to use two different policy files at the same time for the same program.
    I tried following, which didnt work
    java -Djava.security.manager -Djava.security.policy=mypolicy1 -Djava.security.policy=mypolicy2 myprogram
    Multiple policy files may be possible in security properties file. But is it possible to specify 2 policy files in command line? If yes, please give me an example.
    Thank you very much for your help.
    Huda

    Hi,
    using one policy file works well like the following code.
    java -Djava.security.manager -Djava.security.policy=mypolicy myprogram
    But I want to use two different policy files at the same time for the same program.
    I tried following, which didnt work
    java -Djava.security.manager -Djava.security.policy=mypolicy1 -Djava.security.policy=mypolicy2 myprogram
    Multiple policy files may be possible in security properties file. But is it possible to specify 2 policy files in command line? If yes, please give me an example.
    Thank you very much for your help.
    Huda

  • In OPEN DATASET Statement Filenames are platform-specific How to specify MS

    In OPEN DATASET Statement
    Filenames are platform-specific. You must therefore use file- and pathnames that conform to the rules of the operating system under which your R/3 System is running. However, you can also use logical filenames to ensure that your programs are not operating system-specific. For further information, refer to Using Platform-Independent Filenames.
    DATA FNAME(60).
    FNAME = '/tmp/myfile'.
    OPEN DATASET 'myfile'.
    OPEN DATASET FNAME.
    This example works as long as your R/3 System is running under UNIX. The program opens the file "myfile" in the directory in which the R/3 System is running, and also opens the file "myfile" in directory "/tmp".
    FNAME = '[TMP]myfile.BIN'
    OPEN DATASET 'myfile.BIN'.
    question]]  How to specify an MS-file & how to go about?

    Hi,
    Just get the input file name from the application server through selection screen and keep it in parameter(p_inpfile).
    Then pass the parameter to OPEN DATASET statement.
    OPEN DATASET p_inpfile FOR INPUT IN TEXT MODE ENCODING DEFAULT.
      IF sy-subrc NE 0.
        WRITE :/ text-004.                                   "'No such input file' COLOR 3.
        EXIT.
      ELSE.
        DO.
          CLEAR : wa_string,wa_0001.
    *Reading the file from application server and moving to work area*
          READ DATASET p_inpfile INTO wa_string.
          IF sy-subrc NE 0.
            EXIT.
          ELSE.
            CLEAR wa_0001.
    *Spliting fields in the file-
            REPLACE ALL OCCURRENCES OF '#' IN wa_string WITH ' '.
            SPLIT wa_string AT c_htab INTO wa_0001-pernr
                                           wa_0001-werks       "Personnel Area
                                           wa_0001-persk       "Employee Sub-Group
                                           wa_0001-vdsk1       "Org. Key
                                           wa_0001-abkrs       "Payroll area
                                           wa_0001-ansvh.      "Work contract
            wa_0001-begda = p_efdate.
            wa_0001-endda = '99991231'.
            APPEND wa_0001 TO int_0001.
          ENDIF.
        ENDDO.
        CLOSE DATASET p_inpfile.
    Use like this and pass all those values to internal table.
    Thanks,
    Sakthi C
    *Rewards if useful*

  • About policy files

    HI,
    I want to run this example of the RMI.
    I'm in the "Running" level.
    http://java.sun.com/docs/books/tutorial/rmi/compiling.html
    I didn't understend where to put these files and what the goal for these:
    server.policy ,client.policy
    Am I create these files with the notpad editor?
    I'm using the same computer for server & client.
    I have this project: (in one directory - "RMI")
    My JVM in D:\Programs\Java\jdk1.5.0_08
    My project locations:
    D:\MyJava\RMI
    client
    compute
    engine
    public_html\classes\compute.jar
    so, where shuld I put theses policy?
    and how to create these policy files?
    Thank's

    SAP on windows server 2008 64 bit
    Markus

Maybe you are looking for

  • Can RAM lock on a new iMac?

    Hi all Just a quickie. My mum has recently purchased a brand new iMac. Specs below: 21.5-inch: 2.7GHz 2.7GHz Quad-Core Intel Core i5 1920 x 1080 resolution 4GB (two 2GB) memory 1TB hard drive AMD Radeon HD 6770M with 512MB OS 10.7.3 My question is th

  • I cannot re-install my PSE10 even though I have the disks, here is why

    These are the following error messages that I am getting when I try to re install PSE10 Premiere after it DID not install correctly the first time. On the first installation the actions with the triangles (such as the eraser ikon with the triangle) w

  • Airport express shows in Sys Pref but cannot select it

    My Airport Express shows in bold as a devise in System Preferences > Sounds> Output, but when I click on it, it will not select, going back to highlight internal speakers. I can select my Airport Express in iTunes, and it works but I cannot output so

  • Updating a table through ALV

    Hi all, I have one requirement. I need to display output using alv grid display.Next when somebody select the rows in the grid display and press a push button then the selected fields are updated in the ztable created. How can i achieve this. How to

  • Programs that allow .avi 'streamed video' to be viewed

    I've seen some replies here to "problems viewing .avi files" posts -- e.g., using the VLC media player to view .avi files. Do VLC and other programs (QuickTime plugins, etc.) that support .avi automatically open when .avi files are streamed from the