Announcement Announcement Module
No announcement yet.
XML over HTTP Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • XML over HTTP

    Hi, I need to send plain XML over HTTP and was wondering if there's anything available, before developing my own remoting strategy (using dispatcher servlet and the available infrastructure).
    I know there are other solutions available like hessian, but the client platform doesn't support it.
    Also, I don't want to use web services because of the simple nature of the communications.

    Has anyone tried to do something similar?


  • #2
    Simple Spring remoting (java to java) works well if you can control the client side - via org.springframework.remoting.httpinvoker.HttpInvok erProxyFactoryBean

    The configuration is simple, with the standard semantics of a Spring-proxied interface, resulting in isolation of the remoting to the below configuration.

    <bean id="crmInterfaceService" class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">
            <property name="serviceUrl" value="https://access${bridges.qualifiedDomain}/auth/" />
            <property name="serviceInterface" value="bridges.facade.aa.CrmInterfaceFacade" />
            <property name="httpInvokerRequestExecutor">
                <bean class="org.springframework.remoting.httpinvoker.CommonsHttpInvokerRequestExecutor">
                    <property name="acceptGzipEncoding" value="true" />
                    <property name="httpClient">
                        <bean class="org.apache.commons.httpclient.HttpClient">
                            <property name="connectionTimeout" value="2000" />


    • #3
      Hi Chris, thanks for your response.
      Unfortunately I don't control the client, which doesn't have spring, nor java.
      That's the reason I'm targeting such a simple communication technology.


      • #4
        Ok, so onto other options; we recently replace a XML over HTTP interface with Spring, so here is how it looked before:

        1) DAO method built-up XML message - you can use whatever XML construction technique is hip these days. This solution did it manually, as the messages were small & simple.
        2) A connection was established using HttpClient; the XML was placed in a form field of the POST request
        3) The client side (it was Java, but that isn't material) received the post, grabbed the form field, and processed the XML - any web technology could perform these tasks.

        I'm assuming you are writing the client here (to talk to some server process); let me know if this isn't the case and we can discuss it from the other direction.


        • #5
          Yes, the scenario you describe is more or less what I'm thinking to do.
          Some variations include:
          - I don't plan to invoke the service directly, but to build an exporter to translate xml to java back and forth, probably with the help of xstream or something like that.
          - Instead of using a form field I plan to send parameters along with the post, the client has to send very little information to the server. The actual data goes from the server to the client.
          - To send the data back to the client I plan to write plain xml straight to the response. Do you see any problem associated with that?



          • #6
            Sounds like you have a pretty good handle on this!



            • #7
              Actually I was looking if someone had already built the infrastructure for me, but now I have a good excuse to do some framework programming

              Thanks for the help Chris,


              • #8
                There are a few ways of exporting a service to talk XML:
                - RPC based web services. I believe Spring has support for XFire and Axis.
                - Contract-first web services where the XML and WSDL are the first class objects, not the Java interface. This is where Spring-WS fits well.


                • #9
                  What we have done is simply store the xml into httpRequestBody on the client side. Servlet side reads the httpServletRequest.getInputstream() and stores the response in httpServletResponse.getOuputStream(). That's it.