代码之家  ›  专栏  ›  技术社区  ›  Imran S.

Workday请求在SoapUI中有效,但在Postman中无效

  •  5
  • Imran S.  · 技术社区  · 8 年前

    我正试着打电话给 Put_Background_Check Workday招聘web服务的操作。我已在SoapUI中打开WSDL文件,并成功发送了以下XML。。。

    <?xml version="1.0" encoding="UTF-8"?>
    <env:Envelope
        xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:wd="urn:com.workday/bsvc">
        <env:Body>
            <wd:Put_Background_Check_Request
                xmlns:wd="urn:com.workday/bsvc"
                wd:version="v26.2">
                <wd:Business_Process_Parameters>
                    <wd:Run_Now>true</wd:Run_Now>
                </wd:Business_Process_Parameters>
                <wd:Background_Check_Data>
                    <wd:Event_Reference>
                        <wd:ID wd:type="Background_Check_ID">BACKGROUND_CHECK_EVENT-6-96</wd:ID>
                    </wd:Event_Reference>
                    <wd:Background_Check_Status_Data>
                        <wd:Status_Date>2016-12-16</wd:Status_Date>
                        <wd:Status_Reference>
                            <wd:ID wd:type="Background_Check_Status_ID">Background_Check_Status_Pending</wd:ID>
                        </wd:Status_Reference>
                    </wd:Background_Check_Status_Data>
                    <wd:Package_Reference_Data>
                        <wd:Package_Reference>
                            <wd:ID wd:type="Background_Check_Package_ID">BACKGROUND_CHECK_PACKAGE_QR1SQ</wd:ID>
                        </wd:Package_Reference>
                        <wd:Status_Reference>
                            <wd:ID wd:type="Background_Check_Status_ID">Background_Check_Status_Pending</wd:ID>
                        </wd:Status_Reference>
                    </wd:Package_Reference_Data>
                </wd:Background_Check_Data>
            </wd:Put_Background_Check_Request>
        </env:Body>
    </env:Envelope>
    

    我得到以下回应。。。

    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
       <env:Body>
          <wd:Put_Background_Check_Response wd:version="v26.2" xmlns:wd="urn:com.workday/bsvc">
             <wd:Event_Reference wd:Descriptor="Background Check for Job Application: Elizabeth Taylor - R0000039 Diversity Report Test (Open)">
                <wd:ID wd:type="WID">ee6477431cb2100ca61ac0100d041523</wd:ID>
                <wd:ID wd:type="Background_Check_ID">BACKGROUND_CHECK_EVENT-6-96</wd:ID>
             </wd:Event_Reference>
          </wd:Put_Background_Check_Response>
       </env:Body>
    </env:Envelope>
    

    网址是 https://wd3-impl-services1.workday.com/ccx/service/TENANT/Recruiting/v27.1 .身份验证方法是基本身份验证username@tenant和密码。HTTP日志如下所示。。。 SoapUI HTTP log

    问题是,当我尝试在Postman(或cURL或Python请求)中使用相同的头重新创建相同的POST请求时,会出现无效的用户名或密码错误。索皮在这里有什么特别的事吗?这种情况下的反应如下。。。

    <?xml version="1.0" encoding="utf-8"?>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
        <SOAP-ENV:Body>
            <SOAP-ENV:Fault xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wd="urn:com.workday/bsvc">
                <faultcode>SOAP-ENV:Client.authenticationError</faultcode>
                <faultstring>invalid username or password</faultstring>
            </SOAP-ENV:Fault>
        </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    
    1 回复  |  直到 8 年前
        1
  •  3
  •   Imran S.    8 年前

    在这种情况下,SoapUI会修改传出的XML。它在 <env:Body> 元素,然后将其作为POST请求发送出去。

    <env:Header>
        <wsse:Security
            env: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 wsu:Id="UsernameToken-86F2FCCEFFBB80C4CD14820998755791">
                <wsse:Username>username@tenant</wsse:Username>
                <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">password</wsse:Password>
                <wsse:Nonce
                    EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">asdfwrqwarqwr1+oA==
                </wsse:Nonce>
                <wsu:Created>2016-12-18T22:24:30.575Z</wsu:Created>
            </wsse:UsernameToken>
        </wsse:Security>
    </env:Header>
    

    因此,我已经将其添加到原始XML中,并从请求中删除了基本的Auth头,它可以工作了。

    推荐文章