highsource / ogc-schemas

XML<->Java and XML<->JS for OGC XSDs.
BSD 2-Clause "Simplified" License
82 stars 48 forks source link

Allows generate stub for WSDLs (SOS, STS, etc.) #108

Open christophenoel opened 9 years ago

christophenoel commented 9 years ago

The project is very nice. But once the bindings are generated, the only way we found to generate the stub is to use the apache CXF plugin and put a long list of "nexclude" args.

I don't know if this could be handled by the jaxb2 plugin, but I haven't found a way to use the episodes when building the service. I just can manually create the stub.

highsource commented 9 years ago

Could you provide an example of stub building? I could try to intergate episodes then.

christophenoel commented 9 years ago

Hello,

What we try to do is to generate the Web Service stub and reuse the JAXB bindings generated. What we do is calling Apache CXF with the -impl parameter.

We have the following problems: CXF requires we copy all the schemas; and also, we have to write a long list of nexclue for each schema in order to exclude the build of the bindings.

What would be great would be to be able to build the stubs using the jaxb2 plugin. I must admin I'm not an expert at all, so maybe I'm not looking the right way ?

Regards,

POM:

<plugin>
                                <groupId>org.apache.cxf</groupId>
                                <artifactId>cxf-codegen-plugin</artifactId>
                                <version>3.1.2</version>
                                <executions>
                                        <execution>
                                                <id>CXF_generate_sources</id>
                                                <phase>generate-sources</phase>
                                                <goals>
                                                        <goal>wsdl2java</goal>
                                                </goals>
                                        </execution>
                                </executions>
                                <configuration>
                                        <wsdlOptions>
                                                <wsdlIOption>
                                                        <wsdl>${project.build.directory}/classes/wsdl/esa/ssa/swe/swep/services/UserDataAccessService/1.0.0/UserDataAccessService.wsdl</wsdl>
                                                        <wsdlLocation>WEB-INF/wsdl/esa/ssa/swe/swep/services/UserDataAccessService/1.0.0/UserDataAccessService.wsdl</wsdlLocation>
                                                        <extraargs>
                                                                <extraarg>-verbose</extraarg>
                                                                <extraarg>-autoNameResolution</extraarg>
                                                                <extraarg>-b</extraarg> <!-- because exception : Property "Title" is already defined. -->
                                                                <extraarg>${project.build.directory}/classes/xlink-v_1_0.xjb</extraarg>
                                                                <extraarg>-b</extraarg> <!-- because exception : Property "Rows" is already defined. -->
                                                                <extraarg>${project.build.directory}/classes/gml-v_3_2_1.xjb</extraarg>
                                                                <!-- main xsd -->
                                                                <extraarg>-nexclude</extraarg>
                                                                <extraarg>http://esa.ssa.swe/swep/datamodel/UserDataAccessService=swe.ssa.esa.swep.datamodel.userdataaccessservice</extraarg>
                                                                <!-- swep -->
                                                                <extraarg>-nexclude</extraarg>
                                                                <extraarg>http://esa.ssa.swe/swep/datamodel/data/=swe.ssa.esa.swep.datamodel.data</extraarg>
                                                                <extraarg>-nexclude</extraarg>
                                                                <extraarg>http://esa.ssa.swe/swep/datamodel/metadata/=swe.ssa.esa.swep.datamodel.metadata</extraarg>
                                                                <extraarg>-nexclude</extraarg>
                                                                <extraarg>http://esa.ssa.swe/swep/datamodel/common/=swe.ssa.esa.swep.datamodel.common</extraarg>
                                                                <!-- ogc -->
                                                                <extraarg>-nexclude</extraarg>
                                                                <extraarg>http://www.opengis.net/gml/3.2=net.opengis.gml.v_3_2_1</extraarg>
                                                                <extraarg>-nexclude</extraarg>
                                                                <extraarg>http://www.opengis.net/om/2.0=net.opengis.om.v_2_0</extraarg>
                                                                <extraarg>-nexclude</extraarg>
                                                                <extraarg>http://www.opengis.net/ows/1.1=net.opengis.ows.v_1_1_0</extraarg>
                                                                <extraarg>-nexclude</extraarg>
                                                                <extraarg>http://www.opengis.net/swe/2.0=net.opengis.swecommon.v_2_0</extraarg>
                                                                <extraarg>-nexclude</extraarg>
                                                                <extraarg>http://www.opengis.net/swes/2.0=net.opengis.swes.v_2_0</extraarg>
                                                                <extraarg>-nexclude</extraarg>
                                                                <extraarg>http://www.isotc211.org/2005/gco=net.opengis.iso19139.gco.v_20070417</extraarg>
                                                                <extraarg>-nexclude</extraarg>
                                                                <extraarg>http://www.isotc211.org/2005/gmd=net.opengis.iso19139.gmd.v_20070417</extraarg>
                                                                <extraarg>-nexclude</extraarg>
                                                                <extraarg>http://www.isotc211.org/2005/gsr=net.opengis.iso19139.gsr.v_20070417</extraarg>
                                                                <extraarg>-nexclude</extraarg>
                                                                <extraarg>http://www.isotc211.org/2005/gss=net.opengis.iso19139.gss.v_20070417</extraarg>
                                                                <extraarg>-nexclude</extraarg>
                                                                <extraarg>http://www.isotc211.org/2005/gts=net.opengis.iso19139.gts.v_20070417</extraarg>
                                                                <!-- oasis -->
                                                                <extraarg>-nexclude</extraarg>
                                                                <extraarg>http://docs.oasis-open.org/wsn/t-1=org.hisrc.w3c.oasis.wsn.t1</extraarg>
                                                                <!-- w3c -->
                                                                <extraarg>-nexclude</extraarg>
                                                                <extraarg>http://www.w3.org/1999/xlink=org.hisrc.w3c.xlink.v_1_0</extraarg>
                                                                <extraarg>-nexclude</extraarg>
                                                                <extraarg>http://www.w3.org/2004/11/xmlmime=org.hisrc.w3c.xmlmime.v_1_0</extraarg>
                                                                <extraarg>-nexclude</extraarg>
                                                                <extraarg>http://www.w3.org/2003/12/xop/include=org.hisrc.w3c.xop.include.v_1_0</extraarg>
                                                                <!-- jaxb2 plugins -->
                                                                <extraarg>-xjc-Xwildcard</extraarg>
                                                               <extraarg>-impl</extraarg>
                                                        </extraargs>
                                                </wsdlIOption>
                                        </wsdlOptions>
                                </configuration>
                                <dependencies>
                                        <!-- Activated through <extraargs/> -->
                                        <dependency>
                                                <groupId>org.jvnet.jaxb2_commons</groupId>
                                                <artifactId>jaxb2-basics</artifactId>
                                                <version>0.9.4</version>
                                        </dependency>
                                </dependencies>
                       </plugin>

