Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Please, help! How to create an item via web connector in QuickBooks Java #6

Open
@MarErm27

Description

@MarErm27

Hello!
I was wondering if you might be able to help, my program is trying to add an invoice but it can't because it can't find an item reference. So I'm trying to add an item, here is an XML that I've done. How to send it to QuickBooks?

<?xml version="1.0"?> <?qbxml version="13.0"?><QBXML><QBXMLMsgsRq onError="continueOnError"><ItemInventoryAddRq><ItemInventoryAdd><Name>Marat</Name><ClassRef><ListID>MAR00610-SD</ListID><FullName> Marat</FullName></ClassRef></ItemInventoryAdd></ItemInventoryAddRq></QBXMLMsgsRq></QBXML>

Here is my Java code that creates the XML:

public String addItem(String itemRefName) throws QBDB.DbException, JAXBException, URISyntaxException, IOException, ClassNotFoundException {
  String[] itemData = itemRefName.split(":", 2);
  System.out.println("=> item name" + itemData[0]);
  System.out.println("=> item ref" + itemData[1]);
  String xml = "";
  QBXML qbXML = new QBXML();
  QBXMLMsgsRq xmlMsgRq = new QBXMLMsgsRq();
  xmlMsgRq.setOnError("continueOnError");
  qbXML.setQBXMLMsgsRq(xmlMsgRq);

  List<Object> reqList = xmlMsgRq.getHostQueryRqOrCompanyQueryRqOrCompanyActivityQueryRq();

  ItemInventoryAddRqType itemAddRq = new ItemInventoryAddRqType();
  reqList.add(itemAddRq);
  ItemInventoryAdd item = new ItemInventoryAdd();
  itemAddRq.setItemInventoryAdd(item);
  item.setName(itemData[0]);
  ClassRef classRef = new ClassRef();
  classRef.setFullName(itemData[0]);
  classRef.setListID(itemData[1]);
  item.setClassRef(classRef);
  xml = getRequestXml(qbXML);
  return xml;
}

Error from invoice: InvoiceQueryRsType: A query request did not find a matching object in QuickBooks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions