Announcement Announcement Module
No announcement yet.
Spring WS service call with no arguments Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring WS service call with no arguments

    How does Spring WS WebServiceTemplate handle web services having no arguments? I'm thinking that the template requires a unique instance of a request object to handle the mapping, but what if the request doesn't have any parameters at all? I'm trying right now to put a null value into the "marshalSendAndReceive", but I don't have much hope that this will work. I'm asking the question here because my next move would be to create an empty request object for mapping purposes.

  • #2
    I found a post online discussing generic WSDL mapping, and it is recommended to always have a request object, even for no-argument calls. I'm going with that.


    • #3

      "web services having no arguments" is quite different than no-arg Java method. In web-services land, at XML protocol level, you exchange XML messages - usually SOAP-Envelope wrapped ones. A little bit higher we have "web services invocations" → a single SOAP Message must be translated into an invocation → it must be "dispatched". And dispatching in Java land is just a method invocation, so we have to have method somewhere in the SOAP.

      (of course we can have WS-Addressing, SOAPAction or URL based dispatching, but let's not complicate everything)

      So there's single XML element as a child of SOAP:Body. This is well-known convention called "wrapped document literal" style of WebServices (see classical

      In Spring-WS however, everything is a document - even the "wrapper". So you won't have "unwrapping" in Spring-WS and all Endpoint methods will have single argument which will come from unmarshalling SOAP:Body/<root-element> (beside other possible, "technical" arguments).

      So even for no-arg methods, SOAP:Body will contain single child and:

      in XSD it is modelled like this:

      <xs:complexType name="Void">
        <xs:sequence />
      <!-- Element representing operation - a "wrapper" -->
      <xs:element name="operationName" type="tns:Void" />
      in Spring-WS (actually JAXB):
      @XmlRootElement(name = "operationName")
      public class OperationName
      // empty
      I hope this clarifies a bit.

      Grzegorz Grzybek


      • #4
        Thanks for the information--I see it now that I need to have something to identify the request in the wsdl and in Spring WS. I appreciate the detailed explanation and the link.