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

SOAP envelope 1.2 schema valid Fault response #1099

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sigitas-stumbras
Copy link

No description provided.

@sigitas-stumbras sigitas-stumbras marked this pull request as ready for review November 15, 2019 21:20
@coveralls
Copy link

coveralls commented Nov 15, 2019

Coverage Status

Coverage increased (+0.3%) to 95.346% when pulling 7acaa14 on sigitas-stumbras:soap12fault into af93a6f on vpulim:master.

@jsdevel
Copy link
Collaborator

jsdevel commented Nov 15, 2019

please fix the build and keep coverage up with tests.

@sigitas-stumbras
Copy link
Author

Is this good enough? The tests that are currently failing seemingly have nothing to do with the changes I've made.

@@ -406,10 +406,15 @@ export class Server extends EventEmitter {
if (authResult instanceof Error) {
return this._sendError({
Code: {
Value: 'SOAP-ENV:Server',
Subcode: { value: 'InternalServerError' },
Value: 'soap:Receiver',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so it's been like this for a while, why does this need to be changed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was not according to soap envelope 1.2 schema: https://www.w3.org/2003/05/soap-envelope/
valid values for Fault->Code->Value are

<xs:enumeration value="tns:DataEncodingUnknown"/>
<xs:enumeration value="tns:MustUnderstand"/>
<xs:enumeration value="tns:Receiver"/>
<xs:enumeration value="tns:Sender"/>
<xs:enumeration value="tns:VersionMismatch"/>

and the namespace tag "soap" for "https://www.w3.org/2003/05/soap-envelope/" is being declared in src/server.ts line: 589-596
tag "SOAP-ENV is not being declared anywhere

thus the soap:Server

fully schema compliant Saop Envelope 1.2 Fault reponse is like this:

<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"
              xmlns:m="http://www.example.org/timeouts"
              xmlns:xml="http://www.w3.org/XML/1998/namespace">
 <env:Body>
  <env:Fault>
   <env:Code>
     <env:Value>env:Sender</env:Value>
     <env:Subcode>
      <env:Value>m:MessageTimeout</env:Value>
     </env:Subcode>
   </env:Code>
   <env:Reason>
     <env:Text xml:lang="en">Sender Timeout</env:Text>
   </env:Reason>
  </env:Fault>
 </env:Body>
</env:Envelope>

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would be nice to have is the possibility to switch to SOAP 1.1 envelope Fault response. It has a different structure. Maybe use the existing forceSoap12Headers option for this? or maybe create a new option?

@jsdevel
Copy link
Collaborator

jsdevel commented Nov 18, 2019

ok. once the build passes, i'll merge it. can you look into that?

@sigitas-stumbras
Copy link
Author

All green & commits squashed. All done now?

@@ -53,7 +53,7 @@ describe('No envelope and body elements', function() {
if(err){
throw err;
}
assert.equal(body.indexOf('Failed to parse the SOAP Message body') !== -1, true);
assert.equal(body.indexOf('InternalServerError') !== -1, true);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be nice to have a more descriptive error here

@nraynaud
Copy link

nraynaud commented Oct 27, 2023

I'd like to bring your attention to this code branch https://github.com/vpulim/node-soap/blob/master/src/wsdl/index.ts#L504 where the fault management is using the wrong case in the tag names. Is it linked to the same SOAP version issue? I am unfamiliar with SOAP and my use case is windows wsman.

edit: my error response looks like that:

<s:Envelope xml:lang="en-US" xmlns:s="http://www.w3.org/2003/05/soap-envelope"
            xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing"
            xmlns:x="http://schemas.xmlsoap.org/ws/2004/09/transfer"
            xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing"
            xmlns:n="http://schemas.xmlsoap.org/ws/2004/09/enumeration"
            xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"
            xmlns:p="http://schemas.microsoft.com/wbem/wsman/1/wsman.xsd">
    <s:Header>
        <a:Action>http://schemas.dmtf.org/wbem/wsman/1/wsman/fault</a:Action>
        <a:MessageID>uuid:8A817A03-7FEE-4C2C-B233-DDBA6881E5E4</a:MessageID>
        <a:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:To>
    </s:Header>
    <s:Body>
        <s:Fault>
            <s:Code>
                <s:Value>s:Sender</s:Value>
                <s:Subcode>
                    <s:Value>w:InternalError</s:Value>
                </s:Subcode>
            </s:Code>
            <s:Reason>
                <s:Text xml:lang="">The WS-Management service cannot process the request because the XML is invalid.
                </s:Text>
            </s:Reason>
            <s:Detail>
                <w:FaultDetail>http://schemas.dmtf.org/wbem/wsman/1/wsman/faultDetail/Invalid</w:FaultDetail>
                <f:WSManFault xmlns:f="http://schemas.microsoft.com/wbem/wsman/1/wsmanfault" Code="2150858819"
                              Machine="dell">
                    <f:Message>WinRM cannot process the request because the input XML uses an undefined XML namespace.
                    </f:Message>
                </f:WSManFault>
            </s:Detail>
        </s:Fault>
    </s:Body>
</s:Envelope>

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