Python SUDS doesn't include namespace in the parameter while calling

284 views Asked by At

Using SOAP UI, the call to my service looks like this:

 <?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope 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" xmlns:ns0="http://transactionblackout.service.sms.app.fc.ofss.com/TransactionBlackoutApplicationService" xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns2="http://context.app.fc.ofss.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
  <SOAP-ENV:Header>
  <wsse:Security mustUnderstand="true">
     <wsse:UsernameToken>
        <wsse:Username>ofssuser</wsse:Username>
        <wsse:Password>welcome1</wsse:Password>
        <wsse:Nonce>aa2cfee1df46db6c9badc306b5cd67d8</wsse:Nonce>
        <wsu:Created>2016-12-16T12:24:19.523257Z</wsu:Created>
     </wsse:UsernameToken>
  </wsse:Security>
</SOAP-ENV:Header>
   <ns1:Body>
        <ns0:fetchAllBlackoutsTransactionBlackout>
     <ns0:sessionContext>
        <ns2:bankCode>08</ns2:bankCode>
        <ns2:channel>BRN</ns2:channel>
        <ns2:externalBatchNumber/>
        <ns2:externalSystemAuditTrailNumber/>
        <ns2:serviceCallContextType/>
        <ns2:targetUnit>OBP_BU</ns2:targetUnit>
        <ns2:transactionBranch>089999</ns2:transactionBranch>
        <ns2:userId>ofssuser</ns2:userId>
     </ns0:sessionContext>
  </ns0:fetchAllBlackoutsTransactionBlackout>
</ns1:Body>
</SOAP-ENV:Envelope>

My client looks likes this

Service ( TransactionBlackoutApplicationService ) tns="http://transactionblackout.service.sms.app.fc.ofss.com/TransactionBlackoutApplicationService"
 Prefixes (11)
  ns0 = "http://context.app.fc.ofss.com"
  ns1 = "http://datatype.fc.ofss.com"
  ns2 = "http://dto.common.domain.framework.fc.ofss.com"
  ns3 = "http://enumeration.fc.ofss.com"
  ns4 = "http://enumeration.infra.fc.ofss.com"
  ns5 = "http://error.validation.infra.fc.ofss.com"
  ns6 = "http://exception.infra.fc.ofss.com"
  ns7 = "http://response.service.fc.ofss.com"
  ns8 = "http://transactionblackout.dto.sms.app.fc.ofss.com"
  ns9 = "http://transactionblackout.service.sms.app.fc.ofss.com/TransactionBlackoutApplicationService"
  ns10 = "http://validation.dto.app.fc.ofss.com"
Ports (1):
  (TransactionBlackoutApplicationServicePort)
     Methods (8):
        addBlackout(ns0:sessionContext sessionContext, ns8:transactionBlackoutDTO blackoutDTO, )
        closeBlackout(ns0:sessionContext sessionContext, ns8:transactionBlackoutDTO blackoutDTO, )
        deleteBlackout(ns0:sessionContext sessionContext, ns8:transactionBlackoutDTO blackoutDTO, )
        fetchAllBlackouts(ns0:sessionContext sessionContext, )
        fetchBlackout(ns0:sessionContext sessionContext, ns8:transactionBlackoutDTO blackoutDTO, )
        fetchUserBlackout(ns0:sessionContext sessionContext, xs:string role, xs:string partyId, )
        reopenBlackout(ns0:sessionContext sessionContext, ns8:transactionBlackoutDTO blackoutDTO, )
        updateBlackout(ns0:sessionContext sessionContext, ns8:transactionBlackoutDTO blackoutDTO, )
     Types (40):
        addBlackoutTransactionBlackout
        addBlackoutTransactionBlackoutResponse
        ns0:approvalContext
        ns7:baseResponse
        closeBlackoutTransactionBlackout
        closeBlackoutTransactionBlackoutResponse
        ns2:dataTransferObject
        ns1:date
        deleteBlackoutTransactionBlackout
        deleteBlackoutTransactionBlackoutResponse
        ns2:dictionary
        ns2:domainObjectDTO
        ns3:entityStatus
        ns6:extendedReply
        ns6:fatalExceptionBean
        fetchAllBlackoutsTransactionBlackout
        fetchAllBlackoutsTransactionBlackoutResponse
        fetchBlackoutTransactionBlackout
        fetchBlackoutTransactionBlackoutResponse
        fetchUserBlackoutTransactionBlackout
        fetchUserBlackoutTransactionBlackoutResponse
        ns3:maintenanceType
        ns2:nameValuePairDTO
        ns3:recordStatusType
        reopenBlackoutTransactionBlackout
        reopenBlackoutTransactionBlackoutResponse
        ns6:replyMessage
        ns4:replyMessageType
        ns4:responseCodeType
        ns3:serviceCallContextType
        ns0:sessionContext
        ns8:transactionBlackoutDTO
        ns8:transactionBlackoutInquiryResponse
        ns8:transactionBlackoutKeyDTO
        ns7:transactionStatus
        updateBlackoutTransactionBlackout
        updateBlackoutTransactionBlackoutResponse
        ns0:userContext
        ns10:validatable
        ns5:validationError

I tried the following using suds:

session = client.factory.create('{http://context.app.fc.ofss.com}sessionContext')
session.value = my_values
response=client.service.fetchAllBlackouts(sessionContext=session)

But the service is looking like:

    <?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope 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" xmlns:ns0="http://transactionblackout.service.sms.app.fc.ofss.com/TransactionBlackoutApplicationService" xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns2="http://context.app.fc.ofss.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
   <SOAP-ENV:Header>
  <wsse:Security mustUnderstand="true">
     <wsse:UsernameToken>
        <wsse:Username>ofssuser</wsse:Username>
        <wsse:Password>welcome1</wsse:Password>
        <wsse:Nonce>36fd4993d9165bdfa720c7c1d66c6582</wsse:Nonce>
        <wsu:Created>2016-12-16T12:41:54.985519Z</wsu:Created>
     </wsse:UsernameToken>
  </wsse:Security>
  </SOAP-ENV:Header>
 <ns1:Body>
  <ns0:fetchAllBlackoutsTransactionBlackout>
     <sessionContext>
        <ns2:bankCode>08</ns2:bankCode>
        <ns2:channel>BRN</ns2:channel>
        <ns2:externalBatchNumber/>
        <ns2:externalSystemAuditTrailNumber/>
        <ns2:serviceCallContextType/>
        <ns2:targetUnit>OBP_BU</ns2:targetUnit>
        <ns2:transactionBranch>089999</ns2:transactionBranch>
        <ns2:userId>ofssuser</ns2:userId>
     </sessionContext>
  </ns0:fetchAllBlackoutsTransactionBlackout>

That is in the sessionContect parameter it is not adding the namespace and i am getting the following error:

Server raised fault: 'Unable to process request   '

The service is getting hit but the parameter sessionContext passed is null

0

There are 0 answers