Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help translating XML soap request #40

Open
elev8studio opened this issue Sep 20, 2021 · 1 comment
Open

Help translating XML soap request #40

elev8studio opened this issue Sep 20, 2021 · 1 comment

Comments

@elev8studio
Copy link

I'm not sure if this is the right place to post this, but I'm having an issue translating an XML soap request into the format required by this package.

I was hoping if I posted the XML below, someone might be willing to reply with the correct code to send the Soap request using this package?

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.id3global.com/ID3gWS/2013/04">
    <soapenv:Header>
        <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
            <wsse:UsernameToken>
                <wsse:Username>username</wsse:Username>
                <wsse:Password>password</wsse:Password>
            </wsse:UsernameToken>
        </wsse:Security>
    </soapenv:Header>
    <soapenv:Body>
        <ns:AuthenticateSP>
            <ns:ProfileIDVersion>
                <ns:ID>12345</ns:ID>
                <ns:Version>0</ns:Version>
            </ns:ProfileIDVersion>
            <ns:CustomerReference>test</ns:CustomerReference>
            <ns:InputData>
                <ns:Personal>
                    <ns:PersonalDetails>
                        <ns:Forename>test</ns:Forename>
                        <ns:Surname>test</ns:Surname>
                        <ns:DOBDay>01</ns:DOBDay>
                        <ns:DOBMonth>01</ns:DOBMonth>
                        <ns:DOBYear>1991</ns:DOBYear>
                    </ns:PersonalDetails>
                </ns:Personal>
                <ns:Addresses>
                    <ns:CurrentAddress>
                        <ns:Country>test</ns:Country>
                        <ns:Street>test</ns:Street>
                        <ns:City>test</ns:City>
                        <ns:ZipPostcode>test</ns:ZipPostcode>
                        <ns:Building>1</ns:Building>
                    </ns:CurrentAddress>
                </ns:Addresses>
            </ns:InputData>
        </ns:AuthenticateSP>
    </soapenv:Body>
</soapenv:Envelope>

This is what I currently have:

$header = Soap::header()
    ->name("Security")
    ->namespace("http://www.id3global.com/ID3gWS/2013/04")
    ->data([
        "UsernameToken" => [
            "Username" => $this->username,
            "Password" => $this->password,
        ],
    ])
    ->mustUnderstand();

$params = [
    "ProfileIDVersion" => [
        "ID" => "12345",
        "Version" => 0,
    ],
    "InputData" => [
        "Personal" => [
            "PersonalDetails" => [
                "Forename" => "Shenol",
                "Surname" => "Hoines",
                "DOBDay" => 28,
                "DOBMonth" => 4,
                "DOBYear" => 1984,
            ],
        ],
        "Addresses" => [
            "CurrentAddress" => [
                "Country" => "test",
                "Street" => "test",
                "City" => "test",
                "ZipPostcode" => "test",
                "Building" => "1",
            ],
        ],
    ],
];

return  Soap::to($this->url)->withHeaders($header)->call("AuthenticateSP", $params)->response;

It keeps returning this error: SoapFault with message 'An error occurred when verifying security for the message.'

Any help would be greatly appreciated.

@nedwors
Copy link
Contributor

nedwors commented Dec 13, 2023

Hi @elev8studio

Did you get sorted with this issue?

Also, apologies that it has taken a wee bit longer than expected to reply...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants