Unable to apply security policy annotation when migrating from weblogic 8.1 to weblogic 10.3 (Doc ID 974486.1)

Last updated on JUNE 09, 2016

Applies to:

Oracle Weblogic Server - Version: 10.3 and later   [Release: and later ]
Information in this document applies to any platform.

Goal

When you develop web service from wsdl and if you modify JWS file with new annotation like @policy and use the compiledWsdl option in the ant task to generate web service which will results exception

Steps to reproduce the problem
---------------------------------
1. Develop wsdl file which does not contain any policy attached to wsdl.
2. Run following ant task
<taskdef name="wsdlc" classname="weblogic.wsee.tools.anttasks.WsdlcTask"/>
<target name="generate-from-wsdl">
<wsdlc srcWsdl="WSDL_file" destJwsDir="JWS_interface_directory" destImplDir="JWS_implementation_directory" packageName="Package_name" />
</target>
3. Then try to add @policy annotatation to the jws file.
4. Run following ant task
  <taskdef name="jwsc" classname="weblogic.wsee.tools.anttasks.JwscTask" />
  <target name="build-service">
  <jwsc srcdir="src_directory" destdir="ear_directory">
    <jws file="JWS_file" compiledWsdl="WSDLC_Generated_JAR" />
  </jwsc>
  </target>

when you run the above ant task it will fail with following reason

[jwsc] [ERROR] - The Policy and Policies annotations are not allowed on jws file when compiledWsdl option is specified.

Solution

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms