node-soap icon indicating copy to clipboard operation
node-soap copied to clipboard

Service can not identify operation / message

Open jochemd opened this issue 7 months ago • 5 comments

We have to provide both a client and a server based on an outside WSDL. We have created a node-soap client from the WSDL and validated it works against a mock generated by SoapUI. Then we created a node-soap server from the WSDL and tried to have the node-soap client talk to the node-soap server. That consistently fails in the xmlToObject of the WSDL: it looks like the server is unable to match the SOAP request to an operation / message in the WSDL. From the content of this.definitions.messages it looks like the server expects a BerichtIndienenSoapIn XML node instead of a BerichtIndienen XML node. Client and server generated with SoapUI are consistent with the documentation of the WSDL and can talk to eachother. I'm not sure what exactly is going on, but since the node-soap client can not talk to the node-soap server I think this might be a node-soap issue.

I have attached a minimal reproduction. You can start the server using npm start and then run the testcase with npm test and it will throw the error 'TypeError: Cannot read properties of undefined (reading 'description')'. I have stripped out the majority of the definitions from the WSDL and XSD so they just contain a single operation and the needed types, but there might be some types left over in the XSD that are not referenced.

reproduction.zip

jochemd avatar Apr 29 '25 13:04 jochemd

Hi @jochemd,

I have few questions.

Have you previously used SoapUI for generating WSDL? Also, my understanding is that you previously did not use node-soap as a server? Does the stripped WSDL from the zip file works in your mocker SoapUI? (not sure if this is valid question as I don't use SoapUI).

I will try to have a look into this soonish.

w666 avatar Apr 30 '25 11:04 w666

  • I have never used SoapUI te generate WSDL but (many times) with a provided WSDL to generate sample requests and mock services. We didn't generate this WSDL ourselves, we just got it from a service provider and have to implement it. (In both directions, they will use it so send us messages, we will use it to send them messages.) I can only assume the WSDL is very mature as I know there are dozens if not hundreds of implementations of this service online currently.
  • This is the first time using node-soap as a server.
  • Yes, the minimal.wsdl works in SoapUI and generates the proper sample requests and mock services.

jochemd avatar Apr 30 '25 15:04 jochemd

yeah, I got to the same conclusion, WSDL looks correct, but need to run couple more tests for debugging. Just don't have enough time for it. Will try do finish debugging this week.

w666 avatar May 01 '25 10:05 w666

If it helps, this is what SoapUI generated for the request and response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v3="http://schemas.vecozo.nl/berichtuitwisseling/v3" xmlns:v31="http://schemas.vecozo.nl/berichtuitwisseling/header/v3" xmlns:v32="http://schemas.vecozo.nl/berichtuitwisseling/messages/v3">
   <soapenv:Header>
      <v3:ReferentieHeader>
         <v31:ReferentieId>?</v31:ReferentieId>
      </v3:ReferentieHeader>
   </soapenv:Header>
   <soapenv:Body>
      <v3:IndienenBericht>
         <v3:Request>
            <!--Optional:-->
            <v32:BerichtInfo>
               <!--You may enter ANY elements at this point-->
            </v32:BerichtInfo>
            <v32:Bericht/>
         </v3:Request>
      </v3:IndienenBericht>
   </soapenv:Body>
</soapenv:Envelope>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v3="http://schemas.vecozo.nl/berichtuitwisseling/v3" xmlns:v31="http://schemas.vecozo.nl/berichtuitwisseling/messages/v3">
   <soapenv:Header/>
   <soapenv:Body>
      <v3:IndienenBerichtResponse>
         <v3:IndienenBerichtResult>
            <v31:ConversatieId>?</v31:ConversatieId>
            <v31:TraceerId>?</v31:TraceerId>
         </v3:IndienenBerichtResult>
      </v3:IndienenBerichtResponse>
   </soapenv:Body>
</soapenv:Envelope>

This is consistent with the service provider documenttation.

jochemd avatar May 01 '25 14:05 jochemd

Okay, the problem is imports under types section. Though, files look correct to me.

Image

if you comment imports out it kinda works, at least service can map type to operation.

I haven't looked into spec to check this, I don't really have time for this. It is possible that node-soap does not fully support this case, but this requires more time for testing, checking spec, code review. Ideally full files are required (wsdl and xsds), because I am not 100% sure it was stripped out correct.

At least there is a workaround.

Hope this helps.

w666 avatar May 05 '25 07:05 w666

Hi @jochemd,

Seems like this issue is fixed in #1313, but we would like to use WSDL from this issue. Do you have any objections?

w666 avatar Aug 03 '25 19:08 w666

Sure, go ahead

jochemd avatar Aug 04 '25 07:08 jochemd

I think this issue was fixed in the latest release 1.3.0.

w666 avatar Aug 13 '25 09:08 w666