0

I have created a SOAP web service from the given xsd file below (using Java spring boot). The resulting WSDL doesn't include wsdl:input field. And when I import wsdl in SOAP UI, response form is shown in the request field. However, when I change the structure of request the endpoint works fine. Here is the xsd file that I have used:

<?xml version="1.0" encoding="UTF-8"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="###" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:ibmSchExtn="http://www.ibm.com/schema/extensions" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="####" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <xs:element ibmSchExtn:docRoot="true" name="send" type="tns:send_t"/>
    <xs:complexType name="send_t">
        <xs:sequence>
            <xs:element name="message" type="tns:ParamsMtMsg"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="ParamsMtMsg">
        <xs:sequence>
            <xs:element name="block4" type="xs:string"/>
            <xs:element minOccurs="0" name="msgCopySrvId" type="xs:string"/>
        </xs:sequence>
    </xs:complexType>
    <xs:simpleType name="ack_nak_type">
        <xs:restriction base="xs:string">
            <xs:enumeration value="ACK"/>
            <xs:enumeration value="NAK"/>
        </xs:restriction>
    </xs:simpleType>
    <xs:element ibmSchExtn:docRoot="true" name="sendResponse" type="tns:sendResponse"/>
    <xs:complexType name="sendResponse">
        <xs:sequence>
            <xs:element name="data" type="tns:result_t"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="result_t">
        <xs:sequence>
            <xs:element name="type" type="tns:ack_nak_type"/>
            <xs:element name="datetime" type="xs:string"/>
        </xs:sequence>
    </xs:complexType>
</xs:schema>


Here is the corresponding generated WSDL and you can see that there is wsdl:output field but wsdl:input field is missing inside the binding:

<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:sch="##" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="##" ## targetNamespace="###">
<wsdl:types>
<xs:schema xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:ibmSchExtn="http://www.ibm.com/schema/extensions" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="###" version="1.0">
<xs:element ibmSchExtn:docRoot="true" name="send" type="tns:send_t"/>
<xs:complexType name="send_t">
<xs:sequence>
<xs:element name="message" type="tns:ParamsMtMsg"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ParamsMtMsg">
<xs:sequence>
<xs:element name="block4" type="xs:string"/>
<xs:element minOccurs="0" name="msgCopySrvId" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:simpleType name="ack_nak_type">
<xs:restriction base="xs:string">
<xs:enumeration value="ACK"/>
<xs:enumeration value="NAK"/>
</xs:restriction>
</xs:simpleType>
<xs:element ibmSchExtn:docRoot="true" name="sendResponse" type="tns:sendResponse"/>
<xs:complexType name="sendResponse">
<xs:sequence>
<xs:element name="data" type="tns:result_t"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="result_t">
<xs:sequence>
<xs:element name="type" type="tns:ack_nak_type"/>
<xs:element name="datetime" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="sendResponse">
<wsdl:part element="tns:sendResponse" name="sendResponse"> </wsdl:part>
</wsdl:message>
<wsdl:portType name="XohksSoapPort">
<wsdl:operation name="send">
<wsdl:output message="tns:sendResponse" name="sendResponse"> </wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="XohksSoapPortSoap11" type="tns:XohksSoapPort">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="send">
<soap:operation soapAction=""/>
<wsdl:output name="sendResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="XohksSoapPortService">
<wsdl:port binding="tns:XohksSoapPortSoap11" name="XohksSoapPortSoap11">
<soap:address location="http://localhost:8080/ws/getSendResponse"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

Here is the java code:

@Slf4j
@Endpoint
@AllArgsConstructor
public class XohksMxController {

    private static final String NAMESPACE_URI = "###";
    private final FileTransferService fileTransferService;

    @PayloadRoot(namespace = NAMESPACE_URI, localPart = "SendT")
    @ResponsePayload
    public JAXBElement<SendResponse> getSendResponse(@RequestPayload JAXBElement<SendT> sendT)
            throws JAXBException, SftpException, IOException {
        return this.fileTransferService.getSendResponse(sendT);

    }

}


gunel
  • 161
  • 13
  • 1
    I had the same problem. I find the solution in this post: https://stackoverflow.com/questions/34525587/invalid-wsdl-generated-by-spring-ws-when-the-request-element-doesnt-end-with-r – Daniel Francisco Ribeiro Sep 15 '22 at 18:44
  • Thank you! I had solved this issue by following the same approach (by adding "response" suffix to the response class name). – gunel Sep 16 '22 at 06:30

0 Answers0