Announcement Announcement Module
Collapse
No announcement yet.
Help with Spring-as 1.5.4 and XMLBeans Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Help with Spring-as 1.5.4 and XMLBeans

    Hi,

    I am implementing the Web service using Spring ws 1.5.4. I am using XMLBeans as marshaller and Spring-ws annotations. I did one example and it worked fine. I am trying to implement Project with it,but running into problems.

    Here is my End Point

    Code:
    @Endpoint
    public class UserRegistrationEndPoint {
    
    
    	private IAPIWSServiceFactory wsServiceFactory;
    	
    	
    	private Marshaller marshaller;
    	
    	
    	private IUserRegistrationMapper userRegMapper;
    	
    	
    	
    	@PayloadRoot(localPart = "UserRegistrationRequest", namespace = "http://sumobrain.com/schemas/api-ws-messages")
    	 public Source getMoviesByGenreAndTitle(@XPathParam("//api:userRegistration")UserRegistrationType xmlBeanUserRegType) throws Exception {
    		 
    		UserRegistrationResponseDocument userRegResDoc=null;
    		MarshallingSource source=null;
    		 try{
    			 UserRegistrationVo userRegisVo=userRegMapper.mapToUserRegistrationVo(xmlBeanUserRegType);
    			 Integer userId=wsServiceFactory.getUserMngmtServices().insertOrUpdateUserRegistration(userRegisVo);
    			 
    			 String activationKey=APIBusinessUtils.genereateActivationKey(userRegisVo.getProfile().getEmailAddr(), userId);
    			 UserProfile userProfile=new UserProfile();
    			 userProfile.setUserId(userId);
    			 userProfile.setActivationKey(activationKey);
    			 wsServiceFactory.getUserMngmtServices().updateUserProfileSelective(userProfile);
    			 
    			 String content=APIBusinessUtils.createActivationMailContent(activationKey, "http://www.someurl.com/reg/", userRegisVo.getProfile().getEmailAddr());
    			 boolean flag=wsServiceFactory.getEmailService().sendMail(userRegisVo.getProfile().getEmailAddr(), 
    						"[email protected]","Yor registration with Freepatentsonline.com" , content);
    			 
    			 userRegResDoc=userRegMapper.createUserRegistrationResponse(flag);
    			 source=new MarshallingSource(marshaller, userRegResDoc);
    		 }catch (Exception e) {
    			 userRegResDoc=userRegMapper.createUserRegistrationResponse(false);
    			 source=new MarshallingSource(marshaller, userRegResDoc);
    		}
    		 return  source;
    		
    	}
    	
    	public void setMarshaller(Marshaller marshaller) {
    		this.marshaller = marshaller;
    	}
    
    	
    	@Autowired
    	public void setWsServiceFactory(IAPIWSServiceFactory wsServiceFactory) {
    		this.wsServiceFactory = wsServiceFactory;
    	}
    
    	public void setUserRegMapper(IUserRegistrationMapper userRegMapper) {
    		this.userRegMapper = userRegMapper;
    	}
    And Below is my Config file

    Code:
    <bean
    		class="org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping">
    		<property name="interceptors">
    			<list>
    				<bean
    					class="org.springframework.ws.server.endpoint.interceptor.PayloadLoggingInterceptor" />
    			</list>
    		</property>
    	</bean>
    
    	<bean
    		class="org.springframework.ws.server.endpoint.adapter.XPathParamAnnotationMethodEndpointAdapter">
    		<property name="namespaces">
    			<props>
    				<prop key="api">
    					http://sumobrain.com/schemas/api-ws-messages
    				</prop>
    				<prop key="user">
    					http://sumobrain.com/schemas/types/userRegistration
    				</prop>
    			</props>
    		</property>
    
    	</bean>
    
    	<bean id="marshaller"
    		class="org.springframework.oxm.xmlbeans.XmlBeansMarshaller">
    
    	</bean>
    
    	<bean id="userRegistrationEndPoint"
    		class="com.sumobrain.api.ws.endpoint.UserRegistrationEndPoint">
    		<property name="marshaller" ref="marshaller" />
    		<property name="userRegMapper" ref="userRegMapper" />
    	</bean>
    
    <bean id="userRegMapper"
    		class="com.sumobrain.api.ws.bindings.UserRegistrationMapperImpl" />
    
    
    
    
    	<bean id="schemaCollection"
    		class="org.springframework.xml.xsd.commons.CommonsXsdSchemaCollection">
    		<property name="xsds"
    			value="/WEB-INF/schema/api-ws-messages.xsd" />
    		<property name="inline" value="true" />
    	</bean>
    And here is the Log file

    Code:
    2008-11-30 23:21:16,815 DEBUG [org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping] - <Looking up endpoint for [{http://sumobrain.com/schemas/api-ws-messages}UserRegistrationRequest]>
    2008-11-30 23:21:16,815 DEBUG [org.springframework.ws.soap.server.SoapMessageDispatcher] - <Endpoint mapping [org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping@1021e58] maps request to endpoint [public javax.xml.transform.Source com.sumobrain.api.ws.endpoint.UserRegistrationEndPoint.getMoviesByGenreAndTitle(com.sumobrain.schemas.types.userRegistration.UserProfileType) throws java.lang.Exception]>
    2008-11-30 23:21:16,831 DEBUG [org.springframework.ws.server.endpoint.interceptor.PayloadLoggingInterceptor] - <Request: <api:UserRegistrationRequest xmlns:api="http://sumobrain.com/schemas/api-ws-messages">
             <api:userRegistration>
                <user:profile xmlns:user="http://sumobrain.com/schemas/types/userRegistration">
                   <user:userId/>
                   <user:userName>Test User</user:userName>
                   <user:emailAddr>[email protected]</user:emailAddr>
                   <user:occupationId>2</user:occupationId>
                   <user:signupDate>2008-11-30T20:52:47.032-05:00</user:signupDate>
                   <user:siteId>1</user:siteId>
                   <user:userRole>ROLE_USER</user:userRole>
                   <user:maxPortfolios>10</user:maxPortfolios>
                   <user:maxPortfolioDocs>10</user:maxPortfolioDocs>
                   <user:maxSavedSearch>10</user:maxSavedSearch>
                   <user:activationKey/>
                </user:profile>
             </api:userRegistration>
          </api:UserRegistrationRequest>>
    2008-11-30 23:21:16,831 DEBUG [org.springframework.ws.soap.server.SoapMessageDispatcher] - <Testing endpoint adapter [org.springframework.ws.server.endpoint.adapter.XPathParamAnnotationMethodEndpointAdapter@6076f4]>
    2008-11-30 23:21:16,878 DEBUG [org.springframework.ws.soap.server.SoapMessageDispatcher] - <Endpoint invocation resulted in exception - responding with Fault>
    java.lang.IllegalStateException: No adapter for endpoint [public javax.xml.transform.Source com.sumobrain.api.ws.endpoint.UserRegistrationEndPoint.getMoviesByGenreAndTitle(com.sumobrain.schemas.types.userRegistration.UserProfileType) throws java.lang.Exception]: Does your endpoint implement a supported interface like MessageHandler or PayloadEndpoint?
    	at org.springframework.ws.server.MessageDispatcher.getEndpointAdapter(MessageDispatcher.java:279)
    	at org.springframework.ws.server.MessageDispatcher.dispatch(MessageDispatcher.java:220)
    	at org.springframework.ws.server.MessageDispatcher.receive(MessageDispatcher.java:168)
    	at org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handleConnection(WebServiceMessageReceiverObjectSupport.java:88)
    	at org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java:57)
    	at org.springframework.ws.transport.http.MessageDispatcherServlet.doService(MessageDispatcherServlet.java:230)
    	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
    	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:511)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
    	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
    	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    	at java.lang.Thread.run(Unknown Source)
    2008-11-30 23:21:16,878 DEBUG [org.springframework.ws.server.MessageTracing.sent] - <Sent response ..


    Any Help is greatly appreciated. Thanks in Advance
    Last edited by spring.user; Dec 1st, 2008, 08:50 AM.

  • #2
    Solved it

    I moved to JAXB instead of XMLBeans and XPath. It's working now.

    Comment

    Working...
    X