Grails Exception: qname mapping not like for package: grails.validation

I am trying to create a simple SOAP web service (basic CRUD) using Grails with the Apache Axis2 plugin.

Everything works well with methods that have a simple return type (e.g. String, int).

The problem is trying to get a domain class object:

class Hotel { static mapping = { datasource 'hotel' table 'hotel' version false hotelId column:'id', insertable: false, updateable: false hotelName column:'hotel_name', sqlType:'varchar', name:'hotelName' } Integer hotelId String hotelName static constraints = { hotelId(max: 2147483647) hotelName(size:1..100) } } 

I have the following methods inside my service class:

 class HotelService { static expose=['axis2'] boolean transactional = false String sayHello(String name) { return "Hello ${name}!" } Hotel soapGetHotel(int id){ return Hotel.get(id) } } 

Running curl for soapGetHotel (int id) gives me this error:

 | Error 2012-11-13 15:29:46,142 [http-bio-8080-exec-3] ERROR engine.AxisEngine - java.lang.RuntimeException: org.apache.axis2.AxisFault: Mapping qname not fond for the package: grails.validation Message: java.lang.RuntimeException: org.apache.axis2.AxisFault: Mapping qname not fond for the package: grails.validation 

Please see my soap-xml file below:

 <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" soap:encodingStyle="http://www.w3.org/2003/05/soap-encoding"> <soap:Body xmlns:m="http://ws.com"> <m:soapGetHotel> <m:id>13</m:id> </m:soapGetHotel> </soap:Body> </soap:Envelope> 

And the curl command:

 curl --verbose --request POST --header "Content-Type: application/soap+xml" --data @gethotel.xml http://localhost:8080/wsexample/services/hotel 

I believe that this is due to the axis, which cannot find a mapping for the object. I tried to solve the problem as described in the accepted answer here: Axis2 does not return its own objects , but no luck, I still get the error.

I followed all the steps described in the axis2 grails documentation.

Any thoughts on how to solve this problem?

Thanks.

+4
source share
1 answer

The Axis plugin is quite old, and it seems that it has not been updated for the last 3 years. I would suggest using the CXF plugin as an alternative. In our projects, it turned out great!

0
source

Source: https://habr.com/ru/post/1445772/


All Articles