1

I need to make the structure of my XML SOAP request to look like following:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.fines.pl/api/contract">
    <SOAP-ENV:Body>
        <ns1:newApplicationRequest>
            <user_login>XYZ</user_login>
            <user_password>XYZ</user_password>
            <contract>
<?xml version="1.0" encoding="UTF-8"?>
<sof:Contract xmlns:s="http://www.fines.pl/simple" xmlns:sof="http://www.fines.pl/sof" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.fines.pl/sof model.xsd ">
    <product>
        <prefix>MOP</prefix>
    </product>
    <participants>
        <customers>
            <main_borrower>
                <personal_data>
                    <pesel>85050949761</pesel>
                    <firstname>Anna</firstname>
                    <lastname>Test</lastname>
                    <firstname_father></firstname_father>
                    <firstname_mother></firstname_mother>
                    <secondname />
                    <sex>female</sex>
                </personal_data>
                <contact_data>
                    <addresses>
                        <address>
                            <type>registered</type>
                            <street_name>Grunwaldzka</street_name>
                            <block_number>11</block_number>
                            <flat_number>5</flat_number>
                            <postal_code>80-100</postal_code>
                            <city>Gdańsk</city>
                        </address>
                    </addresses>
                    <phones_mobile>
                        <phone_mobile>
                            <type>personal</type>
                            <number>602200300</number>
                        </phone_mobile>
                    </phones_mobile>
                </contact_data>
                <incomes>
                    <income>
                        <type>employment</type>
                        <main_income>true</main_income>
                        <fixed_term_contract>false</fixed_term_contract>
                        <paychecks>
                            <paycheck>
                                <amount_net>
                                    <amount>1444.00</amount>
                                    <currency>PLN</currency>
                                </amount_net>
                                <type>base</type>
                            </paycheck>
                        </paychecks>
                    </income>
                </incomes>
                <household_pointer>/households.0</household_pointer>
            </main_borrower>
        </customers>
    </participants>
</sof:Contract></contract></ns1:newApplicationRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>

I've set my $params variable to contain user_login and user_password elements with their respective values, but I have no idea how may I set this contract param with required content.

Providing $contract variable with XML code (which i thought may be a workaround) poop the Fatal error: Uncaught SoapFault exception: [xml_structure] String could not be parsed as XML error.

Would be grateful for explaining how could this be done.

1 Answer 1

3

You have declared <?xml?> twice , one on the first line and second on the eight. That's the only error I see in the xml side of things.

Sign up to request clarification or add additional context in comments.

2 Comments

The code i quoted was actually provided to me as request example, so it seems like i should nest some XML code inside contract param for me, or maybe they just sent me wrong example?
what ever it is you can't declare xml twice so most likely the example is wrong, if you want to further validate the xml try an xml validator. Like : w3schools.com/xml/xml_validator.asp Also have you tried removing it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.