Announcement Announcement Module
Collapse
No announcement yet.
automatic end point marshalling Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • automatic end point marshalling

    Hi,

    I have successfully implemented spring ws services and clients and found it cumbersome to create end point marshaling using XPath or parsing the Elements and Nodes directly.

    Spring ws does a great job of creating the WSDL file from an .xsd schema but why do I have to map the client request to an object manually in my end point using XPath or by getting the String value from each Element using element.getChildText(.......)

    Does Spring ws have any way of automatically generating a mapping from a schema file, or is this planned in further releases?

    I imagine it would be the obvious next step and should be fairly easy to implement, if its not planned could I raise a ticket for this enhancement on JIRA?

    Kind regards,

    John.

  • #2
    Originally posted by johnhunsley View Post
    Hi,

    I have successfully implemented spring ws services and clients and found it cumbersome to create end point marshaling using XPath or parsing the Elements and Nodes directly.

    Spring ws does a great job of creating the WSDL file from an .xsd schema but why do I have to map the client request to an object manually in my end point using XPath or by getting the String value from each Element using element.getChildText(.......)

    Does Spring ws have any way of automatically generating a mapping from a schema file, or is this planned in further releases?

    I imagine it would be the obvious next step and should be fairly easy to implement, if its not planned could I raise a ticket for this enhancement on JIRA?

    Kind regards,

    John.
    I do not think it is SWS responisbilty to generate such a mapping.
    It is just a matter of using OXM solution that meets your requirements.
    I am using jaxb2 and created ant script for my project
    Code:
    <path id="jaxb-lib" >
    	    	<fileset dir="../build/repository/jaxb-ri-20061211" includes="**/*.jar"/>
    	  </path>				
    	<taskdef name="xjc" classname="com.sun.tools.xjc.XJCTask" classpathref="jaxb-lib"/>
      
        <target name="genJaxbSources">
            <echo message="generating jaxb2 sources"/>
            <xjc package="foo.bar.schema" destdir="${gen.destdir}">
            	<schema dir="directory_with_schema_files">
                        <include name="*.xsd"/>				    	
            	</schema>
    		</xjc>
        </target>

    Comment


    • #3
      Yeah, thats cool. I've used Castor on the client side and guess it is possible to marshal xml to objects on the server using the same, but I still need to manually create the mapping file. If I could just do it from the xsd and hand the server a class with the named fields matching the XML fields it should just be able to convert the XML to an object, I'm sure there is a simple way of doing this even if it doesn't accommodate complex mappings.

      John.

      Comment


      • #4
        With Castor, maybe you have to manually create a mapping file, I've never used it, but this is not the case with jaxb, xmlbeans, etc., which Spring-WS supports. For example, the ant task that miluch put in this thread simply takes an xml schema file (xsd) and outputs java classes. You use these java classes in your endpoint, and Spring-WS, with your OXM tool of choice, will take care of converting the incoming XML/SOAP to your objects, and your returned object back to outgoing XML/SOAP. No mapping files needed. If you change your XSD, you just rerun the tool to generate new Java classes for you.

        FWIW,
        Greg

        Comment


        • #5
          I see,

          that makes sense, Sorry I didn't realize this was what the ant task was for!

          I thought this would have already been implemented and that I was missing something.

          Many thanks

          John.

          Comment

          Working...
          X