Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workaround for wsdl:input message-part and namespace use wsdl:i… #1274

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

prasad83
Copy link

@prasad83 prasad83 commented Feb 12, 2025

WSDL server had the following multiple-import with wsdl:input part

main.wsdl

<wsdl:definitions name="Report" targetNamespace="2012-04-20" xmlns:i0="Other" xmlns:tns="2012-04-20">
  <wsdl:import namespace="Other" location="other.wsdl" />
  <wsdl:message name="InputMessage">
    <wsdl:part name="parameters" element="tns:InputMessagePart" />
  </wsdl:message>

  <wsdl:message name="OutputMessage">
    <wsdl:part name="parameters" element="tns:OutputMessagePart" />
  </wsdl:message>

  <wsdl:portType name="Report">
    <wsdl:operation name="TestOperation">
      <wsdl:input wsaw:Action="ACTX" message="tns:InputMessage" />
      <wsdl:output wsaw:Action="ACTX" message="tns:OutputMessage" />
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:service name="Report">
        <wsdl:port name="SecureEp" binding="i0:SecureEp">
            <soap:address location="https://server.tld/Report/2012-04-20/" />
        </wsdl:port>
        <wsdl:port name="NonSecureEp" binding="i0:NonSecureEp">
            <soap:address location="https://server.tld/Report/2012-04-20/" />
        </wsdl:port>
    </wsdl:service>    
</wsdl:definitions>

other.wsdl

<wsdl:definitions targetNamespace="Other" 
xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
 xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:i0="20212-04-20"  xmlns:tns="Other">

  <wsp:Policy wsu:Id="SecureSOAPEndpoint_policy"> <!-- ... --></wsp:Policy>

  <wsdl:import namespace="2012-04-20" location="main.wsdl" />

  <wsdl:binding name="SecureEp" type="i0:Report">
    <wsp:PolicyReference URI="#SecureEp_policy" />
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
    <wsdl:operation name="TestOperation">
      <soap:operation soapAction="2012-04-20/Report/TestOperation" style="document" />
         <wsdl:input><soap:body use="literal" /></wsdl:input>
         <wsdl:output><soap:body use="literal" /></wsdl:output>
    </wsdl:operation>
  </wsdl:binding>

  <wsdl:binding name="NonSecureEp" type="i0:Report">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />

    <wsdl:operation name="TestOperation">
      <soap:operation soapAction="2012-04-20/Report/TestOperation" style="document" />
         <wsdl:input><soap:body use="literal" /></wsdl:input>
         <wsdl:output><soap:body use="literal" /></wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
</wsdl:definitions>

When making call to function: client.TestOperation(...)

Actual: Wraps with
Expected: Should wrap with <i0:InputMessagePart ...>

…mport

WSDL server had the following multiple-import with wsdl:input part

main.wsdl
```xml
<wsdl:definitions name="Report" targetNamespace="2012-04-20"
	xmlns:i0="Other" xmlns:tns="2012-04-20">
    
    <wsdl:import namespace="Other" location="other.wsdl" />
    
    <wsdl:message name="InputMessage">
		<wsdl:part name="parameters" element="tns:InputMessagePart" />
	</wsdl:message>

	<wsdl:message name="OutputMessage">
		<wsdl:part name="parameters" element="tns:OutputMessagePart" />
	</wsdl:message>

	<wsdl:operation name="TestOperation">
		<wsdl:input wsaw:Action="ACTX" message="tns:InputMessage" />
		<wsdl:output wsaw:Action="ACTX" message="tns:OutputMessage" />
	</wsdl:operation>
    
</wsdl:definitions>
```

other.wsdl

```xml
<wsdl:definitions targetNamespace="Other" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
	xmlns:i0="20212-04-20"  xmlns:tns="Other">
    
    <wsdl:import namespace="2012-04-20" location="main.wsdl" />
    
</wsdl:definitions>
```

When making call to function: client.TestOperation(...)

Actual: Wraps Body with <InputMessage>
Expected: Should wrap body with <i0:InputMessagePart ...>
@w666
Copy link
Collaborator

w666 commented Feb 12, 2025

Hi @prasad83,

Code does not compile.
Also, I am not sure I understand the changes. Does server violate some spec and you need to handle it? Or node-soap does not follow some spec?

Also, this change needs a test.

Thanks.

@prasad83
Copy link
Author

@w666 - when wsdl has multiple imports - operation call is loosing the bindingNamespace. I was able to get the python zeep client with such soap server but not this.

The workaround devised worked for this use-case. Need to carve out time for building test case.

@w666
Copy link
Collaborator

w666 commented Feb 13, 2025

Build is still broken.

Also, I think your WSDL is not valid, operations should be within <wsdl:portType> element. wsaw is used without declaration.
I don't think we should violate spec and try to make it work with invalid WSDLs.

What do you think?

@prasad83
Copy link
Author

prasad83 commented Feb 15, 2025

@w666 - I updated WSDL snippets now. [main.wsdl had portType binding and other.wsdl had Secure and NonSecure endpoints variants]

  • Build broken likely with TS beautification rules.
  • If python zeep client works but not nodejs - something to assess if special cases are handled (as MS based SOAP service do exist)

@w666
Copy link
Collaborator

w666 commented Feb 17, 2025

@prasad83

I am not sure I understand the issue.

Where did you get your WSDL from? Is it actual existing service that you need to work with? If so, why did you update original WSDL after my comment?

I am not familiar with zeep client, but if it works there it does not mean that something is broken in node-soap.

Currently build is broken, please fix it so we can move on.

Also, it would be good if you can explain what part of the specification is not implemented.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants