无法发送肥皂请求-无效的API名称空间-

时间:2019-05-22 19:03:44

标签: php xml laravel soap

我正在尝试在laravel应用程序中通过简单的curl调用发送一个soap请求,但遇到下一个错误。

<faultcode>soap:Client</faultcode>
<faultstring>Invalid API namespace</faultstring>

这是XML请求

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Header
        xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
        <wsse:Security SOAP-ENV:mustUnderstand="1">
            <wsse:UsernameToken>
                <wsse:Username>usename</wsse:Username>
                <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">randompass</wsse:Password>
            </wsse:UsernameToken>
        </wsse:Security>
    </SOAP-ENV:Header>
    <soapenv:Body>
        <requestMessage
            xmlns="urn:schemas-cybersource-com:transaction-data-N.NN">
            <merchantID>themerchantid</merchantID>
            <merchantReferenceCode>the reference</merchantReferenceCode>
            <billTo>
                <firstName>Name</firstName>
                <lastName></lastName>
                <street1></street1>
                <city></city>
                <state></state>
                <postalCode></postalCode>
                <country></country>
                <email>name@mail.com</email>
            </billTo>
            <item id="1">
                <unitPrice>25</unitPrice>
                <quantity>1</quantity>
            </item>
            <purchaseTotals>
                <currency>EUR</currency>
            </purchaseTotals>
            <card>
                <accountNumber>9898989898989898</accountNumber>
                <expirationMonth>10</expirationMonth>
                <expirationYear>20</expirationYear>
            </card>
            <ccAuthService run="true"/>
        </requestMessage>
    </soapenv:Body>
</soapenv:Envelope>

我不知道为什么会收到此错误。请求有什么问题?

1 个答案:

答案 0 :(得分:0)

您当前的名称空间 xmlns =“ urn:schemas-cybersource-com:transaction-data-N.NN” 应该 xmlns =“ urn:schemas-cybersource-com:transaction-data-1.155”

由于通常是必填字段,因此您还需要填充billTo字段。