Announcement Announcement Module
Collapse
No announcement yet.
XML over HTTP Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • 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?

    Thanks,
    Federico.

  • #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.

    Code:
    <bean id="crmInterfaceService" class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">
            <property name="serviceUrl" value="https://access${bridges.qualifiedDomain}/auth/crmInterface.do" />
            <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" />
                        </bean>
                    </property>
                </bean>
            </property>
        </bean>

    Comment


    • #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.

      Comment


      • #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.

        Comment


        • #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?

          Federico.

          Comment


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

            Chris.

            Comment


            • #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,
              Federico.

              Comment


              • #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.

                Comment


                • #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.

                  Comment

                  Working...
                  X