5 Replies Latest reply on Nov 6, 2007 11:52 AM by Richard Opalka

    service-name-pattern

    Sefai Tando?an Newbie

      I have to call more than one web service in my web application. Each of the web services I call have different authentication mechanisms,some have none.I am trying to configure the clients using javaee:service-name-pattern.

      <post-handler-chains>
       <javaee:handler-chain>
       <javaee:service-name-pattern xmlns:ns1="http://someUri/">ns1:SomeService</javaee:service-name-pattern>
       <javaee:handler>
       <javaee:handler-name>WSSecurity Handler Client (Some Service)</javaee:handler-name>
       <javaee:handler-class>org.jboss.ws.extensions.security.jaxws.WSSecurityHandlerClient</javaee:handler-class>
       </javaee:handler>
       </javaee:handler-chain>
      </post-handler-chains>


      This gives me the error org.xml.sax.SAXException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'post-handler-chains'. One of '{"urn:jboss:jaxws-config:2.0":feature, "urn:jboss:jaxws-config:2.0":property}' is expected. @ *unknown*[26,28].

      I looked at the schema definitons in jbossws,there is javaee_web_services_client_1_2.xsd which defines service-name-pattern, but it is not imported in any other schema, all the samples I have seen use xsi:schemaLocation='urn:jboss:jaxws-config:2.0 jaxws-config_2_0.xsd' which imports javaee_web_services_1_2.xsd but not the client xsd.

      Is this a bug, or am I missing something? How can I configure each web service to use different authentication mechanisms?

        • 1. Re: service-name-pattern
          Richard Opalka Master

          Hi,

          unfortunately javaee:service-name-pattern element isn't supported by jbossws post-handler-chains configuration.
          However, you're doing your job right. Create new JAX-WS client config, define there your post-handler-chains configurations but use config-name instead of service-name-pattern subelement.
          The last step you should do is to refer to this config by annotating the SEI interface, you're using on your client side. Here's the example.

          @EndpointConfig(configName = "Config Name Sample", configFile = "META-INF/custom-jaxws-client-config.xml")
          public interface SEI { ... }
          


          Richard

          • 2. Re: service-name-pattern
            Sefai Tando?an Newbie

            I added this handler-chain in standard-jaxws-endpoint-config.xml,and it didn't work,then I added it in standard-jaxws-client-config.xml,I looked into the DEBUG output,and didn't see any anything regarding this config during deployment.So I posted here.

            Then I worked on it more, and discovered that this client-config is loaded after you call it,not during deployment,and if you put service-name-pattern in endpoint-config you get an exception,but you dont get any exceptions if you put this in client-config. Also the web-service-call I want to make with secure works smooth, and other web-services-call I make continue to work without any security constraint,meaning this pattern provides us using different authentication mechanisms.

            When I logged in this forum to post the resolution I saw your reply and I am confused. I changed the service-name-pattern definiton to point to an unsecured web-service-client,to test if it worked before by chance. But it didn't,it throw exception as excepted. And I am now confused more.

            You say it is not supported,but it works as expected.

            Can you enlighten me please?

            best regards...

            • 3. Re: service-name-pattern
              Richard Opalka Master

              There's no source code that would read service-name-pattern element content at all.

              Richard

              • 4. Re: service-name-pattern
                Sefai Tando?an Newbie

                This is the debug output of JBossAS

                2007-11-06 17:58:34,493 DEBUG [org.jboss.ws.metadata.umdm.EndpointMetaData] Configure SOAPBinding
                2007-11-06 17:58:34,493 DEBUG [org.jboss.ws.core.jaxws.handler.HandlerResolverImpl] initHandlerChain: PRE
                2007-11-06 17:58:34,493 DEBUG [org.jboss.ws.core.jaxws.handler.HandlerResolverImpl] initHandlerChain: ENDPOINT
                2007-11-06 17:58:34,493 DEBUG [org.jboss.ws.core.jaxws.handler.HandlerResolverImpl] initHandlerChain: POST
                2007-11-06 17:58:34,493 DEBUG [org.jboss.ws.core.jaxws.handler.HandlerResolverImpl] addHandler:
                HandlerMetaDataJAXWS:
                 type=POST
                 name=WSSecurity Handler Client(x509v3)
                 class=class org.jboss.ws.extensions.security.jaxws.WSSecurityHandlerClient
                 params=[]
                 protocols=null
                 services={http://mywebservice.org/}MyWebService
                 ports=null


                And this is the client-config

                <jaxws-config xmlns="urn:jboss:jaxws-config:2.0"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xmlns:javaee="http://java.sun.com/xml/ns/javaee"
                 xsi:schemaLocation="urn:jboss:jaxws-config:2.0 jaxws-config_2_0.xsd">
                 <client-config>
                 <config-name>
                 My Web Service Client Security Config
                 </config-name>
                 <post-handler-chains>
                 <javaee:handler-chain>
                 <javaee:service-name-pattern xmlns:myns="http://mywebservice.org/">
                 myns:MyWebService
                 </javaee:service-name-pattern>
                 <javaee:handler>
                 <javaee:handler-name>
                 WSSecurity Handler Client(x509v3)
                 </javaee:handler-name>
                 <javaee:handler-class>
                 org.jboss.ws.extensions.security.jaxws.WSSecurityHandlerClient
                 </javaee:handler-class>
                 </javaee:handler>
                 </javaee:handler-chain>
                 </post-handler-chains>
                 </client-config>
                </jaxws-config>


                This seems to me OK.

                What you say about this?

                • 5. Re: service-name-pattern
                  Richard Opalka Master

                  I was looking to the wrong element schema definition. Sorry for that. Your element is handled by third-party jars so you're right.

                  Richard