我已经开发了一个Web服务并部署在weblogic 10.3上,现在我想在其中实现Web服务安全性,以便客户端在标头中提供用户名密码令牌来访问我的Web服务。
我使用策略条目创建文件weblogic-webservices-policy.xml
<?xml version='1.0' encoding='UTF-8'?>
<webservice-policy-ref xmlns="http://www.bea.com/ns/weblogic/90" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<port-policy>
<port-name>AudioCall</port-name>
<ws-policy>
<uri>policy:Auth.xml</uri>
<direction>inbound</direction>
</ws-policy>
</port-policy>
</webservice-policy-ref>
但我得到以下错误
javax.xml.ws.WebServiceException: weblogic.wsee.ws.init.WsDeploymentException: The WebLogic Server 9.x-style policy is not supported in JAX-WS
web services.
at weblogic.wsee.jaxws.framework.jaxrpc.TubelineDeploymentListener.createServer(TubelineDeploymentListener.java:85)
at weblogic.wsee.jaxws.WLSTubelineAssemblerFactory$TubelineAssemblerImpl.createServer(WLSTubelineAssemblerFactory.java:204)
at com.sun.xml.ws.server.WSEndpointImpl.<init>(WSEndpointImpl.java:201)
at weblogic.wsee.jaxws.WLSContainer$WLSEndpointFactory$WLSEndpointImpl.<init>(WLSContainer.java:577)
at weblogic.wsee.jaxws.WLSContainer$WLSEndpointFactory.createEndpoint(WLSContainer.java:530)
Truncated. see log file for complete stacktrace
Caused By: weblogic.wsee.ws.init.WsDeploymentException: The WebLogic Server 9.x-style policy is not supported in JAX-WS web services.
at weblogic.wsee.security.wssp.deploy.WssDeploymentListener.process(WssDeploymentListener.java:55)
at weblogic.wsee.jaxws.framework.jaxrpc.TubelineDeploymentListener.createServer(TubelineDeploymentListener.java:82)
at weblogic.wsee.jaxws.WLSTubelineAssemblerFactory$TubelineAssemblerImpl.createServer(WLSTubelineAssemblerFactory.java:204)
at com.sun.xml.ws.server.WSEndpointImpl.<init>(WSEndpointImpl.java:201)
at weblogic.wsee.jaxws.WLSContainer$WLSEndpointFactory$WLSEndpointImpl.<init>(WLSContainer.java:577)
Truncated. see log file for complete stacktrace
>
<Mar 5, 2012 3:38:40 PM UZT> <Error> <Deployer> <BEA-149265> <Failure occurred in the execution of deployment request with ID '1330943919750'
for task '0'. Error is: 'weblogic.application.ModuleException: [HTTP:101216]Servlet: "org.csapi.wsdl.parlayx.account_management.v3_1.service.A
ccountManagementService_AccountManagementImpl" failed to preload on startup in Web application: "ParlayXAccountManagement.war".
javax.xml.ws.WebServiceException: weblogic.wsee.ws.init.WsDeploymentException: The WebLogic Server 9.x-style policy is not supported in JAX-WS
web services.
at weblogic.wsee.jaxws.framework.jaxrpc.TubelineDeploymentListener.createServer(TubelineDeploymentListener.java:85)
at weblogic.wsee.jaxws.WLSTubelineAssemblerFactory$TubelineAssemblerImpl.createServer(WLSTubelineAssemblerFactory.java:204)
at com.sun.xml.ws.server.WSEndpointImpl.<init>(WSEndpointImpl.java:201)
at weblogic.wsee.jaxws.WLSContainer$WLSEndpointFactory$WLSEndpointImpl.<init>(WLSContainer.java:577)
at weblogic.wsee.jaxws.WLSContainer$WLSEndpointFactory.createEndpoint(WLSContainer.java:530)
at com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:231)
at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:514)
at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:557)
at weblogic.wsee.jaxws.JAXWSDeployedServlet.getEndpoint(JAXWSDeployedServlet.java:183)
at weblogic.wsee.jaxws.JAXWSServlet.registerEndpoint(JAXWSServlet.java:96)
at weblogic.wsee.jaxws.JAXWSServlet.init(JAXWSServlet.java:61)
at weblogic.wsee.jaxws.JAXWSDeployedServlet.init(JAXWSDeployedServlet.java:54)
at javax.servlet.GenericServlet.init(GenericServlet.java:241)
at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:283)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:64)
at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:58)
at weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHelper.java:48)
at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:539)
at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:1976)
at weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:1950)
at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1869)
at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3126)
at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1512)
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:486)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)
at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:247)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27)
at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:1267)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:409)
at weblogic.application.internal.SingleModuleDeployment.activate(SingleModuleDeployment.java:43)
at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:569)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:150)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:116)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:323)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:844)
at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1253)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:440)
at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:163)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDelive
谨致问候,imran
错误是因为JAX-WS Web服务中不支持WebLogic Server 9.x风格的策略。用于以下链接的详细检查
http://download.oracle.com/docs/cd/E12840_01/wls/docs103/webserv_sec/message.html#wp210122
如果需要支持JAX-WS 中的旧策略,请查看以下博客
http://kingsfleet.blogspot.com/2008/12/simple-custom-policy-example-using-jax.html
谨致问候,imran