Announcement Announcement Module
Collapse
No announcement yet.
wsdl generation for requests with no input Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • wsdl generation for requests with no input

    I'm using cxf to generate java code based on the wsdl that was generated by spring-ws 1.0.3. One of the soap requests I want to expose takes no inputs which later causes cxf to generate service methods that take Object as an input which results in invalid xml being generated. A reply on the cxf mailing list says the generated wsdl needs to be slightly different to generate empty parameter service methods
    http://www.nabble.com/soap-requests-...html#a16716043

    Here is my XSD

    Code:
        <xs:element name="AllInstrumentsRequest" />
        <xs:element name="AllInstrumentsResponse">
            <xs:complexType>
                <xs:sequence>
                    <xs:element name="numberInstruments" type="xs:unsignedLong"/>
                    <xs:element name="instrument" type="ci:InstrumentType" minOccurs="0" maxOccurs="unbounded"/>
                </xs:sequence>
            </xs:complexType>
        </xs:element>
        <xs:complexType name="InstrumentType">
            <xs:sequence>
                <xs:element name="instrumentId" type="xs:unsignedLong"/>
                <xs:element name="code" type="xs:string" nillable="true"/>
                <xs:element name="shortName" type="xs:string" nillable="true"/>
                <xs:element name="longName" type="xs:string" nillable="true"/>
                <xs:element name="description" type="xs:string" nillable="true"/>
                <xs:element name="imageURL" type="xs:string" nillable="true"/>
            </xs:sequence>
        </xs:complexType>
    Here is the generated wsdl

    Code:
    <xs:element name="AllInstrumentsRequest"/>
    <xs:element name="AllInstrumentsResponse">
         <xs:complexType>
    	<xs:sequence>
                   <xs:element name="numberInstruments" type="xs:unsignedLong"/>
                    <xs:element maxOccurs="unbounded" minOccurs="0" name="instrument" type="ci:InstrumentType"/>
             </xs:sequence>
         </xs:complexType>
    </xs:element>
    
    <xs:complexType name="InstrumentType">
         <xs:sequence>
               <xs:element name="instrumentId" type="xs:unsignedLong"/>
               <xs:element name="code" nillable="true" type="xs:string"/>
               <xs:element name="shortName" nillable="true" type="xs:string"/>
               <xs:element name="longName" nillable="true" type="xs:string"/>
               <xs:element name="description" nillable="true" type="xs:string"/>
               <xs:element name="imageURL" nillable="true" type="xs:string"/>
         </xs:sequence>
    </xs:complexType>
    
    <wsdl:message name="AllInstrumentsRequest">
    <wsdl:part element="schema:AllInstrumentsRequest" name="AllInstrumentsRequest">
        </wsdl:part>
    </wsdl:message>
    
    <wsdl:operation name="AllInstruments">
    <wsdl:input message="tns:AllInstrumentsRequest" name="AllInstrumentsRequest">
        </wsdl:input>
    <wsdl:output message="tns:AllInstrumentsResponse" name="AllInstrumentsResponse">
        </wsdl:output>
    </wsdl:operation>
    Here is the interface cxf generated, notice the Object input parameter

    Code:
        @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
        @WebResult(targetNamespace = "http://cithaeron.com/schemas", partName = "AllInstrumentsResponse", name = "AllInstrumentsResponse")
        @WebMethod(operationName = "AllInstruments")
        public com.cithaeron.backoffice.api.AllInstrumentsResponse allInstruments(
            @WebParam(targetNamespace = "http://cithaeron.com/schemas", partName = "AllInstrumentsRequest", name = "AllInstrumentsRequest")
            java.lang.Object allInstrumentsRequest
        );
    If I simply remove the Request from AllInstrumentsRequest tag spring-ws fails to generate the required soap operation information in the wsdl.

    A response from cxf list says I need to get the generated wsdl to be like

    Code:
    
    <xs:element name="TimeSalesAllInstruments"/>
    
    <xs:element name="TimeSalesAllInstrumentsResponse">
        <xs:complexType>
             <xs:sequence>
                  <xs:element name="numberInstruments" type="xs:unsignedLong"/>
                  <xs:element maxOccurs="unbounded" minOccurs="0" name="instrument" type="ci:TimeSalesType"/>
              </xs:sequence>
         </xs:complexType>
    </xs:element>
    <xs:complexType name="TimeSalesType">
             <xs:sequence>
                 <xs:element name="instrumentId" type="xs:unsignedLong"/>
                 <xs:element name="bid" nillable="true" type="xs:decimal"/>
                 <xs:element name="ask" nillable="true" type="xs:decimal"/>
                 <xs:element name="mostRecentExecutionPrice" nillable="true" type="xs:decimal"/>
                 <xs:element name="code" nillable="true" type="xs:string"/>
                 <xs:element name="longName" nillable="true" type="xs:string"/>
                 <xs:element name="shortName" nillable="true" type="xs:string"/>
                 <xs:element name="volumeTraded" nillable="true"
     type="xs:decimal"/>
                 <xs:element name="openInterest" nillable="true"
     type="xs:decimal"/>
                 <xs:element name="imageURL" nillable="true" type="xs:string"/>
                 <xs:element name="twentyFourHourChangeInPrice" nillable="true"
     type="xs:decimal"/>
             </xs:sequence>
         </xs:complexType>
    
    <wsdl:message name="TimeSalesAllInstrumentsResponse">
        <wsdl:part element="schema:TimeSalesAllInstrumentsResponse" name="TimeSalesAllInstrumentsResponse">
         </wsdl:part>
    </wsdl:message>
    
    <wsdl:message name="TimeSalesAllInstrumentsRequest">
        <wsdl:part element="schema:TimeSalesAllInstruments"
    name="TimeSalesAllInstrumentsRequest">
        </wsdl:part>
      </wsdl:message>
    Is there any way to get spring-ws to do this?

  • #2
    Not in 1.0.3. In 1.5.0, it's possible to write your own WSDL provider to create any kind of WSDL you want, and plug it into a ProviderBasedWsdl4jDefinition.

    It might be easier to write the desired WSDL by hand, and use the SimpleWsdl11Definition to expose it, though.

    Comment

    Working...
    X