0

I have developed JAX RPC webservice in bottom to top approach. I want to add username token to the webservice from Websphere Application Server admin console.

Usually, RAD (Rational Application Developer) has an option to add username token in Extensions tab, but I developed my webservice in Eclipse. When I opened the wsdl with webservice editor, I didn't find an Extensions tab. So I am trying to add from admin console.Is there any option to add from admin console.

krishna movva
  • 49
  • 2
  • 12

1 Answers1

0

If you are talking about JAX-RPC I assume that you have WAS 6.1. If you don't have RAD, the best option would be to use AST (Application Server Toolkit - eclipse tool provided separately with WAS to assembly and deploy apps).
For reference you can use this redbook Web Services Handbook for WebSphere Application Server 6.1
You can edit bindings via console, once you have configuration: Enterprise Applications > JAXRPCEAR > Manage Modules > JAXRPC.war > Web services: Server security bindings, but you will not be able to create configuration there.

Here are templates for dummy Hello service with username token, you can tweak them to your needs. They might not fully work as I didn't test them. You need to put them in the WEB-INF folder.

File 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>

File 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>

File 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>
Gas
  • 17,601
  • 4
  • 46
  • 93
  • Thanks for your help Gas!!! I am using websphere 7.0.I installed RAD and imported the webservice.But I didn't find the extensions tab.I even tried with creating a new webservice in RAD,but I didn't find the extensions tab.Do I need to perform additional changes after creating the webservice. – krishna movva Aug 21 '14 at 14:24
  • Make sure that in Project `Properties > Project Facets` you have selected facets WebSphere Web (Coexistence) and (Extended). Then after opening webservice.xml you should have Extensions tab. Make sure you are opening it with Web Service Editor, not XML editor. – Gas Aug 21 '14 at 17:40
  • I have already gone through those options.But still,I am not able. – krishna movva Aug 21 '14 at 18:25
  • Are you sure its a JAX-RPC service, not JAX-WS? Your application also should be J2EE 1.4, means Dynamic Web module 2.4. What tabs do you have when you open webservices.xml file? – Gas Aug 21 '14 at 18:36
  • It's JAX-RPC,but I created with Dynamic Web module 2.5,my webservice.xml has WebServices,Port Components,Handlers only. – krishna movva Aug 21 '14 at 18:46
  • Unfortunately it only works for old 1.4/2.4 modules. 2.5 is Java EE 5.0 and editor was 'enhanced' and no longer provides Extension tabs. You have to code it manually, since in Java EE 5.0 JAX-RPC was kind of deprecated and you should use JAX-WS. – Gas Aug 21 '14 at 19:41
  • Thanks a lot Gass!!I created a new 2.4 project and can see the Extension tab.I will move all the .java files into it and try to add username token.I really appreciate your help from bottom of my heart – krishna movva Aug 21 '14 at 19:48
  • I added the username and token and tested from soapUI tool.I got the below error. com.ibm.wsspi.wssecurity.SoapSecurityException: WSEC6520E: Construction of the login context failed. The exception is : javax.security.auth.login.LoginException: No LoginModules configured for system.wssecurity.UserNameToken – krishna movva Aug 22 '14 at 02:08
  • That was probably name from 6.1. Check this page for new name (or go to Global Security > JAAS - System logins. http://www-01.ibm.com/support/knowledgecenter/SSAW57_8.5.5/com.ibm.websphere.nd.multiplatform.doc/ae/twbs_configtokenconssvrcell.html?cp=SSAW57_8.5.5%2F3-3-0-16-4-0-7&lang=en – Gas Aug 22 '14 at 11:45