Note the kind of stub generated, e.g. the interface is as follow: package swe.ssa.esa.swep.services.userdataaccessservice;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.xml.bind.annotation.XmlSeeAlso;

/**
 * This class was generated by Apache CXF 3.1.2
 * 2015-09-04T15:46:49.691+02:00
 * Generated source version: 3.1.2
 * 
 */
@WebService(targetNamespace = "http://esa.ssa.swe/swep/services/UserDataAccessService", name = "UserDataAccessServiceInterface")
@XmlSeeAlso({org.hisrc.w3c.xmlmime.v_1_0.ObjectFactory.class, org.hisrc.w3c.xop.include.v_1_0.ObjectFactory.class, net.opengis.gml.v_3_2_1.ObjectFactory.class, net.opengis.iso19139.gsr.v_20070417.ObjectFactory.class, net.opengis.swes.v_2_0.ObjectFactory.class, net.opengis.ows.v_1_1_0.ObjectFactory.class, swe.ssa.esa.swep.datamodel.metadata.ObjectFactory.class, org.hisrc.w3c.xlink.v_1_0.ObjectFactory.class, net.opengis.iso19139.gss.v_20070417.ObjectFactory.class, org.hisrc.w3c.oasis.wsn.t1.ObjectFactory.class, swe.ssa.esa.swep.datamodel.data.ObjectFactory.class, net.opengis.iso19139.gco.v_20070417.ObjectFactory.class, swe.ssa.esa.swep.datamodel.common.ObjectFactory.class, net.opengis.om.v_2_0.ObjectFactory.class, net.opengis.iso19139.gts.v_20070417.ObjectFactory.class, net.opengis.iso19139.gmd.v_20070417.ObjectFactory.class, swe.ssa.esa.swep.datamodel.userdataaccessservice.ObjectFactory.class, net.opengis.swecommon.v_2_0.ObjectFactory.class})
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
public interface UserDataAccessServiceInterface {

