Create java client from WSDL for Google App engine

This post will explain how to consume SOAP based web services on Google App Engine platform.

  1. Keep your wsdl files in resources/wsdl folder
  2. Make these files entry in appengine-web.xml like
  3.   <static-files>
           <include path="/**.wsdl"/>
         <include path="/**.WSDL"/>
     </static-files>
  4.  Now update POM file for wsdl to java plugin
 <plugin>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-codegen-plugin</artifactId>
    <version>3.0.1</version>
    <executions>
        <execution>
            <id>generate-sources</id>
            <phase>generate-sources</phase>
            <configuration>             
                <sourceRoot>${basedir}/src/main/java</sourceRoot>
                <wsdlOptions>
                    <wsdlOption>
                          <wsdl>src/main/resources/wsdl/ReadData.wsdl</wsdl>  
                          <wsdlLocation>https://${appengine.app.id}.appspot.com/wsdl/ReadData.wsdl</wsdlLocation>
                          <extraargs>
                                 <extraarg>-p</extraarg>
                                 <extraarg>com.example.ws.readdata</extraarg>
                          </extraargs>                                      
                    </wsdlOption>
                    <wsdlOption>
                        <wsdl>src/main/resources/wsdl/SaveData.wsdl</wsdl>
                        <wsdlLocation>https://${appengine.app.id}.appspot.com/wsdl/SaveData.wsdl</wsdlLocation>
                        <extraargs>
                                <extraarg>-p</extraarg>
                                <extraarg>com.example.ws.savedata</extraarg>
                         </extraargs>
                    </wsdlOption>
                   
                </wsdlOptions>
            </configuration>
            <goals>
                <goal>wsdl2java</goal>
            </goals>
        </execution>
    </executions>
</plugin>







Now you can use maven commands mvn clean install and stubs will be generated in com.example.ws.savedata and com.example.ws.readdata packages.
 

Comments

Popular posts from this blog

Read Images from a xlsx file using Apache POI

Struts 2 : Warning :No configuration found for the specified action: 'Login.action' in namespace: '/'

How to create mail message in FRC822 format