我从头到尾开发了JAX RPC webservice方法。我想从Websphere Application Server管理控制台向web服务添加用户名令牌。
通常,RAD(Rational Application Developer)可以选择在Extensions选项卡中添加用户名令牌,但我在Eclipse中开发了我的Web服务。当我用webservice编辑器打开wsdl时,我没有找到Extensions选项卡。所以我想从管理控制台添加。是否有任何选项可以从管理控制台添加。
答案 0 :(得分:0)
如果你在谈论JAX-RPC我假设你有WAS 6.1。如果您没有RAD,最好的选择是使用AST(Application Server Toolkit - 与WAS分开提供的eclipse工具来组装和部署应用程序)。
作为参考,您可以使用此红皮书Web Services Handbook for WebSphere Application Server 6.1
配置完成后,您可以通过控制台编辑绑定:Enterprise Applications > JAXRPCEAR > Manage Modules > JAXRPC.war > Web services: Server security bindings
,但您将无法在那里创建配置。
以下是带有用户名令牌的虚拟Hello服务的模板,您可以根据需要调整它们。他们可能没有完全工作,因为我没有测试它们。您需要将它们放在WEB-INF文件夹中。
档案webservices.xml
<?xml version="1.0" encoding="UTF-8"?><webservices version="1.1" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://www.ibm.com/webservices/xsd/j2ee_web_services_1_1.xsd">
<webservice-description>
<webservice-description-name>HelloService</webservice-description-name>
<wsdl-file>WEB-INF/wsdl/Hello.wsdl</wsdl-file>
<jaxrpc-mapping-file>WEB-INF/Hello_mapping.xml</jaxrpc-mapping-file>
<port-component>
<port-component-name>Hello</port-component-name>
<wsdl-port xmlns:pfx="http://service">pfx:Hello</wsdl-port>
<service-endpoint-interface>service.Hello</service-endpoint-interface>
<service-impl-bean>
<servlet-link>service_Hello</servlet-link>
</service-impl-bean>
</port-component>
</webservice-description>
</webservices>
档案ibm-webservices-ext.xmi
:
<?xml version="1.0" encoding="UTF-8"?>
<com.ibm.etools.webservice.wsext:WsExtension xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:com.ibm.etools.webservice.wsext="http://www.ibm.com/websphere/appserver/schemas/5.0.2/wsext.xmi" xmi:id="WsExtension_1408569011266">
<wsDescExt xmi:id="WsDescExt_1408569011266" wsDescNameLink="HelloService">
<pcBinding xmi:id="PcBinding_1408569011266" pcNameLink="Hello">
<serverServiceConfig xmi:id="ServerServiceConfig_1408569548722">
<securityRequestConsumerServiceConfig xmi:id="SecurityRequestConsumerServiceConfig_1408569548722">
<caller xmi:id="Caller_1408569896666" name="basicAuth." part="" uri="" localName="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken"/>
<requiredSecurityToken xmi:id="RequiredSecurityToken_1408569548722" name="userToken" uri="" localName="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken" usage="Required"/>
</securityRequestConsumerServiceConfig>
</serverServiceConfig>
</pcBinding>
</wsDescExt>
</com.ibm.etools.webservice.wsext:WsExtension>
档案ibm-webservices-bnd.xmi
:
<?xml version="1.0" encoding="UTF-8"?>
<com.ibm.etools.webservice.wsbnd:WSBinding xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:com.ibm.etools.webservice.wsbnd="http://www.ibm.com/websphere/appserver/schemas/5.0.2/wsbnd.xmi" xmi:id="WSBinding_1408569011266">
<wsdescBindings xmi:id="WSDescBinding_1408569011266" wsDescNameLink="HelloService">
<pcBindings xmi:id="PCBinding_1408569011266" pcNameLink="Hello">
<securityRequestConsumerBindingConfig xmi:id="SecurityRequestConsumerBindingConfig_1408569960450">
<tokenConsumer xmi:id="TokenConsumer_1408570879556" classname="com.ibm.wsspi.wssecurity.token.UsernameTokenConsumer" name="usernameTokenConsumer">
<valueType xmi:id="ValueType_1408570879556" localName="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken" uri="" name="Username Token"/>
<jAASConfig xmi:id="JAASConfig_1408570879556" configName="system.wssecurity.UsernameToken"/>
<partReference xmi:id="PartReference_1408570879556" part="userToken"/>
</tokenConsumer>
</securityRequestConsumerBindingConfig>
</pcBindings>
</wsdescBindings>
</com.ibm.etools.webservice.wsbnd:WSBinding>