Results 1 to 9 of 9

Thread: XML over HTTP

  1. #1
    Join Date
    Dec 2005
    Location
    Argentina
    Posts
    73

    Default 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. #2
    Join Date
    Apr 2006
    Location
    Canada
    Posts
    164

    Default

    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>
    Chris Lee (blog)
    Principal Consultant
    Digital Ascent Inc.

  3. #3
    Join Date
    Dec 2005
    Location
    Argentina
    Posts
    73

    Default

    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. #4
    Join Date
    Apr 2006
    Location
    Canada
    Posts
    164

    Default

    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.
    Chris Lee (blog)
    Principal Consultant
    Digital Ascent Inc.

  5. #5
    Join Date
    Dec 2005
    Location
    Argentina
    Posts
    73

    Default

    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.

  6. #6
    Join Date
    Apr 2006
    Location
    Canada
    Posts
    164

    Default

    Sounds like you have a pretty good handle on this!

    Chris.
    Chris Lee (blog)
    Principal Consultant
    Digital Ascent Inc.

  7. #7
    Join Date
    Dec 2005
    Location
    Argentina
    Posts
    73

    Default

    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.

  8. #8
    Join Date
    Feb 2005
    Location
    Boston, MA
    Posts
    1,142

    Default

    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.
    Bill

  9. #9
    Join Date
    Sep 2004
    Posts
    1,086

    Default

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •