spring-ws icon indicating copy to clipboard operation
spring-ws copied to clipboard

@Endpoint with primitive data types - No adapter for endpoint [SWS-1016]

Open gregturn opened this issue 7 years ago • 5 comments

Marc Steiner opened SWS-1016 and commented

Hi, i am trying to provide a SOAP endpoint over a spring boot application with the @Endpoint-annotation. My Response which I want consists of just a simple boolean:

Request:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Header/>
   <soap:Body>
      <ns:isActiveRequest xmlns:ns=\"http://problem.com\"><id>1234</id></ns:isActiveRequest>
   </soap:Body>
</soap:Envelope>

desired Response:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Header/>
   <soap:Body>
      <ns:isActiveResponse xmlns:ns="http://problem.com">true</ns3:isActiveResponse>
   </soap:Body>
</soap:Envelope>

The java classes i use in my spring boot application are generated by CXF WSDL2Java. From there i get an interface which gives me the return value boolean.

The problem is that @Endpoint is not able to detect my SOAP endpoint for my "isActiveRequest". https://github.com/PhoenixNeoCode/problem-app/blob/master/src/main/java/com/problem/endpoint/SoapEndpoint.java I dont know how to define it in my WSDL that @Endpoint is able to detect my simple soap operation. https://github.com/PhoenixNeoCode/problem-app/blob/master/src/main/resources/wsdl/Problem.wsdl

Usually i have no problems with CXF and Endpoint with complex response types, because it generates an @XmlRootElement. But it wont do that with a primitive type in the response and is not able to recognize my method under the @Endpoint-Annotation.

I have provided two unittests in my github project to show the problem in detail. One is Ignored so you can "gradle build" it. The other one "readSomethingSoap" which works is for comparison with a complex return value which gives a @XmlRootElement. https://github.com/PhoenixNeoCode/problem-app/blob/master/src/test/java/com/problem/endpoint/SoapEndpointTests.java

The spring-ws version i used in the sample project is a bit older but i also tried it with the newest and it still was not working.

My related stackoverflow issue: https://stackoverflow.com/questions/49796784/endpoint-with-primitive-data-types-no-adapter-for-endpoint

My sample GitHub Project: https://github.com/PhoenixNeoCode/problem-app


Affects: 3.0.0.RELEASE

Reference URL: https://github.com/PhoenixNeoCode/problem-app

1 votes, 2 watchers

gregturn avatar Apr 17 '18 11:04 gregturn

Any solution for this problem I am facing the same problem After I send the request Instead of desired output it gives

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> SOAP-ENV:Header/ SOAP-ENV:Body SOAP-ENV:Fault SOAP-ENV:Server No adapter for endpoint [public com.mphrx.soapapitut.patientxsdpojo.PatientResponse com.mphrx.soapapitut.endpoint.PatientEndPoint.getPatientResponse(com.mphrx.soapapitut.patientxsdpojo.PatientRequest)]: Is your endpoint annotated with @Endpoint, or does it implement a supported interface like MessageHandler or PayloadEndpoint? </SOAP-ENV:Fault> </SOAP-ENV:Body> </SOAP-ENV:Envelope>

shahiakhilesh1304 avatar Dec 05 '22 09:12 shahiakhilesh1304

Did you guys find any solution for this?

kavish-chathuranga avatar Dec 08 '22 10:12 kavish-chathuranga

Hi @kavish-chathuranga, The issue has been resolved as the issue mentioned above is the issue due to the pom.xml file included dependency. the project was unable to find the JAXB2 dependency perfectly so this project was unable to Link the Pojo with XML. Here, I am attaching my git link check and rectify your code accordingly

PROJECT LINK

shahiakhilesh1304 avatar Dec 11 '22 18:12 shahiakhilesh1304

Thank you @shahiakhilesh1304

kavish-chathuranga avatar Dec 12 '22 05:12 kavish-chathuranga