You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Martin Saucier <ma...@vrmtechnologies.com> on 2010/09/23 14:59:27 UTC

CXF with Grails issue

  Hello everyone,
    I am running into an issue with CXF and Grails and need some help 
... I am using the CXF plugin for Grails, I created the following 
service class :

@WebService(serviceName='CustomerManagementService', 
targetNamespace="http://api.vrmtechnologies.com/")
class CustomerManagementService {

     static expose=['cxfjax']

     def customerService

     @WebResult(name="retrieveCustomersResult")
     @WebMethod(operationName="retrieveCustomers")
     List<Customer> retrieveCustomers(@WebParam(name="dealershipId")Long 
id) {
         return customerService.retrieveCustomers(id)
     }
}

When I run my Grails application, Groovy automatically generates getter 
and setter for the customerService variable (getCustomerService, 
setCustomerService) and even if I do not annotate the getter and setter 
methods with @WebMethod, the wsdl generated include web service methods 
for getCustomerService, setCustomerService (see below). Is there ANY WAY 
to prevent the getter and setter methods to be published as web methods 
??? Anyone running into the same issue ? Are you using the plugin for 
CXF with Grails or manually creating the endpoints and servlet yourself ?

Thanks,

Martin

<?xml version='1.0' encoding='UTF-8'?><wsdl:definitions 
name="CustomerManagementService" 
targetNamespace="http://api.vrmtechnologies.com/" 
xmlns:ns1="http://schemas.xmlsoap.org/wsdl/soap/http" 
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
xmlns:tns="http://api.vrmtechnologies.com/" 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<xs:schema elementFormDefault="unqualified" 
targetNamespace="http://api.vrmtechnologies.com/" version="1.0" 
xmlns:tns="http://api.vrmtechnologies.com/" 
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="getCustomerService" type="tns:getCustomerService" />
<xs:element name="getCustomerServiceResponse" 
type="tns:getCustomerServiceResponse" />
<xs:element name="retrieveCustomers" type="tns:retrieveCustomers" />
<xs:element name="retrieveCustomersResponse" 
type="tns:retrieveCustomersResponse" />
<xs:element name="setCustomerService" type="tns:setCustomerService" />
<xs:element name="setCustomerServiceResponse" 
type="tns:setCustomerServiceResponse" />
<xs:complexType name="getCustomerService">
<xs:sequence />
</xs:complexType>
<xs:complexType name="getCustomerServiceResponse">
<xs:sequence>
<xs:element minOccurs="0" name="return" type="xs:anyType" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="retrieveCustomers">
<xs:sequence>
<xs:element minOccurs="0" name="dealershipId" type="xs:long" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="retrieveCustomersResponse">
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" 
name="retrieveCustomersResult" type="tns:customer" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="customer">
<xs:sequence>
<xs:element minOccurs="0" name="dateCreated" type="xs:dateTime" />
<xs:element minOccurs="0" name="lastUpdated" type="xs:dateTime" />
<xs:element minOccurs="0" name="firstName" type="xs:string" />
<xs:element minOccurs="0" name="lastName" type="xs:string" />
<xs:element minOccurs="0" name="email" type="xs:string" />
<xs:element minOccurs="0" name="id" type="xs:long" />
<xs:element minOccurs="0" name="version" type="xs:long" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="setCustomerService">
<xs:sequence>
<xs:element minOccurs="0" name="arg0" type="xs:anyType" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="setCustomerServiceResponse">
<xs:sequence />
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="setCustomerServiceResponse">
<wsdl:part element="tns:setCustomerServiceResponse" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="setCustomerService">
<wsdl:part element="tns:setCustomerService" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="getCustomerService">
<wsdl:part element="tns:getCustomerService" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="retrieveCustomers">
<wsdl:part element="tns:retrieveCustomers" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="retrieveCustomersResponse">
<wsdl:part element="tns:retrieveCustomersResponse" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="getCustomerServiceResponse">
<wsdl:part element="tns:getCustomerServiceResponse" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="CustomerManagementService">
<wsdl:operation name="getCustomerService">
<wsdl:input message="tns:getCustomerService" name="getCustomerService">
</wsdl:input>
<wsdl:output message="tns:getCustomerServiceResponse" 
name="getCustomerServiceResponse">
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="retrieveCustomers">
<wsdl:input message="tns:retrieveCustomers" name="retrieveCustomers">
</wsdl:input>
<wsdl:output message="tns:retrieveCustomersResponse" 
name="retrieveCustomersResponse">
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="setCustomerService">
<wsdl:input message="tns:setCustomerService" name="setCustomerService">
</wsdl:input>
<wsdl:output message="tns:setCustomerServiceResponse" 
name="setCustomerServiceResponse">
</wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="CustomerManagementServiceSoapBinding" 
type="tns:CustomerManagementService">
<soap:binding style="document" 
transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="getCustomerService">
<soap:operation soapAction="" style="document" />
<wsdl:input name="getCustomerService">
<soap:body use="literal" />
</wsdl:input>
<wsdl:output name="getCustomerServiceResponse">
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="retrieveCustomers">
<soap:operation soapAction="" style="document" />
<wsdl:input name="retrieveCustomers">
<soap:body use="literal" />
</wsdl:input>
<wsdl:output name="retrieveCustomersResponse">
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="setCustomerService">
<soap:operation soapAction="" style="document" />
<wsdl:input name="setCustomerService">
<soap:body use="literal" />
</wsdl:input>
<wsdl:output name="setCustomerServiceResponse">
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="CustomerManagementService">
<wsdl:port binding="tns:CustomerManagementServiceSoapBinding" 
name="CustomerManagementServicePort">
<soap:address 
location="http://localhost:8080/Phoenix/services/customerManagement" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

