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

Header does not use required prefix #323

Open
saristar opened this issue Jul 14, 2021 · 2 comments
Open

Header does not use required prefix #323

saristar opened this issue Jul 14, 2021 · 2 comments
Labels

Comments

@saristar
Copy link

I'm trying to add header using client.addSoapHeader() method. The problem with the method is it is not using the required prefix in the xml output.

This is how I'm building the header.

const soaH = {
  "SOAHeader": {
        "Responsibility": "MANAGER",
        "RespApplication": "AR",
        "SecurityGroup": "STANDARD",
        "NLSLanguage": "AMERICAN",
        "Org_Id": "1"
    }
}
const qname = new QName('{http://xmlns.oracle.com/apps/ont/soaprovider/plsql/oe_inbound_int/}oe:SOAHeader')
client.addSoapHeader(soaH, qname)

I want the header to generate with oe prefix

This is how it is built from strong-soap

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
    <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-
utility-1.0.xsd">
      <wsse:UsernameToken>
        <wsse:Username>*********</wsse:Username>
        <wsse:Password>*********</wsse:Password>
      </wsse:UsernameToken>
    </wsse:Security>
    <ns1:SOAHeader xmlns:ns1="http://xmlns.oracle.com/apps/ont/soaprovider/plsql/oe_inbound_int/">
      <SOAHeader>
        <Responsibility>MANAGER</Responsibility>
        <RespApplication>AR</RespApplication>
        <SecurityGroup>STANDARD</SecurityGroup>
        <NLSLanguage>AMERICAN</NLSLanguage>
        <Org_Id>1</Org_Id>
      </SOAHeader>
    </ns1:SOAHeader>
  </soap:Header>
  <soap:Body>
    <ns1:InputParameters xmlns:ns1="http://xmlns.oracle.com/apps/ont/soaprovider/plsql/oe_inbound_int/get_order/">
      <ns1:P_API_VERSION_NUMBER>1.0</ns1:P_API_VERSION_NUMBER>
      <ns1:P_ORDER_NUMBER>5112</ns1:P_ORDER_NUMBER>
    </ns1:InputParameters>
  </soap:Body>
</soap:Envelope>

Expected Output:

<soapenv:Envelope xmlns:get="http://xmlns.oracle.com/apps/ont/soaprovider/plsql/oe_inbound_int/get_order/" xmlns:oe="http://xmlns.oracle.com/apps/ont/soaprovider/plsql/oe_inbound_int/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Header>
      <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
         <wsse:UsernameToken>
            <wsse:Username>*********</wsse:Username>
            <wsse:Password>*********</wsse:Password>
            <wsu:Created>2020-10-06T05:51:58.527Z</wsu:Created>
         </wsse:UsernameToken>
      </wsse:Security>
      <oe:SOAHeader xmlns:oe= "http://xmlns.oracle.com/apps/ont/soaprovider/plsql/oe_inbound_int/">
        <oe:Responsibility>MANAGER</oe:Responsibility>
        <oe:RespApplication>AR</oe:RespApplication>
        <oe:SecurityGroup>STANDARD</oe:SecurityGroup>
        <oe:NLSLanguage>AMERICAN</oe:NLSLanguage>
        <oe:Org_Id>1</oe:Org_Id>
       </oe:SOAHeader>
   </soapenv:Header>
   <soapenv:Body>
      <get:InputParameters>
         <!--Optional:-->
         <get:P_API_VERSION_NUMBER>1.0</get:P_API_VERSION_NUMBER>
         <!--Optional:-->
         <get:P_ORDER_NUMBER>5005</get:P_ORDER_NUMBER>
      </get:InputParameters>
   </soapenv:Body>
</soapenv:Envelope>

I want the header to be built this way.

<oe:SOAHeader xmlns:oe= "http://xmlns.oracle.com/apps/ont/soaprovider/plsql/oe_inbound_int/">
  <oe:Responsibility>MANAGER</oe:Responsibility>
  <oe:RespApplication>AR</oe:RespApplication>
  <oe:SecurityGroup>STANDARD</oe:SecurityGroup>
  <oe:NLSLanguage>AMERICAN</oe:NLSLanguage>
  <oe:Org_Id>1</oe:Org_Id>
</oe:SOAHeader>
@achrinza achrinza added the bug label Aug 29, 2021
@ikallali

This comment was marked as spam.

@stale stale bot added the stale label Nov 13, 2021
@zbrook
Copy link

zbrook commented Feb 16, 2022

If I may join this party late, @saristar does your WSDL define your header?

I can see the module has a unit test ('should add soap headers' in client-test.js) just for this case, and it passes -- unless I change qname and/or the header's name, in which case the output header element lacks the given qname. You can also see this header defined in the WSDL imported by the unit test, and the unit test's comments indicate it wants the "header schema defined in default-namespace.wsdl".

Therefore I ask whether your WSDL defines the header you want; seems like the output doesn't respect otherwise.

For now I worked around it by passing the header as string literal XML. As you saw, you can also still the header as object, but you lose the qname.

I'm not sure what it('should add soap headers with a namespace') is for, since it doesn't seem to test for a namespace in the header.

@loopbackio loopbackio deleted a comment from stale bot Feb 16, 2022
@achrinza achrinza removed the stale label Feb 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants