All,
I am trying to get a web service to work using JiBX as the OXM. I started with the tutorial from http://krams915.blogspot.com/2010/12...t-200-rc2.html which uses Castor as the OXM. I can generate and bind the Java classes based on the supplied schema. However, when I try to invoke the web service I get the following SOAP fault
Here is the web service configuration:Code:<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Header/> <SOAP-ENV:Body> <SOAP-ENV:Fault> <faultcode>SOAP-ENV:Server</faultcode> <faultstring xml:lang="en">No adapter for endpoint [public org.krams.tutorial.oxm.SubscriptionResponse org.krams.tutorial.endpoint.SubscriptionEndpoint.processSubscription(org.krams.tutorial.oxm.SubscriptionRequest)]: Is your endpoint annotated with @Endpoint, or does it implement a supported interface like MessageHandler or PayloadEndpoint?</faultstring> </SOAP-ENV:Fault> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
I currently have the Castor marshallers commented out. If I put them back in - all is good. Can anyone point me in a direction for getting the JiBX marshallers wired up correctly? As a side note, for the final solution, I will need to have multiple JiBX marshallers configured.Code:<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:sws="http://www.springframework.org/schema/web-services" xmlns:oxm="http://www.springframework.org/schema/oxm" xsi:schemaLocation= "http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/web-services http://www.springframework.org/schema/web-services/web-services-2.0.xsd http://www.springframework.org/schema/oxm http://www.springframework.org/schema/oxm/spring-oxm-1.5.xsd"> <description> This web application context contains Spring-WS beans. The beans defined in this context are automatically detected by Spring-WS, similar to the way Controllers are picked up in Spring Web MVC. </description> <!-- We have two important URLa: WSDL: http://localhost:8080/{projectName}/{root-path}/{bean-name}.wsdl Example: http://localhost:8080/spring-ws-standalone/krams/subscription.wsdl Endpoint: http://localhost:8080/{projectName}/{root-path} Example: http://localhost:8080/spring-ws-standalone/krams These urls are based on the root path declared in the web.xml and in the SimpleUrlHandlerMapping --> <!-- Uses the latest feature from 2.0.0 RC2. Enables @Endpoint and related Spring-WS annotations. See Spring WS Reference 5.4--> <sws:annotation-driven /> <!-- Uses the latest feature from 2.0.0 RC2. Enables interceptor endpoints. See Spring WS Reference 5.5.2 Here we have an interceptor that validates XML request and a logger --> <sws:interceptors> <bean id="validatingInterceptor" class="org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor" p:schema="/WEB-INF/subscription.xsd" p:validateRequest="true" p:validateResponse="true"/> <bean id="loggingInterceptor" class="org.springframework.ws.server.endpoint.interceptor.PayloadLoggingInterceptor"/> </sws:interceptors> <!-- Uses the latest feature from 2.0.0 RC2. Enables publishing of wsdl. See Spring WS Reference 3.7 For dynamic location transformation to work, a special parameter must be added to the web.xml. --> <sws:dynamic-wsdl id="subscription" portTypeName="SubscriptionPort" locationUri="/krams/ws" targetNamespace="http://krams915.blogspot.com/ws/schema/oss"> <sws:xsd location="/WEB-INF/subscription.xsd"/> </sws:dynamic-wsdl> <!-- JiBX --> <oxm:jibx-marshaller id="marshaller" target-class="com.blogspot.krams915.ws.schema.oss.SubscriptionRequest"/> <oxm:jibx-marshaller id="unmarshaller" target-class="com.blogspot.krams915.ws.schema.oss.SubscriptionResponse"/> <bean id="marshallingPayloadMethodProcessor" class="org.springframework.ws.server.endpoint.adapter.method.MarshallingPayloadMethodProcessor"> <constructor-arg ref="marshaller"/> <constructor-arg ref="unmarshaller"/> </bean> <!-- Our mashaller. You can use any marshaller you want. For info on how to use Castor, see http://www.castor.org/xml-mapping.html#2.1-Marshalling-Behavior --> <!-- Castor <bean id="castorMarshaller" class="org.springframework.oxm.castor.CastorMarshaller" p:mappingLocation="/WEB-INF/castor-mapping.xml" /> --> <!-- Normally we use the GenericMarshallingMethodEndpointAdapter however if you read the Spring WS 2.0 API for this adapter: "Deprecated. as of Spring Web Services 2.0, in favor of DefaultMethodEndpointAdapter and MarshallingPayloadMethodProcessor." See http://static.springsource.org/spring-ws/sites/2.0/apidocs/org/springframework/ws/server/endpoint/adapter/GenericMarshallingMethodEndpointAdapter.html So we have to implement using the recommended implementation. The advantage of these two classes is that we have a pluggable adapter. For more info, check the Spring WS 2.0 API and its source code. --> <!-- Castor <bean id="marshallingPayloadMethodProcessor" class="org.springframework.ws.server.endpoint.adapter.method.MarshallingPayloadMethodProcessor"> <constructor-arg ref="castorMarshaller"/> <constructor-arg ref="castorMarshaller"/> </bean> --> <bean id="defaultMethodEndpointAdapter" class="org.springframework.ws.server.endpoint.adapter.DefaultMethodEndpointAdapter"> <property name="methodArgumentResolvers"> <list> <ref bean="marshallingPayloadMethodProcessor"/> </list> </property> <property name="methodReturnValueHandlers"> <list> <ref bean="marshallingPayloadMethodProcessor"/> </list> </property> </bean> </beans>


Reply With Quote