Announcement Announcement Module
Collapse
No announcement yet.
dilemma and doubt: XFire or Spring-WS Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • dilemma and doubt: XFire or Spring-WS

    hello guys

    i am reading Spring in action 2nd edition and i like it

    i have a problem, in chapter 8 talk about of xfire
    and chapter 9 is all about spring ws

    but jesus is really cumbersome

    the author said that xfire has a disadvantage about the reflection of internal API

    some help about best practices or if is a suicide work with xfire , really i am lost

    i appreacite

    thanks in advanced

  • #2
    same...I really like the Spring-WS stuff right up until the part about marshalling, where it begins to look like a complete pain to use Spring-WS.

    CXF (previously XFire) seems (?) to be *much* easier to handle marshalling.

    I've not really used either and so I too am looking for feedback or reference to a post from someone with experience choosing between the two (or maybe other choices).

    Happy to hear from the Spring team who no doubt have had this conversation when building Spring-WS.

    I know the CXF REST stuff (http://cwiki.apache.org/CXF20DOC/http-binding.html) is not really 'XSD interface first' but it does look easier/simpler.

    Comment


    • #3
      Spring-WS and XFire have different goals. The goal of XFire, IMO, is to make it easy to expose an existing Spring bean as SOAP service. It does this completely transparently, just as easy any other RemoteExporter you can find in Spring itself.

      The goal of Spring-WS is to take a contract-first, message-driven approach. The fact that you are handling XML messages is much more obvious: no transparent data binding is being done for you. And believe me: sometimes you really have to have control over the XML Messages, for instance when you want to have a constant contract, or when you have to conform to a third-party contract.

      So I would say that both projects have different usage scenarios.

      Comment


      • #4
        Hello guys

        thanks both you for your replies

        gmatthews
        same...I really like the Spring-WS stuff right up until the part about marshalling, where it begins to look like a complete pain to use Spring-WS.
        i am agree, OXM is pain for my brain , many options for that is cumbersome and the classic advice, "each option has advantages and disadvantages"

        i dont know if this is a suicide, but if spring can create its own OXM mechanism, please do it

        i love spring and i know that web services is a complicated way to integrate system, but.... you are the experts

        Arjen
        The goal of Spring-WS is to take a contract-first, message-driven approach. The fact that you are handling XML messages is much more obvious: no transparent data binding is being done for you.
        thats right

        tell me, do you now a friendly tool to create xsd from xml?, spring in action 2nd edition talk about trang, maybe you or other member know other better tool

        regards

        Comment


        • #5
          Originally posted by dr_pompeii View Post
          i dont know if this is a suicide, but if spring can create its own OXM mechanism, please do it
          Creating an OXM tool is not as simple as it might look, and I would say there is little added value in creating a new one. Nowadays, I usually recommend using JAXB2, unless you cannot/will not use annotations.

          Originally posted by dr_pompeii View Post
          tell me, do you now a friendly tool to create xsd from xml?, spring in action 2nd edition talk about trang, maybe you or other member know other better tool
          Microsoft also has a tool, which might suit you better. I haven't used it though, since I don't use Windows.

          Cheers,

          Comment


          • #6
            Creating an OXM tool is not as simple as it might look, and I would say there is little added value in creating a new one.
            yes i know, is like talk about ORM, but the point if Spring can take the best of each tool for OXM and create a new standard/tool, it would be great

            Nowadays, I usually recommend using JAXB2, unless you cannot/will not use annotations.
            the obvious question for a rookie like me in this world WS,
            why and which advantages has against the others options?

            i dont know really much about annotions, but if i learn this to work with JAXB2 and then this save my life with OXM, i must learn it

            Microsoft also has a tool, which might suit you better. I haven't used it though, since I don't use Windows.
            oh Tux, our old friend microsoft, , some advice for linux OS? , maybe exist one tool out there based in Java

            regards and thanks for yoru reply

            Comment


            • #7
              some feedback

              OK, so I got something going over the weekend.

              i dont know really much about annotions, but if i learn this to work with JAXB2 and then this save my life with OXM, i must learn it
              At a simple level, all there is to JAXB 2 (if you're using Java 6, with it built in), is to annotate a target class with @XmlRootElement and optionally @XmlElement and @XmlAttribute. There you are, you are now an expert in JAXB2!

              That annotated class can then act as a target for having XML unmarshalled into it.

              I wasted a lot of time faffing about with namespaces and JAXB2, obviously doing something stupid -- so at the moment not using namespaces at all anywhere, but might revisit that.

              The other thing I could imagine JAXB2 being useful for is marshalling a JAXB2 annotated Java object to XML, saving having to do String manipulation manually to create some XML on the client side for posting.

              I'm also using Spring @Endpoint annotation and PayloadRootAnnotationMethodEndpointMapping class to detect annotated @Endpoint's, pretty much as per 5.3.3 of doco.

              I'm not using MarshallingMethodEndpointAdapter, but instead an adapter contributed in this forum as an attachment by someone. That class handles empty param lists or something after I had some problem with MarshallingMethodEndpointAdapter, possibly also due to something stupid I was doing.

              All in all, works well.

              Next step is to see about putting a REST spin on the whole thing -- I want to publish an API sort of like the Amazon and eBay REST APIs, but not sure (?) want to inflict WS on our customers -- but not sure if that would be bastardising the use of Spring-WS too much. e.g. need to find out how I do GET, POST, PUT, DELETE if at all possible with Spring-WS.
              Last edited by gmatthews; Sep 17th, 2007, 02:19 AM. Reason: insert original poster's quote

              Comment


              • #8
                thanks for the reply

                At a simple level, all there is to JAXB 2 (if you're using Java 6, with it built in), is to annotate a target class with @XmlRootElement and optionally @XmlElement and @XmlAttribute. There you are, you are now an expert in JAXB2!
                i used to work with jdk1.5 update 12, not 6 and even if i dont bad remember that some features of subproject of Spring not support yet version 6

                if i dont bad remember annotations work too in jdk 5 right?

                tell me is outthere a book or web tutorial of your preference to learn some tricks about JAXB2???

                regards

                Comment


                • #9
                  tell me is outthere a book or web tutorial of your preference to learn some tricks about JAXB2???
                  I just did a combination of reading the Spring-WS doco, which as always is fairly extensive, and googling JAXB2.

                  Comment


                  • #10
                    thanks for the reply

                    it seems that this link
                    https://jaxb.dev.java.net/
                    is the source

                    i will read this carefully

                    regards

                    Comment


                    • #11
                      Originally posted by dr_pompeii View Post
                      tell me, do you now a friendly tool to create xsd from xml?, spring in action 2nd edition talk about trang, maybe you or other member know other better tool
                      I've been using Altova's XMLSPY (a commercial product) which is a Swiss Army knife of XML editors. Among many other features, it can generate XSD and WSDL from sample XML files, assuming that you've accurately reflected any repeating elements in your sample. It costs $$. I was lucky enough to win a free copy at a conference (call me cheap), but you can download a 30-day trial for free and give it a spin:

                      http://www.download.com/Altova-XMLSp...-10743625.html

                      Comment


                      • #12
                        Hi CorbaTheGeek

                        thanks for the reply and the link

                        but you can download a 30-day trial for free
                        i will check it , the sad is that the installer is a ugly .exe, i will see if wine in linux can help me


                        regards

                        Comment


                        • #13
                          XMLSpy apparently works under Linux/Wine:

                          http://www.altova.com/support_platform_linux.html

                          Comment


                          • #14
                            thanks for the link friend

                            i hope that the documentation be useful

                            regards

                            Comment


                            • #15
                              In the investigations I've been doing for my project, I've come to the following conclusions...

                              Jaxb2 is faaar better than Jaxb1. Avoid Jaxb1 at all costs.

                              Jaxb2, in regards to Web Service projects, is best used from a Schema First approach. Design your XSD, use the xjc2 ant task to generate the Annotated java code.

                              Also, when it comes to the OXM stuff in Spring-WS, I subclassed the AbstractMarshallingPayloadEndpoint to make our endpoints a little simpler. The idea being that we would have many endpoints, each with their own marshaller.

                              As this is a Java5 project (using jaxb2 annotations and such) the "AbstractJaxb2MarshallingPayloadEndpoint uses generics as well.

                              Code:
                              public abstract class AbstractJaxb2MarshallingEndpoint<RQ, RS> extends AbstractMarshallingPayloadEndpoint {
                              
                                  protected AbstractJaxb2MarshallingEndpoint(Class... classesToBeBound) {
                                      Jaxb2Marshaller marshaller = buildMarshaller(classesToBeBound);
                                      setMarshaller(marshaller);
                                      setUnmarshaller(marshaller);
                                  }
                              
                                  private Jaxb2Marshaller buildMarshaller(Class... classesToBeBound) {
                                      Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
                                      marshaller.setClassesToBeBound(classesToBeBound);
                                      initializeMarshaller(marshaller);
                                      try {
                                          marshaller.afterPropertiesSet();
                                      } catch (Exception e) {
                                          throw new RuntimeException("Failed to initialize Jaxb2Marshaller", e);
                                      }
                                      return marshaller;
                                  }
                              
                                  protected void initializeMarshaller(Jaxb2Marshaller marshaller) {
                                  }
                              
                                  @SuppressWarnings("unchecked")
                                  protected final Object invokeInternal(Object object) throws Exception {
                                      return invokeEndpoint((RQ) object);
                                  }
                              
                                  protected abstract RS invokeEndpoint(RQ request) throws Exception;
                              }
                              Our final endpoint looks like this then...
                              Code:
                              public class CurrencyExchangeEndpoint extends AbstractJaxb2MarshallingEndpoint<ExchangeRequest, ExchangeResponse> {
                              
                                  private final CurrencyExchangeProcessor currencyExchangeProcessor;
                              
                                  public CurrencyExchangeEndpoint(CurrencyExchangeProcessor currencyExchangeProcessor) {
                                      super(ExchangeRequest.class, ExchangeResponse.class);
                                      this.currencyExchangeProcessor = currencyExchangeProcessor;
                                  }
                              
                                  protected ExchangeResponse invokeEndpoint(ExchangeRequest request) throws Exception {
                                      return currencyExchangeProcessor.execute(request);
                                  }
                              
                              }

                              Comment

                              Working...
                              X