6 Replies Latest reply on May 16, 2007 7:14 AM by heiko.braun

    creating new targetnamespace for complex types

    khelenek

      Hi,
      I just upgraded to using jax-ws with my ejb 3.0 beans, and its working fine. The classes used by my web service are being mapped to a shema with a targetNamespace reflected by their package name. Because I'm trying to recreate an exact copy of my old web services I would like to define the target namespace for these classes myself.

      So i tried using the XmlSchema and XmlType annotations from jaxb on the package-info and class files respectively but it didn't seem to do anything. Is this the correct technique, and does jboss support these? Is there another way to specify the target namespace for these complex types?

      Thanks,
      kris

        • 1. Re: creating new targetnamespace for complex types
          bk8133

          Try using this at webservice bean level(at exposed method)

          WebService(targetNamespace="")
          WebParam(targetNamespace="")
          WebResult(targetNamespace="")



          • 2. Re: creating new targetnamespace for complex types
            khelenek

            Thanks for writing back.

            That's actually the first technique I tried which also did not seem to work. Here is an example of a my web service bean:

            @Stateless(name="VerificationWs")
            @WebService(
             name="VerificationWs",
             targetNamespace = VerificationWsBean.DEFAULT_NS)
            @SOAPBinding
            public class VerificationWsBean {
            
            @TransactionAttribute(value=TransactionAttributeType.REQUIRES_NEW)
            @WebMethod
            @WebResult(targetNamespace=VerificationWsBean.DEFAULT_NS)
            public VerificationResponse verify(
             @WebParam(targetNamespace=VerificationWsBean.DEFAULT_NS) VerificationRequest request
             ) throws Exception {
             return verifyDirect(request);
            }
            }
            


            And then in my VerificationRequest.java class I have:

            @XmlType(namespace="http://verification.studentuniverse.com/ws/client")
            public class VerificationRequest implements Serializable {
            



            But in my wsdl I still get VerificationRequest mapped as complex types under a schema with the package namespace:
            <schema elementFormDefault="qualified" targetNamespace="http://package.mycompany.com/jaws">
            


            (The methods map as complex types under the correct namespace as defined by the @WebService annotation, though.

            Any ideas what to try next?
            Thanks in advance,

            kris


            • 3. Re: creating new targetnamespace for complex types
              oskar.carlstedt

              Hi!

              I think this sounds terrible for you, but you probably have to start working in the other direction. If you want to ensure your contract (the wsdl file) is changed in the way you want, then you must start with taking control over it, i.e. develop it by yourself. What I'm saying - take full control of your wsdl and its dependent schema instances.

              Beeing in your situation, it might be good saving the old wsdl file and then run a wsprovide. Your wsdl will be the same but you have to update your implementation.

              With kind regards
              Oskar


              • 4. Re: creating new targetnamespace for complex types
                centecbertl

                the package of complex parameters needs to be specified per java package within a package-info.java file:

                see http://www.jboss.com/index.html?module=bb&op=viewtopic&t=103352

                JBossWS 1.2.x generates buggy wsdl files, though unless
                http://jira.jboss.com/jira/secure/ManageAttachments.jspa?id=12335583
                is fixed (scheduled for version 2.0.0 now).

                Although the wsdl files are not correct, clients generated with .net 2.0 and
                axis 1.4 tend towork at least when the parameter typ names are unique
                without looking at their package names. The client stub generators are
                intelligent enough to remember the correct package names then.

                • 5. Re: creating new targetnamespace for complex types
                  khelenek

                  Thanks for the help guys. Turns out it was because I was using the jbossws that was installed with jboss-4.0.5.GA, which i believe is version 1.0.3. I guess jaxb bindings were not supported until a later version, because I installed 1.2.1.GA and everything worked as expected.

                  However, I have a new question. My web service seems to be bound to http://localhost/MyBeanClassNameService/MyBeanClassName. Is there anyway to change that? I tried the name attribute of the @Stateless and @WebService annotations to no avail.

                  • 6. Re: creating new targetnamespace for complex types
                    heiko.braun