0

我想修改使用 qbxml 在 SalesorPurchase 聚合下创建的现有产品/服务。下面是我现在使用的代码。但它显示错误代码“400”。有人可以指导我吗?

版本 : Quickbooks online(QBXML 6.0)

    <?xml version="1.0" ?>
    <?qbxml version="6.0"?>
     <QBXML>    
     <SignonMsgsRq>     
     <SignonTicketRq>           
     <ClientDateTime>2013-05-31T19:25:26</ClientDateTime>           
     <SessionTicket>V1-92-Q0yzasxa55g3869b5u</SessionTicket>
     <Language>English</Language>           
    <AppID>70038</AppID>        
    <AppVer>1</AppVer>      
    </SignonTicketRq>   
    </SignonMsgsRq> 
    <QBXMLMsgsRq onError="stopOnError">
    <ItemServiceModRq>
    <ItemServiceMod>
    <ListID>4</ListID>
    <EditSequence>0</EditSequence>
    <Name>QBTubes1</Name>
    <SalesOrPurchaseMod>
    <Desc>All Shirts</Desc>
     <Price>49</Price>
    <AccountRef>
      <FullName>Sales</FullName>
    </AccountRef>
    </SalesOrPurchaseMod>
    </ItemServiceMod>
    </ItemServiceModRq>
    </QBXMLMsgsRq></QBXML>

请求方法:

 protected static String _doRequest(String xml) throws Exception {
        String xmlOut = null;

               try 
               {
                  URL url= new URL(GenericQBXML._appURL);
                  HttpsURLConnection connection =      (HttpsURLConnection)url.openConnection();
                  connection.setDoOutput(true);
                  connection.setDoInput(true);

                  connection.setRequestProperty("Content-Type", "application/x-qbxml");

                  PrintWriter out = new PrintWriter(connection.getOutputStream());
                  out.println(xml); //XML Input
                  out.close();
                  BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                  String inputLine = "";
                 String xmlOut = "";
                  StringBuffer strOut = new StringBuffer();

                  while ((inputLine = in.readLine()) != null)
                  {
                      strOut.append(inputLine);
                  }
                  xmlOut = strOut.toString();

                  in.close();
               }
               catch(ConnectException conEx)
               {
                  throw new Exception(conEx.getMessage());
               }
               catch(MalformedURLException malformedURLEx)
               {
                  throw new Exception(malformedURLEx.getMessage());
               }
               catch(IOException ioEx)
               {
                  throw new Exception(ioEx.getMessage());
               }
               return xmlOut;
    }

提前致谢。

4

1 回答 1

0
             New Request :


             <?xml version="1.0" ?>
                    <?qbxml version="6.0"?>
                     <QBXML>    
                     <SignonMsgsRq>     
                     <SignonTicketRq>           
                     <ClientDateTime>2013-05-31T19:25:26</ClientDateTime>           
                     <SessionTicket>V1-92-Q0yzasxa55g3869b5u</SessionTicket>
                     <Language>English</Language>           
                    <AppID>70038</AppID>        
                    <AppVer>1</AppVer>      
                    </SignonTicketRq>   
                    </SignonMsgsRq> 
                    <QBXMLMsgsRq onError="stopOnError">
                    <ItemServiceModRq>
                    <ItemServiceMod>
                    <ListID>4</ListID>
                    <EditSequence>0</EditSequence>
                    <Name>QBTubes1</Name>
                    <SalesOrPurchaseMod>
                     <Desc>All Shirts</Desc>
                     <Price>49</Price>
                    </SalesOrPurchaseMod>
                    </ItemServiceMod>
                    </ItemServiceModRq>
                    </QBXMLMsgsRq></QBXML>


              I have just removed below code from the original request and it's working now.we can not update Account details through the quick books online.here is the reference 

http://dev.developer.intuit.com/qbSDK-current/OSR/OnscreenRef/index-QBO.html

                   <AccountRef>       
                      <FullName>Sales</FullName>
                   </AccountRef>
于 2013-06-11T15:00:59.050 回答