Announcement Announcement Module
Collapse

JavaConfig forum decommissioned in favor of Core Container

As described at

http://static.springsource.org/sprin...fig/README.TXT

key features of the Spring JavaConfig project have been migrated into the core Spring Framework as of version 3.0.

Please see the Spring 3.0 documentation on @Configuration and @Bean support:

http://static.springsource.org/sprin...tml#beans-java

For any questions related to @Configuration classes and @Bean methods in Spring 3.0, please post in the dedicated 'Core Container' forum at

http://forum.springsource.org/forumdisplay.php?f=26
See more
See less
javaconfig and jax-ws Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • javaconfig and jax-ws

    Hi,

    Is there a way to use javaconfig with jax-ws ?

  • #2
    If you can be a bit more specific, I'd be happy to comment.

    Comment


    • #3
      javaconfig and jaxws

      yes of course you can using the embeeded http server in jdk1.6 and the latest spring edition

      Comment


      • #4
        My config

        Code:
        I was like you and i get javaconfig used with WS, using embedded http server in jdk 1.6; now i try to add security with jaxws spring. 
        just look at static.springsource.org/spring-ws/sites/1.5/reference/html/
        and try to use spring irc channel many people will help you 
        
        
         here is my configuration:
        ****** applicationContext.xml
        
        <beans default-lazy-init="false" default-autowire="no"
        	default-dependency-check="none">
        
        	<bean id="xmlCompanyService"
        		class="com.company.services.xml.impl.XmlCompanyServiceImpl"
        		autowire="byName" />
        
        
        	<!-- Web Service Embeeded Html container -->
        	
        	<bean id="serviceExporter"
        		class="org.springframework.remoting.jaxws.SimpleJaxWsServiceExporter">
        		<property name="baseAddress" value="YourHttpLocalhostPortNumber" />
        
        	</bean>
        
        	<!-- sÚcuritÚ WS -->
        	
        
        
        	<!--  client web service -->
        
        	<bean id="wsdlRetriever" abstract="true"
        		class="org.springframework.remoting.jaxws.JaxWsPortProxyFactoryBean">
        		<property name="lookupServiceOnStartup" value="false" />
        	</bean>
        
        	
        <bean id="wsXmlCompanyService" parent="wsdlRetriever">
        		<property name="serviceInterface"
        			value="com.company.services.remote.XmlRemoteCompanyService" />
        		<property name="wsdlDocumentUrl" value="YourHttpLocalPortNumber/XmlCompanyService?wsdl" />
        		<property name="serviceName" value="XmlCompanyService" />
        		<property name="portName" value="XmlCompanyServiceImplPort" />
        		<property name="namespaceUri"
        			value="HereMakeHttp://impl.xml.services.company.com/" />
        	</bean>
        </beans>
        
        ****** server XmlCompanyService Interface
        /**
         * @author Younss AZZAYANI
         *
         */
        @WebService(serviceName = "xmlCompanyService")
        @SOAPBinding(parameterStyle=ParameterStyle.BARE)
        public interface XmlCompanyService {
        	@WebMethod
        	public String getCompany();
        
        }
        
        ****** server XmlCompanyServiceImpl Implementation of XmlCompanyService
        
        /**
         * @author Younss AZZAYANI
         *
         */
        @WebService(serviceName = "XmlCompanyService")
        @SOAPBinding(parameterStyle=ParameterStyle.BARE)
        public class XmlCompanyServiceImpl implements XmlCompanyService {
        
        	/* (non-Javadoc)
        	 * @see com.openadmedia.openadmediaeye.services.xml.XmlCompanyService#getCompany()
        	 */
        	@Override
        	@WebMethod
        	public String getCompany() {
        		Company company = new Company();
        		company.setName("NormaSys");
        		Employee emp1= new Employee();
        		Employee emp2= new Employee();
        		emp1.setName("Younss");
        		emp2.setName("AZZAYANI");
        		company.setList(new ArrayList<Employee>());
        		company.getList().add(emp1);
        		company.getList().add(emp2);
        		XStream xStream = new XStream(new DomDriver());
        		String xmlCompany = xStream.toXML(company);
        		return xmlCompany;
        	}
        
        }
        
        **** client ws side XmlRemoteCompanyService
        
        /**
         * @author Younss AZZAYANI
         *
         */
        @WebService
        @SOAPBinding(parameterStyle=ParameterStyle.BARE)
        public interface XmlRemoteCompanyService {
        	public String getCompany();
        }
        
        
        ***********my client main methode: in this case i use the server & client in the same machine :
        
        public static void main(String[] args) {
        		//JavaConfigApplicationContext context = new JavaConfigApplicationContext(AppConfig.class);
        		//NameService nameService = context.getBean(NameService.class);
        		//NameService name = (NameService)context.getBean("nameService");
        		//name.getNames();
        		//System.out.print(nameService.getNames().toString());
        		//System.out.print(context.getBean("nameService").toString());
        		// TODO Auto-generated method stub
        		try {
        			ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        		
        			XmlRemoteCompanyService remoteCompanyService = (XmlRemoteCompanyService)  context.getBean("wsXmlCompanyService");
        			System.out.println(remoteCompanyService.getCompany());
        			XStream xStream = new XStream(new DomDriver());
        			Company company = (Company) xStream.fromXML(remoteCompanyService.getCompany());
        			System.out.println(company.getName());
        			System.out.println(company.getList().get(0).getName());
        			System.out.println(company.getList().get(1).getName());
        			System.out.println("type a number to logout : ");
        			int myInt = System.in.read();
        			
        			System.exit(0);
        		
        		} catch (IOException e) {
        			// TODO Auto-generated catch block
        			e.printStackTrace();
        		} 
        		
        
        	}
        ************ pom.xml
        
        <build>
            <resources>
              <resource>
                <directory>src/main/config</directory>
              </resource>
            </resources>
            <testResources>
              <testResource>
                <directory>src/test/config</directory>
              </testResource>
            </testResources>
          </build>
          <dependencies>
            <dependency>
              <groupId>org.springframework.javaconfig</groupId>
              <artifactId>spring-javaconfig</artifactId>
              <version>1.0.0.m3</version>
            </dependency>
            <dependency>
              <groupId>aspectj</groupId>
              <artifactId>aspectjlib</artifactId>
              <version>1.5.3</version>
              <optional>true</optional>
            </dependency>
            <dependency>
              <groupId>org.springframework</groupId>
              <artifactId>spring-remoting</artifactId>
              <version>2.0.8</version>
            </dependency>
            <dependency>
              <groupId>org.springframework.ws</groupId>
              <artifactId>spring-ws</artifactId>
              <version>1.5.6</version>
            </dependency>
            <dependency>
              <groupId>org.springframework</groupId>
              <artifactId>spring-aop</artifactId>
              <version>2.5.6</version>
            </dependency>
            <dependency>
              <groupId>org.springframework</groupId>
              <artifactId>spring-web</artifactId>
              <version>2.5.6</version>
            </dependency>
            <dependency>
              <groupId>org.springframework</groupId>
              <artifactId>spring-context</artifactId>
              <version>2.5.6</version>
            </dependency>
            <dependency>
              <groupId>springframework</groupId>
              <artifactId>spring-remoting</artifactId>
              <version>1.2-rc2</version>
            </dependency>
            <dependency>
              <groupId>xstream</groupId>
              <artifactId>xstream</artifactId>
              <version>1.2.1</version>
            </dependency>
            <dependency>
            <groupId>org.springframework.ws</groupId>
            <artifactId>spring-ws-security</artifactId>
            <version>1.5.6</version>
        </dependency> 
          </dependencies>
        
        
        Goood luck

        Comment


        • #5
          How to secure my config

          know i try to secure my config, but im a little bit losed in all security technics refering to http://static.springsource.org/sprin.../security.html
          any help or advice please

          Comment

          Working...
          X