wsdl-tsclient icon indicating copy to clipboard operation
wsdl-tsclient copied to clipboard

Missing definition for simple wsdl

Open simakvladimir opened this issue 10 months ago • 0 comments

Hi, thx for awesome tool! But I get some problem.

I try to generate soap client for simple wsdl (example from https://www.tutorialspoint.com/wsdl/wsdl_example.htm):

<?xml version="1.0" encoding="UTF-8"?>
<definitions name="HelloService" 
    targetNamespace="http://www.examples.com/wsdl/HelloService.wsdl"
    xmlns="http://schemas.xmlsoap.org/wsdl/" 
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
    xmlns:tns="http://www.examples.com/wsdl/HelloService.wsdl" 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <message name="SayHelloRequest">
        <part name="firstName" type="xsd:string" />
    </message>
    <message name="SayHelloResponse">
        <part name="greeting" type="xsd:string" />
    </message>
    <portType name="Hello_PortType">
        <operation name="sayHello">
            <input message="tns:SayHelloRequest" />
            <output message="tns:SayHelloResponse" />
        </operation>
    </portType>
    <binding name="Hello_Binding" type="tns:Hello_PortType">
        <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
        <operation name="sayHello">
            <soap:operation soapAction="sayHello" />
            <input>
                <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:examples:helloservice" use="encoded" />
            </input>
            <output>
                <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:examples:helloservice" use="encoded" />
            </output>
        </operation>
    </binding>
    <service name="Hello_Service">
        <documentation>WSDL File for HelloService</documentation>
        <port binding="tns:Hello_Binding" name="Hello_Port">
            <soap:address location="http://localhost:51515/SayHello/" />
        </port>
    </service>
</definitions>

But tool is generating only one definition - SayHelloRequest, definition for SayHelloResponse is missing. The HelloClient interface looks like:

export interface HelloClient extends SoapClient {
    HelloService: HelloService;
    sayHelloAsync(sayHelloRequest: SayHelloRequest, options?: ISoapExOptions): Promise<[result: SayHelloRequest, rawResponse: any, soapHeader: any, rawRequest: any]>;
}

where result promise return SayHelloRequest instead SayHelloResponse.

May be problem in https://github.com/dderevjanik/wsdl-tsclient/blob/master/src/parser.ts#L354, where paramName variable for output is the same as for input?

I generate using next command: npx wsdl-tsclient --verbose hello.wsdl -o ./src/client/generated/

Thx

simakvladimir avatar Apr 24 '24 10:04 simakvladimir