获取quickbooks web连接器响应xml

时间:2016-11-23 14:58:09

标签: xml soap quickbooks

我一直试图弄清楚如何从发票添加请求中获取响应xml,以确定发票未在我们的QuickBooks桌面应用程序上显示的原因。

这是我的请求XML

<?xml version="1.0" encoding="utf-8"?>
      <?qbxml version="10.0"?>
<QBXML>
  <QBXMLMsgsRq onError="stopOnError">
    <InvoiceAddRq requestID="1">
      <InvoiceAdd>
        <CustomerRef>
          <FullName>Jason Bourne</FullName>
        </CustomerRef>
        <TxnDate>2016-10-18</TxnDate>
        <RefNumber>IR1-102016-00015</RefNumber>
        <BillAddress>
          <Addr1>Walt Disney World Resort</Addr1>
          <City>Orlando</City>
          <State></State>
          <PostalCode></PostalCode>
          <Country>United States</Country>
        </BillAddress>
        <PONumber></PONumber>
        <ItemSalesTaxRef>
                <FullName></FullName>
        </ItemSalesTaxRef>
        <Memo></Memo> 
        <InvoiceLineAdd>
          <ItemRef>
             <FullName>ProductName</FullName>
          </ItemRef>
          <Desc>ProductDescription</Desc>
          <Quantity>1</Quantity>
          <Rate>$100</Rate>
        </InvoiceLineAdd>

      </InvoiceAdd>
    </InvoiceAddRq>
  </QBXMLMsgsRq>
</QBXML>

QWCLog.txt显示我们已成功将其发送给QB并得到回复。

20161123.14:32:59 UTC   : QBWebConnector.SOAPWebService.do_sendRequestXML() : Received from sendRequestXML() following parameter:
20161123.14:32:59 UTC   : QBWebConnector.SOAPWebService.do_sendRequestXML() : strRequestXML =
20161123.14:32:59 UTC   : QBWebConnector.SOAPWebService.do_sendRequestXML() : XML dump follows: -

<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="10.0"?>
<QBXML>
......

20161123.14:32:59 UTC   : QBWebConnector.SOAPWebService.do_sendRequestXML() : Request xml received.
20161123.14:32:59 UTC   : QBWebConnector.SOAPWebService.ProcessRequestXML() : Processing request #1
20161123.14:32:59 UTC   : QBWebConnector.SOAPWebService.ProcessRequestXML() : REQUEST: received from application: size (bytes) = 994
20161123.14:32:59 UTC   : QBWebConnector.SOAPWebService.ProcessRequestXML() : Sending request to QuickBooks.
20161123.14:32:59 UTC   : QBWebConnector.SOAPWebService.ProcessRequestXML() : Response received from QuickBooks: size (bytes) = 245
20161123.14:32:59 UTC   : QBWebConnector.SOAPWebService.ProcessRequestXML() : Sending response back to application.
20161123.14:32:59 UTC   : QBWebConnector.SOAPWebService.do_receiveResponseXML() : *** Calling receiveResponseXML() with following parameters:
20161123.14:32:59 UTC   : QBWebConnector.SOAPWebService.do_receiveResponseXML() : wcTicket="9b9bc911-e40c-44be-8198-442c65d34585"
20161123.14:32:59 UTC   : QBWebConnector.SOAPWebService.do_receiveResponseXML() : response =
20161123.14:32:59 UTC   : QBWebConnector.SOAPWebService.do_receiveResponseXML() : XML dump follows: -

<?xml version="1.0" ?>
<QBXML>
<QBXMLMsgsRs>
<InvoiceAddRs requestID="1" st......

20161123.14:32:59 UTC   : QBWebConnector.SOAPWebService.do_receiveResponseXML() : hresult=""
20161123.14:32:59 UTC   : QBWebConnector.SOAPWebService.do_receiveResponseXML() : message=""
20161123.14:33:02 UTC   : QBWebConnector.SOAPWebService.do_receiveResponseXML() : Received from receiveResponseXML() following parameters:
20161123.14:33:02 UTC   : QBWebConnector.SOAPWebService.do_receiveResponseXML() : more="100">
20161123.14:33:02 UTC   : QBWebConnector.SOAPWebService.do_receiveResponseXML() : Done. No more to process.

试图获得&#34;响应&#34;参考但是那是空的。我在InvoiceAddRq requestxml上遗漏了什么吗?

开发环境规格: QuickBooks Premier非营利版试用版2014 QuickBooks Web Connector版本2.1.0.30

更新:

这里是receiveResponseXML的代码实现:

接收来电的网络方法。

public SendResponseXMLResponse receiveResponseXML(RecieveResponseXML sendResponseXmlSoapIn)
    {
        var sendRequestXmlResponse = new SendResponseXMLResponse();
        //get the qbxml response here...
        sendRequestXmlResponse.ReceiveResponseXMLResult.Add("100"); //100  means 100% complete tells QWC to close connection

        return sendRequestXmlResponse;
    }

响应对象模型:

[DataContract(Name = "receiveResponseXML")]
[MessageContract(WrapperName = "receiveResponseXML", IsWrapped = true)]
public class RecieveResponseXML
{
    [DataMember(Name = "wcTicket", IsRequired = true)]
    [MessageBodyMember(Name = "wcTicket", Order = 1)]
    public string WCTicket { get; set; }

    [DataMember(Name = "response ", IsRequired = true)]
    [MessageBodyMember(Name = "response ", Order = 2)]
    public string Response { get; set; }

    [DataMember(Name = "hresult ", IsRequired = true)]
    [MessageBodyMember(Name = "hresult ", Order = 3)]
    public string Hresult { get; set; }

    [DataMember(Name = "message ", IsRequired = true)]
    [MessageBodyMember(Name = "message ", Order = 4)]
    public string Message { get; set; }

    public RecieveResponseXML()
    {
    }

    public RecieveResponseXML(string wcTicket, string response, string hresult, string message)
    {
        this.WCTicket = wcTicket;
        this.Response = response;
        this.Hresult = hresult;
        this.Message = message;
    }
}

0 个答案:

没有答案