    @WebResult(name = "GetMetricsResponseMessage", targetNamespace = "http://esa.ssa.swe/swep/datamodel/UserDataAccessService", partName = "response")
    @WebMethod(action = "http://esa.ssa.swe/swep/services/UserDataAccessService/getMetrics")
    public swe.ssa.esa.swep.datamodel.userdataaccessservice.GetMetricsResponseMessageType getMetrics(
        @WebParam(partName = "request", name = "GetMetricsRequestMessage", targetNamespace = "http://esa.ssa.swe/swep/datamodel/UserDataAccessService")
        swe.ssa.esa.swep.datamodel.userdataaccessservice.GetMetricsRequestMessageType request
    ) throws UserDataAccessServiceInterfaceFault;

    @WebResult(name = "GetDataResponseMessage", targetNamespace = "http://esa.ssa.swe/swep/datamodel/UserDataAccessService", partName = "response")
    @WebMethod(action = "http://esa.ssa.swe/swep/services/UserDataAccessService/getData")
    public swe.ssa.esa.swep.datamodel.userdataaccessservice.GetDataResponseMessageType getData(
        @WebParam(partName = "request", name = "GetDataRequestMessage", targetNamespace = "http://esa.ssa.swe/swep/datamodel/UserDataAccessService")
        swe.ssa.esa.swep.datamodel.userdataaccessservice.GetDataRequestMessageType request
    ) throws UserDataAccessServiceInterfaceFault;

    @WebResult(name = "GetDataImportStatsResponseMessage", targetNamespace = "http://esa.ssa.swe/swep/datamodel/UserDataAccessService", partName = "response")
    @WebMethod(action = "http://esa.ssa.swe/swep/services/UserDataAccessService/getDataImportStats")
    public swe.ssa.esa.swep.datamodel.userdataaccessservice.GetDataImportStatsResponseMessageType getDataImportStats(
        @WebParam(partName = "request", name = "GetDataImportStatsRequestMessage", targetNamespace = "http://esa.ssa.swe/swep/datamodel/UserDataAccessService")
        swe.ssa.esa.swep.datamodel.userdataaccessservice.GetDataImportStatsRequestMessageType request
    ) throws UserDataAccessServiceInterfaceFault;

    @WebResult(name = "GetCapabilitiesResponseMessage", targetNamespace = "http://esa.ssa.swe/swep/datamodel/UserDataAccessService", partName = "response")
    @WebMethod(action = "http://esa.ssa.swe/swep/services/UserDataAccessService/getCapabilities")
    public swe.ssa.esa.swep.datamodel.userdataaccessservice.GetCapabilitiesResponseMessageType getCapabilities(
        @WebParam(partName = "request", name = "GetCapabilitiesRequestMessage", targetNamespace = "http://esa.ssa.swe/swep/datamodel/UserDataAccessService")
        swe.ssa.esa.swep.datamodel.userdataaccessservice.GetCapabilitiesRequestMessageType request
    ) throws UserDataAccessServiceInterfaceFault;
}
christophenoel commented 7 years ago

Are you still not able to generate Web Service using the bindings ? Thanks in advance.