以下是我发送给SOAP Web服务的请求。根据WSDL,当我使用PostTransaction时,它允许每个事务1个'CheckDetailEntries'实例。
<s:complexType name="PostTransactionRequest">
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="RequestHeader" nillable="true" type="tns:RequestHeader" />
<s:element minOccurs="1" maxOccurs="1" name="CheckDetailEntries" nillable="true" type="tns:ArrayOfChoice1" />
<s:element minOccurs="1" maxOccurs="1" name="CheckHeaderRequest" nillable="true" type="tns:CheckHeaderRequest" />
<s:element minOccurs="1" maxOccurs="1" name="OrderTypeNumber" type="s:unsignedByte" />
</s:sequence>
它说CheckDetailEntries是type =“tns:ArrayOfChoice1”。我该如何处理选择?目前我通过$request->REQ->CheckDetailEntries = new CheckDetailEntries();
启动CheckDetailEntries,它适用于一个项目,但当我尝试做两个项目时,我收到错误。我错过了什么吗?
我的PHP代码:
$request = new PostTransaction();
$request->REQ = new PostTransactionRequest();
$request->REQ->RequestHeader = new RequestHeader();
$request->REQ->RequestHeader->InterfaceVersion = $this->GetVersion($clientName)->data->interfaceVersion;
$request->REQ->RequestHeader->ClientName = $clientName;
$request->REQ->CheckDetailEntries = new CheckDetailEntries();
$request->REQ->CheckDetailEntries->MenuItem = new MenuItem();
$request->REQ->CheckDetailEntries->MenuItem->ReferenceEntry = "Item";
$request->REQ->CheckDetailEntries->MenuItem->Count = "1";
$request->REQ->CheckDetailEntries->MenuItem->Price = "1.67";
$request->REQ->CheckDetailEntries->MenuItem->ItemNumber = "112001";
$request->REQ->CheckDetailEntries->MenuItem->PriceLevel = "1";
// Here is the problem. How can I have multiple Items?
$request->REQ->CheckDetailEntries->MenuItem = new MenuItem();
$request->REQ->CheckDetailEntries->MenuItem->ReferenceEntry = "Item";
$request->REQ->CheckDetailEntries->MenuItem->Count = "1";
$request->REQ->CheckDetailEntries->MenuItem->Price = "1.67";
$request->REQ->CheckDetailEntries->MenuItem->ItemNumber = "125004";
$request->REQ->CheckDetailEntries->MenuItem->->MenuItem->PriceLevel = "1";
WSDL(必须剥离一些以适应体内30,000字符要求):
<s:complexType name="RequestHeader">
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="InterfaceVersion" nillable="true" type="s:string" />
<s:element minOccurs="1" maxOccurs="1" name="ClientName" nillable="true" type="s:string" />
</s:sequence>
</s:complexType>
<s:element name="RawPMSSendResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="RawPMSSendResponse" type="tns:RawPMSSendResponse" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="PostTransaction">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="REQ" type="tns:PostTransactionRequest" />
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="PostTransactionRequest">
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="RequestHeader" nillable="true" type="tns:RequestHeader" />
<s:element minOccurs="1" maxOccurs="1" name="CheckDetailEntries" nillable="true" type="tns:ArrayOfChoice1" />
<s:element minOccurs="1" maxOccurs="1" name="CheckHeaderRequest" nillable="true" type="tns:CheckHeaderRequest" />
<s:element minOccurs="1" maxOccurs="1" name="OrderTypeNumber" type="s:unsignedByte" />
</s:sequence>
</s:complexType>
<s:complexType name="ArrayOfChoice1">
<s:choice minOccurs="0" maxOccurs="unbounded">
<s:element minOccurs="1" maxOccurs="1" name="MenuItem" nillable="true" type="tns:MenuItem" />
<s:element minOccurs="1" maxOccurs="1" name="ServiceCharge" nillable="true" type="tns:ServiceCharge" />
<s:element minOccurs="1" maxOccurs="1" name="CreditCardTender" nillable="true" type="tns:CreditCardTender" />
<s:element minOccurs="1" maxOccurs="1" name="EnhancedServiceCharge" nillable="true" type="tns:EnhancedServiceCharge" />
<s:element minOccurs="1" maxOccurs="1" name="Information" nillable="true" type="tns:Information" />
<s:element minOccurs="1" maxOccurs="1" name="Condiment" nillable="true" type="tns:Condiment" />
<s:element minOccurs="1" maxOccurs="1" name="CashTender" nillable="true" type="tns:CashTender" />
<s:element minOccurs="1" maxOccurs="1" name="EnhancedTender" nillable="true" type="tns:EnhancedTender" />
<s:element minOccurs="1" maxOccurs="1" name="EnhancedMenuItem" nillable="true" type="tns:EnhancedMenuItem" />
</s:choice>
</s:complexType>
<s:complexType name="MenuItem">
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="ReferenceEntry" nillable="true" type="s:string" />
<s:element minOccurs="1" maxOccurs="1" name="Count" type="s:short" />
<s:element minOccurs="1" maxOccurs="1" name="Price" type="s:decimal" />
<s:element minOccurs="1" maxOccurs="1" name="ItemNumber" type="s:long" />
<s:element minOccurs="1" maxOccurs="1" name="PriceLevel" type="s:unsignedByte" />
<s:element minOccurs="1" maxOccurs="1" name="Seat" nillable="true" type="s:unsignedByte" />
</s:sequence>
</s:complexType>
<s:complexType name="EnhancedMenuItem">
<s:complexContent mixed="false">
<s:extension base="tns:MenuItem">
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="InterfaceNumber" type="s:int" />
<s:element minOccurs="1" maxOccurs="1" name="Service" nillable="true" type="s:string" />
<s:element minOccurs="1" maxOccurs="1" name="ServiceData" nillable="true">
<s:complexType mixed="true">
<s:sequence>
<s:any />
</s:sequence>
</s:complexType>
</s:element>
</s:sequence>
</s:extension>
</s:complexContent>
</s:complexType>
<s:complexType name="Condiment">
<s:complexContent mixed="false">
<s:extension base="tns:MenuItem">
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="Level" nillable="true" type="s:unsignedByte" />
</s:sequence>
</s:extension>
</s:complexContent>
</s:complexType>
<s:complexType name="ServiceCharge">
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="ReferenceEntry" nillable="true" type="s:string" />
<s:element minOccurs="1" maxOccurs="1" name="Count" type="s:short" />
<s:element minOccurs="1" maxOccurs="1" name="Price" type="s:decimal" />
<s:element minOccurs="1" maxOccurs="1" name="ItemNumber" type="s:long" />
<s:element minOccurs="1" maxOccurs="1" name="Item" type="s:decimal" />
<s:element minOccurs="1" maxOccurs="1" name="ItemChoiceType" type="tns:ItemChoiceType" />
</s:sequence>
</s:complexType>
<s:element name="PostTransactionResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="PostTransactionResponse" type="tns:PostTransactionResponse" />
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="PostTransactionResponse">
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="OperationResult" nillable="true" type="tns:OperationResult" />
<s:element minOccurs="1" maxOccurs="1" name="OrderAccepted" type="s:boolean" />
<s:element minOccurs="0" maxOccurs="1" name="CredCardAuthCode" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="CheckHeaderResponse" type="tns:CheckHeaderResponse" />
<s:element minOccurs="0" maxOccurs="1" name="PMSResponse" type="tns:ArrayOfString" />
</s:sequence>
</s:complexType>
<s:complexType name="CheckHeaderResponse">
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="CheckNumber" type="s:short" />
<s:element minOccurs="0" maxOccurs="1" name="CheckGuid" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="CheckID" type="s:string" />
<s:element minOccurs="1" maxOccurs="1" name="GuestCount" type="s:short" />
<s:element minOccurs="1" maxOccurs="1" name="EmployeeNumber" type="s:int" />
<s:element minOccurs="1" maxOccurs="1" name="Cashier" type="s:int" />
<s:element minOccurs="1" maxOccurs="1" name="UwsNumber" type="s:int" />
<s:element minOccurs="1" maxOccurs="1" name="CheckOpenTime" type="s:dateTime" />
<s:element minOccurs="0" maxOccurs="1" name="CheckClosedTime" type="s:dateTime" />
<s:element minOccurs="1" maxOccurs="1" name="OrderTypeNumber" type="s:unsignedByte" />
<s:element minOccurs="0" maxOccurs="1" name="CheckAutofireTime" type="s:dateTime" />
<s:element minOccurs="1" maxOccurs="1" name="CheckSubtotal" type="s:decimal" />
<s:element minOccurs="1" maxOccurs="1" name="CheckTaxTotal" type="s:decimal" />
<s:element minOccurs="1" maxOccurs="1" name="CheckAutogratuityTotal" type="s:decimal" />
<s:element minOccurs="1" maxOccurs="1" name="CheckOtherTotal" type="s:decimal" />
<s:element minOccurs="1" maxOccurs="1" name="CheckPaymentTotal" type="s:decimal" />
<s:element minOccurs="1" maxOccurs="1" name="CheckAmountDueTotal" type="s:decimal" />
<s:element minOccurs="1" maxOccurs="1" name="NumberOfCheckDetails" type="s:short" />
<s:element minOccurs="0" maxOccurs="1" name="GuestInformation" type="tns:GuestInformation" />
<s:element minOccurs="0" maxOccurs="1" name="CheckStatus" type="tns:ArrayOfBoolean" />
</s:sequence>
</s:complexType>
<s:element name="HeartBeatResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="bool" type="s:boolean" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="GetOpenCheckList">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="REQ" type="tns:GetOpenCheckSLUListRequest" />
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="GetOpenCheckSLUListRequest">
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="RequestHeader" nillable="true" type="tns:RequestHeader" />
</s:sequence>
</s:complexType>
<s:element name="GetOpenCheckListResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="GetOpenCheckSLUListResponse" type="tns:GetOpenCheckSLUListResponse" />
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="GetOpenCheckSLUListResponse">
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="index" type="s:int" />
<s:element minOccurs="1" maxOccurs="1" name="status" type="s:short" />
<s:element minOccurs="1" maxOccurs="1" name="num_entries" type="s:short" />
<s:element minOccurs="0" maxOccurs="1" name="OpenCheckDetails" type="tns:ArrayOfOpenCheckSLUEntry" />
<s:element minOccurs="1" maxOccurs="1" name="OperationResult" nillable="true" type="tns:OperationResult" />
</s:sequence>
</s:complexType>
<s:complexType name="ArrayOfOpenCheckSLUEntry">
<s:sequence>
<s:element minOccurs="0" maxOccurs="unbounded" name="OpenCheckSLUEntry" nillable="true" type="tns:OpenCheckSLUEntry" />
</s:sequence>
</s:complexType>
<s:complexType name="OpenCheckSLUEntry">
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="emp_status" type="s:short" />
<s:element minOccurs="1" maxOccurs="1" name="Autofire_Check" type="s:boolean" />
<s:element minOccurs="0" maxOccurs="1" name="id" type="s:string" />
<s:element minOccurs="1" maxOccurs="1" name="tbl" type="s:int" />
<s:element minOccurs="1" maxOccurs="1" name="grp" type="s:int" />
<s:element minOccurs="1" maxOccurs="1" name="number" type="s:int" />
<s:element minOccurs="0" maxOccurs="1" name="check_open_Time" type="s:string" />
<s:element minOccurs="1" maxOccurs="1" name="amt_due_ttl" type="s:decimal" />
<s:element minOccurs="1" maxOccurs="1" name="check_empl" type="s:int" />
<s:element minOccurs="0" maxOccurs="1" name="guid" type="s:string" />
</s:sequence>
</s:complexType>
<s:element name="AddToCheck">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="REQ" type="tns:PostTransactionRequest" />
<s:element minOccurs="0" maxOccurs="1" name="Check_Guid" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="AddToCheckResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="PostTransactionResponse" type="tns:PostTransactionResponse" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="CalculateTotalsAddToCheck">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="REQ" type="tns:CalculateTotalsRequest" />
<s:element minOccurs="0" maxOccurs="1" name="CheckGUID" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="CalculateTotalsAddToCheckResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="CalculateTotalsResponse" type="tns:CalculateTotalsExResponse" />
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>
</wsdl:message>
<wsdl:message name="PostTransactionSoapIn">
<wsdl:part name="parameters" element="tns:PostTransaction" />
</wsdl:message>
<wsdl:message name="PostTransactionSoapOut">
<wsdl:part name="parameters" element="tns:PostTransactionResponse" />
</wsdl:message>
<wsdl:message name="CalculateTotalsSoapIn">
<wsdl:part name="parameters" element="tns:CalculateTotals" />
</wsdl:message>
<wsdl:portType name="TransactionServices6Soap">
<wsdl:operation name="RawPMSSend">
<wsdl:input message="tns:RawPMSSendSoapIn" />
<wsdl:output message="tns:RawPMSSendSoapOut" />
</wsdl:operation>
<wsdl:operation name="PostTransaction">
<wsdl:input message="tns:PostTransactionSoapIn" />
<wsdl:output message="tns:PostTransactionSoapOut" />
</wsdl:operation>
<wsdl:operation name="CalculateTotals">
<wsdl:input message="tns:CalculateTotalsSoapIn" />
<wsdl:output message="tns:CalculateTotalsSoapOut" />
</wsdl:operation>
<wsdl:operation name="CalculateTotalsEx">
<wsdl:input message="tns:CalculateTotalsExSoapIn" />
<wsdl:output message="tns:CalculateTotalsExSoapOut" />
</wsdl:operation>
<wsdl:operation name="SimInquiry">
<wsdl:input message="tns:SimInquirySoapIn" />
<wsdl:output message="tns:SimInquirySoapOut" />
</wsdl:operation>
<wsdl:operation name="GetVersion">
<wsdl:input message="tns:GetVersionSoapIn" />
<wsdl:output message="tns:GetVersionSoapOut" />
</wsdl:operation>
<wsdl:operation name="HeartBeat">
<wsdl:input message="tns:HeartBeatSoapIn" />
<wsdl:output message="tns:HeartBeatSoapOut" />
</wsdl:operation>
<wsdl:operation name="GetOpenCheckList">
<wsdl:input message="tns:GetOpenCheckListSoapIn" />
<wsdl:output message="tns:GetOpenCheckListSoapOut" />
</wsdl:operation>
<wsdl:operation name="AddToCheck">
<wsdl:input message="tns:AddToCheckSoapIn" />
<wsdl:output message="tns:AddToCheckSoapOut" />
</wsdl:operation>
<wsdl:operation name="CalculateTotalsAddToCheck">
<wsdl:input message="tns:CalculateTotalsAddToCheckSoapIn" />
<wsdl:output message="tns:CalculateTotalsAddToCheckSoapOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="TransactionServices6Soap" type="tns:TransactionServices6Soap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="RawPMSSend">
<soap:operation soapAction="http://www.micros.com/pos/les/TransactionServices/RawPMSSend" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="PostTransaction">
<soap:operation soapAction="http://www.micros.com/pos/les/TransactionServices/PostTransaction" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="GetOpenCheckList">
<soap:operation soapAction="http://www.micros.com/pos/les/TransactionServices/GetOpenCheckList" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="AddToCheck">
<soap:operation soapAction="http://www.micros.com/pos/les/TransactionServices/AddToCheck" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="TransactionServices6Soap12" type="tns:TransactionServices6Soap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="RawPMSSend">
<soap12:operation soapAction="http://www.micros.com/pos/les/TransactionServices/RawPMSSend" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="PostTransaction">
<soap12:operation soapAction="http://www.micros.com/pos/les/TransactionServices/PostTransaction" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="CalculateTotals">
<soap12:operation soapAction="http://www.micros.com/pos/les/TransactionServices/CalculateTotals" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="CalculateTotalsEx">
<soap12:operation soapAction="http://www.micros.com/pos/les/TransactionServices/CalculateTotalsEx" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="SimInquiry">
<soap12:operation soapAction="http://www.micros.com/pos/les/TransactionServices/SimInquiry" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="GetVersion">
<soap12:operation soapAction="http://www.micros.com/pos/les/TransactionServices/GetVersion" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="HeartBeat">
<soap12:operation soapAction="http://www.micros.com/pos/les/TransactionServices/HeartBeat" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="GetOpenCheckList">
<soap12:operation soapAction="http://www.micros.com/pos/les/TransactionServices/GetOpenCheckList" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="AddToCheck">
<soap12:operation soapAction="http://www.micros.com/pos/les/TransactionServices/AddToCheck" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="CalculateTotalsAddToCheck">
<soap12:operation soapAction="http://www.micros.com/pos/les/TransactionServices/CalculateTotalsAddToCheck" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="TransactionServices6">
<wsdl:port name="TransactionServices6Soap" binding="tns:TransactionServices6Soap">
<soap:address location="http://localhost:8080/TransactionServices/TransactionServices6.asmx" />
</wsdl:port>
<wsdl:port name="TransactionServices6Soap12" binding="tns:TransactionServices6Soap12">
<soap12:address location="http://localhost:8080/TransactionServices/TransactionServices6.asmx" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>