Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP SOAP Client error

Tags:

php

soap

api

I'm getting this weird error "Value cannot be null. Parameter name: input" But there's no parameter with the name "input".

I've tried changing the code and playing around with it, but I think there's something simple that I'm missing here (haven't used SOAP for years).

<?php

$xmlData = '<LoanRequest><VendorId>20</VendorId>
<SubVendorId>0</SubVendorId>
<Tier>Dynamic</Tier>
<FirstName>TestFname</FirstName>
<LastName>TestLname</LastName>
<DateOfBirth>1979-03-09</DateOfBirth>
<Title>Mr</Title>
<Postcode>SO164LN</Postcode>
<HouseNumber>98</HouseNumber>
<Street>Test Street</Street>
<Town>Test Town</Town>
<County>Test County</County>
<HomeOwner>False</HomeOwner>
<HomePhone>02300000000</HomePhone>
<WorkPhone>02000000000</WorkPhone>
<MobilePhone>0799123321</MobilePhone>
<Email>[email protected]</Email>
<IncomeSource>5</IncomeSource>
<EmployerName>PDB Test</EmployerName>
<TimeWithEmployer>48</TimeWithEmployer>
<PaidByDirectDeposit>1</PaidByDirectDeposit>
<NetMonthlyIncome>1700</NetMonthlyIncome>
<PayFrequency>3</PayFrequency>
<NextPayDay>2013-05-31</NextPayDay>
<PaydayAfterNext>2013-06-07</PaydayAfterNext>
<DebitCard>VD</DebitCard>
<BankAccountNumber>12345678</BankAccountNumber>
<BankSortCode>9987655</BankSortCode>
<NIN></NIN>
<LoanAmount>500</LoanAmount>
<IPAddress>127.0.0.1</IPAddress>
<Consent>1</Consent>
<TimeAtAddressYears>2</TimeAtAddressYears>
<TimeAtAddressMonths>3</TimeAtAddressMonths>
<UserAgent>Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0)</UserAgent>
<LoanPurpose>Car</LoanPurpose>
<Pricequote>10</Pricequote>
<HousingExpenditure>100</HousingExpenditure>
<CreditExpenditure>150</CreditExpenditure>
<OtherExpenditure>220</OtherExpenditure></LoanRequest>';

$url = 'http://www.pdbuk.co.uk/API/loan.asmx?wsdl';
$options["location"] = $url;
$options['trace'] = 1;

$client = new SoapClient($url, $options);
$result = $client->SendRequest($xmlData);
var_dump($result);
?>

What am I doing wrong? Thanks!

like image 941
Ignas Avatar asked Aug 06 '13 10:08

Ignas


1 Answers

The XML data that should be passed should be an array rather than a string (based on the WSDL). So this will work:

$result = $client->SendRequest(array('inpXml' => $xmlData));
like image 164
c-throo Avatar answered Oct 30 '22 12:10

c-throo