Announcement Announcement Module
No announcement yet.
soapAction attribute of operation when dynamically generating wsdl Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • soapAction attribute of operation when dynamically generating wsdl


    I've recently started playing around with Spring-WS and I've run into a little issue. I'm sure I've missed something so I was hoping someone can point me in the right direction. Ideally the setup that I'm after would be to configure in spring the dynamic generation of the WSDL (based on a defined XSD file) and map the endpoints based on SOAP actions.

    I'm getting an error in the log which indicates that there is no endpoint mapping for the SOAP request. When I took a look at the generated WSDL, the soapAction attribute of the operation is blank. Would this be causing the issue? I've looked at the class XsdBasedSoap11Wsdl4jDefinitionBuilder but I can't seem to find how to set the soapAction.

    Log file output:
    DEBUG MessageDispatcher with name 'webservices' received request [[email protected]]
    DEBUG Endpoint mapping [org.springfram[email protected]152e9a8] has no mapping for request
    WARN  No endpoint mapping found for [[email protected]]
    DEBUG Successfully completed request
    In web.xml, I have added a servlet mapping for my webservices:
    In the webservices-servlet.xml, I have defined the SOAP action mappings, the dynamic WSDL and the service endpoint as follows:
      <bean id="xstreamMarshaller" class="org.springframework.oxm.xstream.XStreamMarshaller" />
      <bean id="soapActionMapping" class="">
        <property name="mappings">
            <prop key="http://localhost:8080/ws/SubmitTest">
      <bean id="submitTest" class="">
        <property name="builder">
          <bean class="">
            <property name="schema" value="/WEB-INF/schemas/submitTest.xsd"/>
            <property name="portTypeName" value="SubmitTest"/>
            <property name="locationUri" value="http://localhost:8080/ws/SubmitTest"/>
      <bean id="submitTestEndpoint" class="">
        <property name="marshaller" ref="xstreamMarshaller" />
        <property name="unmarshaller" ref="xstreamMarshaller" />
    Here is the relevant fragment from the generated WSDL at http://localhost:8080/ws/submitTest.wsdl:
    <wsdl:binding name="SubmitTestBinding" type="schema:SubmitTest">
      <soap:binding style="document" transport="http://localhost:8080/ws/SubmitTest" /> 
      <wsdl:operation name="submitTest">
        <soap:operation soapAction="" /> 
        <wsdl:input name="submitTestRequest">
          <soap:body use="literal" /> 
        <wsdl:output name="submitTestResponse">
          <soap:body use="literal" /> 

    Any help would be greatly appreciated
    Last edited by joey; Feb 15th, 2007, 10:32 PM.

  • #2
    Yes, the dynamically generated WSDL contains blank SOAP Actions. This means that you cannot use the SoapActionEndpointMapping.

    There are three ways to solve this:
    • Supply a defaultEndpoint to the mapping. This means that every message will go to your endpoint, no matter what the SOAP ACtion is.
    • Override populateSoapOperation() on the XsdBasedSoap11Wsdl4jDefinitionBuilder, and set the SOAP Action uri to what you want. This means that you can still use the SoapActionEndpointMapping.
    • Use another endpoint mapping, like PayloadRootQNameEndpointMapping. This mapping looks into the message content, not the soap action.

    Finally, I see that you use XStream for marshalling. As mentioned in the docs, XStream does not create XSD-compliant XML. It is an XML serialization engine tailored to java, rather than a full-fledged OXM tool. You're probably better off using one of the other marshallers.


    • #3
      I'am new to study Spring-WS 2.x , and found a workaround (Not using <sws:dynamic-wsdl />)

        <bean id="MyMath" class="">
          <property name="serviceName"        value="MyMathService" />
          <property name="portTypeName"       value="MyMathPort" />
          <property name="locationUri"        value="/ws/MyMath" />
          <property name="targetNamespace"    value="" />
          <property name="schema">
            <bean class="org.springframework.xml.xsd.SimpleXsdSchema">
              <property name="xsd"               value="/WEB-INF/wsdl/MyMath.xsd" />
          <property name="soapActions"> <!-- Using this to set soapActions -->
              <prop key="add"></prop>
              <prop key="minus"></prop>