11 Replies Latest reply on Oct 24, 2007 6:30 PM by asoldano

    Web seervice with authentication and wsconsume

    christy

      Hi,
      I have implemented the web service and added to it BASIC authentication.
      After deploying the web service, I can access the WSDL through a browser after entering the user name and password. But I have run into a problem:
      How do I run wsconsume against this WSDL? Or may be there is another way to generate portable Jax-WS artifacts from such WSDL?
      Thank you!

        • 1. Re: Web seervice with authentication and wsconsume
          richard_opalka

          Hi,

          the tool doesn't support BASIC authentication in present. Could you post a feature request in our JIRA?

          Richard

          • 2. Re: Web seervice with authentication and wsconsume
            asoldano

             

            "Christy" wrote:
            Hi,
            I have implemented the web service and added to it BASIC authentication.
            After deploying the web service, I can access the WSDL through a browser after entering the user name and password. But I have run into a problem:
            How do I run wsconsume against this WSDL? Or may be there is another way to generate portable Jax-WS artifacts from such WSDL?
            Thank you!


            In case you actually need to password protect your service only i.e. not your wsdl contract, see this: http://jbws.dyndns.org/mediawiki/index.php?title=JAX-WS_User_Guide#WebContext


            • 3. Re: Web seervice with authentication and wsconsume
              christy

               

              alessio.soldano@jboss.com wrote:

              In case you actually need to password protect your service only i.e. not your wsdl contract, see this: http://jbws.dyndns.org/mediawiki/index.php?title=JAX-WS_User_Guide#WebContext

              I changed my class, here it is:
              @WebService
              @SOAPBinding(style = SOAPBinding.Style.RPC)
              @SecurityDomain("e2edmwsSecurity")
              @WebContext(secureWSDLAccess = false)
              public class e2edm_metadata_ws {
              .....
              }
              But now my service doesn't protect with password too. When I invoke it doesn't ask password? it works like common web service. Why? Where is the mistake?
              Thank you!

              • 4. Re: Web seervice with authentication and wsconsume
                christy

                No, I'm sorry, It was just cash... I still have wsdl contract protected with password.
                I added to my service only this:
                @SecurityDomain("e2edmwsSecurity")
                @WebContext(secureWSDLAccess = false)
                Maybe it is not enough?

                • 5. Re: Web seervice with authentication and wsconsume
                  asoldano

                  Yes, you need to also specify the authMethod and transportGuarantee. You can also take a look at the samples, in particular the jaxws-samples-context features this.

                  • 6. Re: Web seervice with authentication and wsconsume
                    christy

                     

                    Yes, you need to also specify the authMethod and transportGuarantee. You can also take a look at the samples, in particular the jaxws-samples-context features this

                    I'm sorry, I'm here again. I still have the same problem, WSDL pritected with password.
                    Please look at my code once again:
                    Web service code:
                    @WebService
                    @SOAPBinding(style = SOAPBinding.Style.RPC)
                    @WebContext(authMethod = "BASIC", transportGuarantee="NONE", secureWSDLAccess = false)
                    @SecurityDomain("e2edmwsSecurity")
                    @Stateless
                    public class e2edm_metadata_ws implements e2edmnwsInterface{
                    }

                    web.xml file:


                    <servlet-name>e2edm_metadata_ws</servlet-name>
                    <servlet-class>metadata.e2edm.e2edm_metadata_ws</servlet-class>

                    <servlet-mapping>
                    <servlet-name>e2edm_metadata_ws</servlet-name>
                    <url-pattern>/e2edmws</url-pattern>
                    </servlet-mapping>
                    <security-constraint>
                    <web-resource-collection>
                    <web-resource-name>e2edm_metadata_ws_security</web-resource-name>
                    <url-pattern>/</url-pattern>
                    <http-method>POST</http-method>
                    </web-resource-collection>
                    <auth-constraint>
                    <role-name>ws</role-name>
                    </auth-constraint>
                    </security-constraint>
                    <login-config>
                    <auth-method>BASIC</auth-method>
                    <realm-name>e2edmwsSecurity</realm-name>
                    </login-config>
                    <security-role>
                    <role-name>ws</role-name>
                    </security-role>

                    jbossweb.xml:

                    <jboss-web>
                    <security-domain>java:/jaas/e2edmwsSecurity</security-domain>
                    </jboss-web>

                    Why I still have WSDL with password? Thank you!!

                    • 7. Re: Web seervice with authentication and wsconsume
                      asoldano

                      mmh, I think there's a little mess in your configuration. Why are you using web.xml and jboss-web.xml considering you have ejb endpoints? You should only have jboss.xml as non-java file. I think this could be the problem, I would try starting from the jaxws-sample-context, it has an ejb endpoint with secureWSDLAccess = false.
                      Let me know if you still have problem once you fix this.

                      • 8. Re: Web seervice with authentication and wsconsume
                        christy

                        alessio.soldano@jboss.com
                        Thank you very much that you are helping me!
                        My problem is not solved. I downloaded jbossws-samples-1.2.1.GA and looked through jaxws-sample-context. In src/java/...... /context directory I found several classes and interfaces (EndpointEJB, EndpointJSE., EndpointNoInjectEJB, TestEndpoint, WebServiceContextEJBTestCase, WebServiceContextJSETestCase).
                        Then I went to the src/resources/.../context directory and I found web.xml and jboss-web.xml. I looked through web.xml and found, that it describes EndpointJSE class. But an ejb endpoint with secureWSDLAccess = false is in the EndpointEJB. I din't found any *.xml for it. So, I'm confused. What samples should I look? Thank you!

                        • 9. Re: Web seervice with authentication and wsconsume
                          asoldano

                           

                          "Christy" wrote:
                          alessio.soldano@jboss.com
                          Thank you very much that you are helping me!
                          My problem is not solved. I downloaded jbossws-samples-1.2.1.GA and looked through jaxws-sample-context. In src/java/...... /context directory I found several classes and interfaces (EndpointEJB, EndpointJSE., EndpointNoInjectEJB, TestEndpoint, WebServiceContextEJBTestCase, WebServiceContextJSETestCase).
                          Then I went to the src/resources/.../context directory and I found web.xml and jboss-web.xml. I looked through web.xml and found, that it describes EndpointJSE class. But an ejb endpoint with secureWSDLAccess = false is in the EndpointEJB. I din't found any *.xml for it. So, I'm confused. What samples should I look? Thank you!


                          Well, I was looking at the 2.0.x samples, anyway there shouldn't be a lot of differences. I suggest you to build the samples so that you get the binaries and can see what is being packaged inside them.
                          The 2.0.x samples build creates a jaxws-samples-context.war and a jaxws-samples-context.jar: the first one features a pojo endpoint, the second one an ejb endpoint.

                          • 10. Re: Web seervice with authentication and wsconsume
                            ejb3workshop

                            where can one find those examples I looked in jbossws-native-2.0.1.GA, jbossws-src-2.0.1.GA as well as JBoss4.2.2GA.

                            I am looking for a basic example on Username Token authentication.

                            • 11. Re: Web seervice with authentication and wsconsume
                              asoldano

                              The context tests I was talking are in both jbossws-native-2.0.1.GA and jbossws-src-2.0.1.GA.
                              You can find a basic example of Username Token authentication in the org.jboss.test.ws.jaxws.samples.wssecurity package in the jbossws-src archive.
                              If you have further questions about Username Token authentication please start another thread.