我正在使用WSDL端点。而且我对SOAP客户端还很陌生,并且遇到了一些与XML集成的值的障碍。
我有部分片段与我要传递的数据有关。下方
<s:element name="CreateLoan2">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="Auth" type="tns:IntegrationAuthentication"/>
<s:element minOccurs="0" maxOccurs="1" name="Borrower" type="tns:ArrayOfBorrower"/>
<s:element minOccurs="0" maxOccurs="1" name="Broker" type="tns:Broker"/>
<s:element minOccurs="0" maxOccurs="1" name="Property" type="tns:ArrayOfProperty"/>
<s:element minOccurs="0" maxOccurs="1" name="LenderCaseId" type="s:string"/>
<s:element minOccurs="1" maxOccurs="1" name="LoanOfficerId" type="s:int"/>
<s:element minOccurs="0" maxOccurs="1" name="EntityName" type="s:string"/>
<s:element minOccurs="1" maxOccurs="1" name="PrePaymentPenaltyMonths" type="s:int"/>
<s:element minOccurs="0" maxOccurs="1" name="DealDescription" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="Program" type="s:string"/>
<s:element minOccurs="1" maxOccurs="1" name="LoanAmount" type="s:double"/>
<s:element minOccurs="1" maxOccurs="1" name="RequestedCloseDate" nillable="true" type="s:dateTime"/>
<s:element minOccurs="1" maxOccurs="1" name="InterestRate" type="s:decimal"/>
<s:element minOccurs="1" maxOccurs="1" name="TermMonths" type="s:int"/>
<s:element minOccurs="1" maxOccurs="1" name="OriginationPoints" type="s:decimal"/>
<s:element minOccurs="1" maxOccurs="1" name="BrokerPoints" type="s:decimal"/>
<s:element minOccurs="1" maxOccurs="1" name="InterestPaymentReservesType" type="tns:InterstReservesType"/>
<s:element minOccurs="1" maxOccurs="1" name="PurchaseFundsDisbursedAtClosing" type="s:decimal"/>
<s:element minOccurs="1" maxOccurs="1" name="RehabFundsDisbursedAtClosing" type="s:decimal"/>
<s:element minOccurs="0" maxOccurs="1" name="investorName" type="s:string"/>
<s:element minOccurs="1" maxOccurs="1" name="Holdback" type="s:double"/>
<s:element minOccurs="1" maxOccurs="1" name="DrawInterestType" type="tns:DrawInterestType"/>
<s:element minOccurs="1" maxOccurs="1" name="PointsRolled" type="s:boolean"/>
<s:element minOccurs="1" maxOccurs="1" name="InterestReservesRolled" type="s:boolean"/>
<s:element minOccurs="0" maxOccurs="1" name="Milestone" type="s:string"/>
<s:element minOccurs="1" maxOccurs="1" name="TriMergeCreditScore" nillable="true" type="s:int"/>
<s:element minOccurs="1" maxOccurs="1" name="LastPulledCreditDate" nillable="true" type="s:dateTime"/>
<s:element minOccurs="0" maxOccurs="1" name="LONote" type="s:string"/>
<s:element minOccurs="1" maxOccurs="1" name="RecentlyPreApproved" nillable="true" type="s:boolean"/>
<s:element minOccurs="1" maxOccurs="1" name="ExitStrategy" nillable="true" type="tns:ExitStrategy"/>
<s:element minOccurs="0" maxOccurs="1" name="ReferralSource" type="s:string"/>
<s:element minOccurs="1" maxOccurs="1" name="PlanToEscrowTaxesAndInsurance" nillable="true" type="s:boolean"/>
<s:element minOccurs="1" maxOccurs="1" name="OtherPropertiesCurrentlyUnderContract" nillable="true" type="s:boolean"/>
<s:element minOccurs="1" maxOccurs="1" name="CashAvailableToClose" nillable="true" type="s:decimal"/>
<s:element minOccurs="1" maxOccurs="1" name="NumberRehabsInLast6Months" nillable="true" type="s:int"/>
<s:element minOccurs="1" maxOccurs="1" name="NumberRehabsInLast12Months" nillable="true" type="s:int"/>
<s:element minOccurs="1" maxOccurs="1" name="NumberRehabsInLast24Months" nillable="true" type="s:int"/>
<s:element minOccurs="1" maxOccurs="1" name="NumberRehabsInLast60Months" nillable="true" type="s:int"/>
<s:element minOccurs="1" maxOccurs="1" name="CurrentNumberRehabsInProgress" nillable="true" type="s:int"/>
<s:element minOccurs="1" maxOccurs="1" name="ExistingHardPrivateMoneyLoansBalance" nillable="true" type="s:decimal"/>
<s:element minOccurs="1" maxOccurs="1" name="MonthlyPaymentAmntExistingHardPrivateMoneyLoans" nillable="true" type="s:decimal"/>
</s:sequence>
</s:complexType>
</s:element>
我们还有
<s:simpleType name="InterstReservesType">
<s:restriction base="s:string">
<s:enumeration value="Percent"/>
<s:enumeration value="Months"/>
</s:restriction>
</s:simpleType>
我遇到的错误是System.Web.Services.Protocols.SoapException: Server was unable to read request. ---> System.InvalidOperationException: There is an error in XML document (2, 617). ---> System.InvalidOperationException: Instance validation error: 'Array' is not a valid value for InterstReservesType.
我的代码如下
$url = 'someservice.com/serviceprovider.asmx?WSDL';
$soapclient = new soapClient($url);
$param = array(
'CustomerId'=>'1',
'IntegrationKey'=>'2erf13rsdfsdfsdfw2',
'LoanOfficerId'=>'21sdfs978',
'PrePaymentPenaltyMonths'=>'2',
'LoanAmount'=>'33200',
'InterestRate'=>'3.45',
'TermMonths'=>'34',
'OriginationPoints'=>'123',
'BrokerPoints'=>'1254',
'InterestPaymentReservesType'=> array('Percent'=>'1231', 'Months'=>'123'),
'InterstReservesType'=>'sdfsd',
'PurchaseFundsDisbursedAtClosing'=>'123123.11' ,
'RehabFundsDisbursedAtClosing'=>'1232',
'Holdback'=>'123',
'DrawInterestType'=>'',
'PointsRolled'=>'',
'InterestReservesRolled'=>'',
'Milestone'=>'',
'TriMergeCreditScore'=>'',
'LastPulledCreditDate'=>'',
'LONote'=>'',
'RecentlyPreApproved'=>'',
'ExitStrategy'=>'',
'ReferralSource'=>'',
'PlanToEscrowTaxesAndInsurance'=>'',
'OtherPropertiesCurrentlyUnderContract'=>'',
'CashAvailableToClose'=>'',
'NumberRehabsInLast6Months'=>'',
'NumberRehabsInLast12Months'=>'',
'NumberRehabsInLast24Months'=>'',
'NumberRehabsInLast60Months'=>'',
'CurrentNumberRehabsInProgress'=>'',
'ExistingHardPrivateMoneyLoansBalance'=>'',
'MonthlyPaymentAmntExistingHardPrivateMoneyLoans'=>''
);
$response = $soapclient->CreateLoan2($param);
var_dump($response);
$array = json_decode(json_encode($response), true);
print_r($array);
}catch(Exception $e){
echo '<pre>';
echo $e->getMessage();
echo '</pre>';
}
想法是提交数据以使用从表单提交中检索的值创建贷款。任何帮助和建议,我将不胜感激,或者如果您需要更多信息。谢谢。
编辑:
<Borrower>
<Borrower>
<first_name>string</first_name>
<middle_name>string</middle_name>
<last_name>string</last_name>
<primary_phone>string</primary_phone>
<email>string</email>
<ssn>string</ssn>
<is_guarantor>boolean</is_guarantor>
<lender_API_id>string</lender_API_id>
<BorrowerResidenceOwnershipPaymentType>Mortgage or Rent or PaidOff or Other</BorrowerResidenceOwnershipPaymentType>
</Borrower>
</Borrower>