No you need to generate your java objects from xsd using some maven plugin. 
Then you can use those objects in your cxf webservice client.

Maven plugin code pasted below for your reference:

<!--plugin to specify use java version 1.6 or above -->         
                <plugin>
                                <inherited>true</inherited>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-compiler-plugin</artifactId>
                                <version>2.1</version>
                                <configuration>
                                        <source>1.6</source>
                                        <target>1.6</target>
                                </configuration>
                        </plugin>
                <!-- Plugin to generate java objects from schema-->
                <plugin>
                        <groupId>org.jvnet.jaxb2.maven2</groupId>
                        <artifactId>maven-jaxb22-plugin</artifactId>
                        <version>0.8.0</version>
                        <executions>
                                <execution>
                                        <goals>
                                                <goal>generate</goal>
                                        </goals>
                                </execution>
                        </executions>
                
                                <configuration>

                                        <extension>true</extension>
                                        <args>
                                                <arg>-Xxew</arg>
                                                <arg>-Xinheritance</arg>
                                                <arg>-Xannotate</arg>
                                                
<arg>-Xcollection-setter-injector</arg>
                                                 <arg>-Xboolean-getter</arg>
                                        </args>
                                        <generatePackage>com. 
hotels.domain</generatePackage>
                                        
<generateDirectory>${project.build.sourceDirectory}</generateDirectory>
                                        <plugins>
                                        <!-- Plugin to remove redundant 
container classes for XMLElementWrapper-->
                                                <plugin>
                                                        <groupId>xew</groupId>
                                                        
<artifactId>xew</artifactId>
                                                        <version>1.0</version>
                                                </plugin>
                                                <plugin>
                                                        
<groupId>org.jvnet.jaxb2_commons</groupId>
                                                        
<artifactId>jaxb2-basics</artifactId>
                                                        <version>0.6.3</version>
                                                </plugin>
                                                <plugin>
                                                        
<groupId>org.jvnet.jaxb2_commons</groupId>
                                                        
<artifactId>jaxb2-basics-annotate</artifactId>
                                                        <version>0.6.3</version>
                                                </plugin>
                                                <plugin>
                                                        
<groupId>net.java.dev.vcc.thirdparty</groupId>
                                                        
<artifactId>collection-setter-injector</artifactId>
                                                        
<version>0.5.0-1</version>
                                                </plugin>
                                                 <plugin>
                                <groupId>com.nebulent.xjc</groupId>
                                <artifactId>boolean-getter</artifactId>
                                <version>0.5</version>
                        </plugin>
                                        </plugins>
                                </configuration>
                                <dependencies>
                                        <dependency>
                                                <groupId>xew</groupId>
                                                <artifactId>xew</artifactId>
                                                <version>1.0</version>
                                        </dependency>
                                </dependencies>
                        </plugin>


Regards,
Abhishek

-----Original Message-----
From: amathewcxf [mailto:[email protected]] 
Sent: Friday, June 01, 2012 12:30 AM
To: [email protected]
Subject: RE: How to use XSD file with cxf

Thanks you so much for your time and reply.

After reading your reply, i did lot of reading. The one question which i
have from your reply is, are you saying that I can refer the xsd in the
@Path like below?


@Path("/ws/GetAvailabilitySchema.xsd") 
public interface GetAvailability{

     @GET
     public Availability getAvailability(); 

}

public class GetAvailabilityImpl implements GetAvailability{

     @GET
     public Availability getAvailability(){
     } 

}

Then I will have a standalone client code like below (which will be invoked
by a EJB method):

public class GetAvailabilityWSClient{ 

     public void processWSClient(){
         GetAvailability getAvail =
JAXRSClientFactory.create("http://remotewstest.com";, GetAvailability.class);
         Availability availability = getAvail.getAvailability();
    }
}

Then the getAvail.getAvailability() in the GetAvailabilityWSClient will
return the Availability object based on the xsd?


Thanks Again
Anil Mathew





--
View this message in context: 
http://cxf.547215.n5.nabble.com/How-to-use-XSD-file-with-cxf-tp5708311p5708925.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to