Announcement Announcement Module
Collapse
No announcement yet.
Using xmlBeans Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using xmlBeans

    Has anyone got a good example of this. I have a webservice that extended the AbstractDomPayloadEndpoint, this works just lovely, but I want to take away the code for recieving and responding, and replace it with xmlBean mapping. I thought this would be as simple as changing my endpoint to extend the AbstractMarchallingPayloadEndpoint, setting up the xmlBean marshaller and unmarshaller in the spring config, and then wiring them to my endpoint. unfortunately I get the following message:

    java.lang.IllegalStateException: No adapter for endpoint [uk.org.rspca.ws.cms.TaxonomyEndpoint@165b7e]: Does your endpoint implement a supported interface like MessageHandler or PayloadEndpoint?

    little confused at this point, do I need to write an adapter for this approach to work?

    Any help would be apprieciated...
    Last edited by ma_crice; Jun 20th, 2008, 05:12 AM. Reason: title may have been a little miss-leading

  • #2
    It should be as simple as extending AbstractMarchallingPayloadEndpoint, so I have no idea what is going wrong. Can you post the code of your endpoint class?

    Comment


    • #3
      Code Requested

      Hi Arjen,

      Thanx for the reply. I have recently taken part in A Spring Web Service Taining course run by Russ Miles, which was really worth while, but didn't cover this specific topic. Your help is much apprieciated.

      taxonomy-servlet-config:
      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:tx="http://www.springframework.org/schema/tx"
      	xsi:schemaLocation="http://www.springframework.org/schema/beans
      							http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
      
      	<bean
      		class="org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping">
      		<property name="defaultEndpoint" ref="taxonomyEndpoint" />
      	</bean>
      
      	<bean id="animalTaxonomy"
      		class="org.springframework.ws.wsdl.wsdl11.DynamicWsdl11Definition">
      		<property name="builder">
      			<bean
      				class="org.springframework.ws.wsdl.wsdl11.builder.XsdBasedSoap11Wsdl4jDefinitionBuilder">
      				<property name="schema"
      					value="/WEB-INF/schemas/taxonomy-service.xsd" />
      				<property name="portTypeName" value="Taxonomy" />
      				<property name="locationUri"
      					value="http://localhost:8080/ContentService/taxonomy" />
      			</bean>
      		</property>
      	</bean>
      	<bean id="taxonomyEndpoint"
      		class="uk.org.rspca.ws.cms.TaxonomyEndpoint">
      		<constructor-arg ref="taxonomy" />
      		<property name="marshaller"><ref bean="xmlbeansMarshaller"/></property>
      		<property name="unmarshaller"><ref bean="xmlbeansMarshaller"/></property>
      	</bean>
      	<bean id="xmlbeansMarshaller"
      		class="org.springframework.oxm.xmlbeans.XmlBeansMarshaller" />
      	<bean		class="org.springframework.ws.server.endpoint.adapter.MarshallingMethodEndpointAdapter">
      		<property name="marshaller" ref="xmlbeansMarshaller" />
      		<property name="unmarshaller" ref="xmlbeansMarshaller" />
      	</bean>
      </beans>

      TaxonomyEndpoint.java
      Code:
      package uk.org.rspca.ws.cms;
      
      import java.util.Iterator;
      
      
      import org.springframework.util.xml.DomUtils;
      import org.springframework.ws.server.endpoint.AbstractDomPayloadEndpoint;
      import org.springframework.ws.server.endpoint.AbstractMarshallingPayloadEndpoint;
      import org.springframework.ws.server.endpoint.annotation.PayloadRoot;
      import org.w3c.dom.Document;
      import org.w3c.dom.Element;
      
      import uk.org.rspca.cms.Taxonomy;
      import uk.org.rspca.cms.TaxonomyEngine;
      import uk.org.rspca.schemas.type.taxonomy.AnimalTaxonomyRequestDocument;
      import uk.org.rspca.schemas.type.taxonomy.AnimalTaxonomyResponseDocument;
      import uk.org.rspca.schemas.type.taxonomy.TaxonomyType;
      import uk.org.rspca.schemas.type.taxonomy.AnimalTaxonomyRequestDocument.AnimalTaxonomyRequest;
      import uk.org.rspca.schemas.type.taxonomy.AnimalTaxonomyResponseDocument.AnimalTaxonomyResponse;
      import uk.org.rspca.schemas.type.taxonomy.impl.AnimalTaxonomyRequestDocumentImpl;
      import uk.org.rspca.schemas.type.taxonomy.impl.AnimalTaxonomyResponseDocumentImpl;
      import uk.org.rspca.schemas.type.taxonomy.impl.AnimalTaxonomyResponseDocumentImpl.AnimalTaxonomyResponseImpl;
      
      public class TaxonomyEndpoint extends AbstractMarshallingPayloadEndpoint  {
      
      	private TaxonomyEngine taxonomyEngine;
      
      	private static final String NAMESPACE_URI = "http://www.rspca.org.uk/schemas/type/taxonomy";
      	
      	public TaxonomyEndpoint() {
      		// TODO Auto-generated constructor stub
      	}
      	
      	public TaxonomyEndpoint(TaxonomyEngine tEngine) {
      		this.taxonomyEngine = tEngine;
      	}
      
      	@Override
      	protected Object invokeInternal(Object request) throws Exception {
      		AnimalTaxonomyRequestDocument doc = (AnimalTaxonomyRequestDocument)request;
      		System.out.println(doc.getAnimalTaxonomyRequest().getFilter());
      		// Process Data based on filter
      		// Populate AnimalTaxonomyResponseObject
      		
      		return AnimalTaxonomyResponseDocument.Factory.newInstance();
      	}
      Thanx

      mARK
      Last edited by ma_crice; Jun 20th, 2008, 08:12 AM. Reason: copied wrong piece of code

      Comment


      • #4
        I don't see anything wrong with the code you posted. Could you also post the log contents at DEBUG level, including startup messages? That shows me what endpoints are supported and which aren't.

        Comment


        • #5
          Log file contents

          Environment:

          OS: Windows XP sp2
          App Server: Tomcat 6

          Included jars:
          Code:
          C:\wrkspc\cms\repository\spring\spring-ws\1.5.2\spring-oxm-1.5.2.jar
          C:\wrkspc\cms\repository\spring\spring-ws\1.5.2\spring-oxm-tiger-1.5.2.jar
          C:\wrkspc\cms\repository\spring\spring-ws\1.5.2\spring-ws-core-1.5.2.jar
          C:\wrkspc\cms\repository\spring\spring-ws\1.5.2\spring-ws-core-tiger-1.5.2.jar
          C:\wrkspc\cms\repository\spring\spring-ws\1.5.2\spring-ws-security-1.5.2.jar
          C:\wrkspc\cms\repository\spring\spring-ws\1.5.2\spring-ws-support-1.5.2.jar
          C:\wrkspc\cms\repository\spring\spring-ws\1.5.2\spring-xml-1.5.2.jar
          C:\wrkspc\cms\repository\log4j\log4j-1.2.13.jar
          C:\wrkspc\cms\repository\xml\JAXB2\activation.jar
          C:\wrkspc\cms\repository\xml\JAXB2\jaxb1-impl.jar
          C:\wrkspc\cms\repository\xml\JAXB2\jaxb-api.jar
          C:\wrkspc\cms\repository\xml\JAXB2\jaxb-impl.jar
          C:\wrkspc\cms\repository\xml\JAXB2\jaxb-xjc.jar
          C:\wrkspc\cms\repository\xml\JAXB2\jsr173_1.0_api.jar
          C:\wrkspc\cms\repository\apache-commons\logging\commons-logging-1.1.1.jar
          C:\wrkspc\cms\repository\wsdl\wsdl4j-1.6.1.jar
          C:\wrkspc\cms\repository\saaj\saaj-api-1.3.jar
          C:\wrkspc\cms\repository\saaj\saaj-impl-1.3.jar
          C:\wrkspc\cms\repository\spring\beans\org.springframework.beans-2.5.4.A.jar
          C:\wrkspc\cms\repository\spring\core\org.springframework.core-2.5.4.A.jar
          C:\wrkspc\cms\repository\spring\web\org.springframework.web-2.5.4.A.jar
          C:\wrkspc\cms\repository\spring\Context\org.springframework.context-2.5.4.A.jar
          C:\wrkspc\cms\repository\spring\servlet\org.springframework.web.servlet-2.5.4.A.jar
          C:\wrkspc\cms\repository\xml\xmlBeans\xbean.jar
          Last but not least.... the log file contents with root log level set to DEBUG is atatched.

          Note: the logging output is the result of a WSDL discovery, and a call to the animalTaxonomy Service.

          Comment


          • #6
            Still no joy

            Any update for me Arjen

            Comment


            • #7
              Possible misnamed bean in config XML?

              Should reference 'ref=taxonomy' in your spring config file be 'ref=animalTaxonomy' ?

              Comment


              • #8
                Thanx for the offer of help...

                What I have is correct. There is a spring config file which sets up service objects that was not included in what I posted.

                Thanx for at least replying though - I still haven't had much luck with this! Have yuo used the xmlBean marshalling?

                Comment


                • #9
                  Yup - I use XmlBeans - It worked for me pretty much out of the box....

                  I don't see any obvious issues with your configuration either

                  -Oliver

                  Comment


                  • #10
                    Can I borrow it?

                    I don't supose you have that example handy, and that I could have a look and compare it to mine? Would be really useful...

                    Comment


                    • #11
                      Finally - I got there!

                      I have finnaly solved the problem with a little help from a colleague. The problem was the adapter class I specified in the spring-ws config:

                      Code:
                      	<bean id="xmlbeansMarshaller"
                      		class="org.springframework.oxm.xmlbeans.XmlBeansMarshaller" />
                      	<bean		class="org.springframework.ws.server.endpoint.adapter.MarshallingMethodEndpointAdapter">
                      		<property name="marshaller" ref="xmlbeansMarshaller" />
                      		<property name="unmarshaller" ref="xmlbeansMarshaller" />
                      	</bean>
                      the second bean declaration I had should not be there: once I took this out it worked fine

                      I can't remember where I took the example from, but hopefully if anyone else does the same they will end up on this thread and get the answer quickly....

                      Good luck

                      Comment


                      • #12
                        XMLBeans example

                        hi All,
                        I m working with Spring Web Services using XML beans , Active MQ configuration where can I find the better example of both , I would prefer the full example .
                        I hope some one helps me ...

                        Regards,
                        pranay

                        Comment


                        • #13
                          Spring webservices...

                          I use Psring webservices quite frequently, but have never used Active MQ. I may be able to help you out with an example for the Spring WS with xmlBeans...

                          Comment


                          • #14
                            Hello ma_crice ,
                            Thanks a lot It will be very nice of you if you give me an complete example of WS using xmlbeans,
                            presently I m getting this error

                            org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'partyService' defined in ServletContext resource [/WEB-INF/spring-ws-servlet.xml]: Invocation of init method failed; nested exception is java.lang.ClassCastException: org.apache.xerces.parsers.XML11Configuration cannot be cast to org.apache.xerces.xni.parser.XMLParserConfiguratio n.

                            I m attaching the config file
                            extention change to .txt

                            The attached config file has some commented code but it doesnt make any difference ,
                            I have reverted my code to some back settings but still it did not work , I gess some settings with tomcat ?
                            Last edited by pranayjoshi; May 14th, 2009, 12:33 PM.

                            Comment


                            • #15
                              please can any one send me sample example on spring web services using xml beans

                              Comment

                              Working...
                              X