ChronoFresh SOAP验证

2024-10-03 06:32:15 发布

您现在位置:Python中文网/ 问答频道 /正文

我将Web Service of Chronopost与库Zeep一起使用。你知道吗

但我无法在方法searchDeliverySlot上进行身份验证

    wsdl = 'https://ws.chronopost.fr/rdv-cxf/services/CreneauServiceWS?wsdl'
    client = zeep.Client(wsdl=wsdl)

    header = xsd.Element(
        '{http://cxf.soap.ws.creneau.chronopost.fr/}searchDeliverySlot',
        xsd.ComplexType([
            xsd.Element(
                '{http://cxf.soap.ws.creneau.chronopost.fr/}accountNumber',
                xsd.String()),
            xsd.Element(
                '{http://cxf.soap.ws.creneau.chronopost.fr/}password',
                xsd.String()),
        ])
    )
    header_value = header(accountNumber='xxxxxx', password='xxxxx')

    data = client.service.searchDeliverySlot(callerTool='RDVWS',productType='FRESH',shipperZipCode='73000',recipientZipCode='73000',dateBegin=datetime.date(2017, 10, 30),isDeliveryDate=True
        , _soapheaders=[header_value]
        )

我得到这个错误

{
'code': 30,
'message': 'Invalid accesColis password null',
'meshCode': None,
'slotList': [],
'transactionID': None
}

你能帮我验证一下服务吗

谢谢


Tags: clienthttpwsservicepasswordelementfrsoap
1条回答
网友
1楼 · 发布于 2024-10-03 06:32:15

是的,我找到了正确的语法。要做到这一点,我需要帮助我使用soapui来显示要发送的正确xml对象

    header = xsd.Element(
        '{http://schemas.xmlsoap.org/soap/envelope/}Header',
        xsd.ComplexType([
            xsd.Element(
                '{http://cxf.soap.ws.creneau.chronopost.fr/}accountNumber',
                xsd.String()),
            xsd.Element(
                '{http://cxf.soap.ws.creneau.chronopost.fr/}password',
                xsd.String()),
        ])
    )

相关问题 更多 >