---

Martin Saucier
Solutions Architect | VRM Technologies Ltd.

T: 506.874.8906
E: martin.saucier@vrmtechnologies.com 
<ma...@vrmtechnologies.com>
http://www.vrmtechnologies.com
Contact Me Linkedin <http://ca.linkedin.com/in/martinsaucier>Twitter 
<http://twitter.com/martinsaucier>


Re: CXF with Grails issue

Posted by Daniel Kulp <dk...@apache.org>.
This may be best to post to the grails list.  I'm not really sure.

The two options I can think of are:
1) Manually add getter/setter methods and a @WebMethod(exclude = true) 
annotation to them.  That should make the runtime ignore them.

2) Move the methods you WANT exposed to an individual interface and make your 
class implement that interface.   Add the endpointInterface attribute to your 
@WebService annotation.  Thus, only the methods on that interface should be 
exposed.

Hope one of them helps.


Dan


On Thursday 23 September 2010 8:59:27 am Martin Saucier wrote:
>   Hello everyone,
>     I am running into an issue with CXF and Grails and need some help
> ... I am using the CXF plugin for Grails, I created the following
> service class :
> 
> @WebService(serviceName='CustomerManagementService',
> targetNamespace="http://api.vrmtechnologies.com/")
> class CustomerManagementService {
> 
>      static expose=['cxfjax']
> 
>      def customerService
> 
>      @WebResult(name="retrieveCustomersResult")
>      @WebMethod(operationName="retrieveCustomers")
>      List<Customer> retrieveCustomers(@WebParam(name="dealershipId")Long
> id) {
>          return customerService.retrieveCustomers(id)
>      }
> }
> 
> When I run my Grails application, Groovy automatically generates getter
> and setter for the customerService variable (getCustomerService,
> setCustomerService) and even if I do not annotate the getter and setter
> methods with @WebMethod, the wsdl generated include web service methods
> for getCustomerService, setCustomerService (see below). Is there ANY WAY
> to prevent the getter and setter methods to be published as web methods
> ??? Anyone running into the same issue ? Are you using the plugin for
> CXF with Grails or manually creating the endpoints and servlet yourself ?
> 
> Thanks,
> 
> Martin
> 
> <?xml version='1.0' encoding='UTF-8'?><wsdl:definitions
> name="CustomerManagementService"
> targetNamespace="http://api.vrmtechnologies.com/"
> xmlns:ns1="http://schemas.xmlsoap.org/wsdl/soap/http"
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> xmlns:tns="http://api.vrmtechnologies.com/"
> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> <wsdl:types>
> <xs:schema elementFormDefault="unqualified"
> targetNamespace="http://api.vrmtechnologies.com/" version="1.0"
> xmlns:tns="http://api.vrmtechnologies.com/"
> xmlns:xs="http://www.w3.org/2001/XMLSchema">
> <xs:element name="getCustomerService" type="tns:getCustomerService" />
> <xs:element name="getCustomerServiceResponse"
> type="tns:getCustomerServiceResponse" />
> <xs:element name="retrieveCustomers" type="tns:retrieveCustomers" />
> <xs:element name="retrieveCustomersResponse"
> type="tns:retrieveCustomersResponse" />
> <xs:element name="setCustomerService" type="tns:setCustomerService" />
> <xs:element name="setCustomerServiceResponse"
> type="tns:setCustomerServiceResponse" />
> <xs:complexType name="getCustomerService">
> <xs:sequence />
> </xs:complexType>
> <xs:complexType name="getCustomerServiceResponse">
> <xs:sequence>
> <xs:element minOccurs="0" name="return" type="xs:anyType" />
> </xs:sequence>
> </xs:complexType>
> <xs:complexType name="retrieveCustomers">
> <xs:sequence>
> <xs:element minOccurs="0" name="dealershipId" type="xs:long" />
> </xs:sequence>
> </xs:complexType>
> <xs:complexType name="retrieveCustomersResponse">
> <xs:sequence>
> <xs:element maxOccurs="unbounded" minOccurs="0"
> name="retrieveCustomersResult" type="tns:customer" />
> </xs:sequence>
> </xs:complexType>
> <xs:complexType name="customer">
> <xs:sequence>
> <xs:element minOccurs="0" name="dateCreated" type="xs:dateTime" />
> <xs:element minOccurs="0" name="lastUpdated" type="xs:dateTime" />
> <xs:element minOccurs="0" name="firstName" type="xs:string" />
> <xs:element minOccurs="0" name="lastName" type="xs:string" />
> <xs:element minOccurs="0" name="email" type="xs:string" />
> <xs:element minOccurs="0" name="id" type="xs:long" />
> <xs:element minOccurs="0" name="version" type="xs:long" />
> </xs:sequence>
> </xs:complexType>
> <xs:complexType name="setCustomerService">
> <xs:sequence>
> <xs:element minOccurs="0" name="arg0" type="xs:anyType" />
> </xs:sequence>
> </xs:complexType>
> <xs:complexType name="setCustomerServiceResponse">
> <xs:sequence />
> </xs:complexType>
> </xs:schema>
> </wsdl:types>
> <wsdl:message name="setCustomerServiceResponse">
> <wsdl:part element="tns:setCustomerServiceResponse" name="parameters">
> </wsdl:part>
> </wsdl:message>
> <wsdl:message name="setCustomerService">
> <wsdl:part element="tns:setCustomerService" name="parameters">
> </wsdl:part>
> </wsdl:message>
> <wsdl:message name="getCustomerService">
> <wsdl:part element="tns:getCustomerService" name="parameters">
> </wsdl:part>
> </wsdl:message>
> <wsdl:message name="retrieveCustomers">
> <wsdl:part element="tns:retrieveCustomers" name="parameters">
> </wsdl:part>
> </wsdl:message>
> <wsdl:message name="retrieveCustomersResponse">
> <wsdl:part element="tns:retrieveCustomersResponse" name="parameters">
> </wsdl:part>
> </wsdl:message>
> <wsdl:message name="getCustomerServiceResponse">
> <wsdl:part element="tns:getCustomerServiceResponse" name="parameters">
> </wsdl:part>
> </wsdl:message>
> <wsdl:portType name="CustomerManagementService">
> <wsdl:operation name="getCustomerService">
> <wsdl:input message="tns:getCustomerService" name="getCustomerService">
> </wsdl:input>
> <wsdl:output message="tns:getCustomerServiceResponse"
> name="getCustomerServiceResponse">
> </wsdl:output>
> </wsdl:operation>
> <wsdl:operation name="retrieveCustomers">
> <wsdl:input message="tns:retrieveCustomers" name="retrieveCustomers">
> </wsdl:input>
> <wsdl:output message="tns:retrieveCustomersResponse"
> name="retrieveCustomersResponse">
> </wsdl:output>
> </wsdl:operation>
> <wsdl:operation name="setCustomerService">
> <wsdl:input message="tns:setCustomerService" name="setCustomerService">
> </wsdl:input>
> <wsdl:output message="tns:setCustomerServiceResponse"
> name="setCustomerServiceResponse">
> </wsdl:output>
> </wsdl:operation>
> </wsdl:portType>
> <wsdl:binding name="CustomerManagementServiceSoapBinding"
> type="tns:CustomerManagementService">
> <soap:binding style="document"
> transport="http://schemas.xmlsoap.org/soap/http" />
> <wsdl:operation name="getCustomerService">
> <soap:operation soapAction="" style="document" />
> <wsdl:input name="getCustomerService">
> <soap:body use="literal" />
> </wsdl:input>
> <wsdl:output name="getCustomerServiceResponse">
> <soap:body use="literal" />
> </wsdl:output>
> </wsdl:operation>
> <wsdl:operation name="retrieveCustomers">
> <soap:operation soapAction="" style="document" />
> <wsdl:input name="retrieveCustomers">
> <soap:body use="literal" />
> </wsdl:input>
> <wsdl:output name="retrieveCustomersResponse">
> <soap:body use="literal" />
> </wsdl:output>
> </wsdl:operation>
> <wsdl:operation name="setCustomerService">
> <soap:operation soapAction="" style="document" />
> <wsdl:input name="setCustomerService">
> <soap:body use="literal" />
> </wsdl:input>
> <wsdl:output name="setCustomerServiceResponse">
> <soap:body use="literal" />
> </wsdl:output>
> </wsdl:operation>
> </wsdl:binding>
> <wsdl:service name="CustomerManagementService">
> <wsdl:port binding="tns:CustomerManagementServiceSoapBinding"
> name="CustomerManagementServicePort">
> <soap:address
> location="http://localhost:8080/Phoenix/services/customerManagement" />
> </wsdl:port>
> </wsdl:service>
> </wsdl:definitions>
> 
> ---
> 
> Martin Saucier
> Solutions Architect | VRM Technologies Ltd.
> 
> T: 506.874.8906
> E: martin.saucier@vrmtechnologies.com
> <ma...@vrmtechnologies.com>
> http://www.vrmtechnologies.com
> Contact Me Linkedin <http://ca.linkedin.com/in/martinsaucier>Twitter
> <http://twitter.com/martinsaucier>

-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog