suds-community / suds

Suds is a lightweight SOAP python client for consuming Web Services. A community fork of the jurko fork.
https://suds.readthedocs.io/
GNU Lesser General Public License v3.0
173 stars 56 forks source link

How to assemble parameters in CDATA #61

Closed jakehu closed 2 years ago

jakehu commented 2 years ago

My request parameter xml is:

<soapenv:Envelope
xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/
xmlns:erp=http://xmlns.oracle.com/Enterprise/Tools/schemas/CST_INF_REQ.V1">
<soapenv:Header/>
<soapenv:Body>
<erp:REQUEST>
<erp:BATCH_NUM>xxx</erp:BATCH_NUM>
<erp:IFAC_CODE>xxx</erp:IFAC_CODE>
<erp:REQUEST_DATA>
<![CDATA[
<ROOT>
<CST_PAGENUMBER>xxx</CST_PAGENUMBER>
<CST_PAGESIZE>xxx</CST_PAGESIZE>
<RUN_TYPE>xxx</RUN_TYPE>
<TOKENID>xxx</TOKENID>
<SYSTEM>xxx</SYSTEM>
</ROOT>]]>
</erp:REQUEST_DATA>
</erp:REQUEST>
</soapenv:Body>
</soapenv:Envelope>

The method the client sees is

CST_INF_JOBCODE_OUT(xs:string BATCH_NUM, xs:string IFAC_CODE, xs:string REQUEST_DATA, )

My code:

from suds.client import Client

url = "http://172.19.1.7/PSIGW/PeopleSoftServiceListeningConnector/PSFT_HR/CST_INF_SERVICE.13.wsdl"
client = Client(url)
print(client)
testParam = {
    "BATCH_NUM": "xxx",
    "IFAC_CODE": "xxx",
    "REQUEST_DATA": {
        "CST_PAGENUMBER": 100,
        "CST_PAGESIZE": 1,
        "RUN_TYPE": "ALL",
        "TOKENID": "xxx",
        "SYSTEM": "xxx",
    },
}
result = client.service.CST_INF_JOBCODE_OUT(**testParam)
print(result)

This request is wrong, but how should I write the parameters in REQUEST_DATA?

WeiKKJ commented 2 years ago

how you solved the problem