6070 Error when adding invoice to QbOnline via .net sdk v3 - c#

I am trying to add an Invoice with above specified XMl but getting 6070 Error Code.Amount is not equal to Qty * UnitPrice.Is there a way to ignore this error.
Here is my Add invoice request in Xml format.
<Invoice xmlns="http://schema.intuit.com/finance/v3">
<DocNumber> aa444</DocNumber>
<TxnDate>2013-08-06</TxnDate>
<Line>
<Amount>20.00</Amount>
<DetailType>SalesItemLineDetail</DetailType>
<SalesItemLineDetail>
<ItemRef name="HomecareServices">5</ItemRef>
<UnitPrice>20</UnitPrice>
<Qty>2</Qty>
<TaxCodeRef>NON</TaxCodeRef>
<ServiceDate>2013-08-01</ServiceDate>
</SalesItemLineDetail>
</Line>
<CustomerRef name="ABCD">10</CustomerRef>
<BillAddr>
<Line1>ABCD- 10</Line1>
</BillAddr>
<DueDate>2013-08-10</DueDate>
<TotalAmt>20.00</TotalAmt>
</Invoice>

SalesItemLineDetail is wrong, should be InvoiceItemLineDetail

Related

Get line number which tag contains text in XML file

Can you please tell me how to get line number using XDocument or XmlDocument?
In XDocument,
Input:
1. <title-group>
2. <article-title>Education Finance: How It Differs from the and the
Analytic and Data Collection Changes It Implies</article-title>
4. </title-group>
5. <contrib-group>
6. <contrib contrib-type="author"><name><surname>Guthrie</surname><given-names>James W.</given-names></name><aff>Department of Leadership, Policy and Organization, Peabody College of Vanderbil University, 230 Appleton Place, # Nashville, TN 37203-5721, E-mail: <email xlink="jwgxiii#sbcglobal.net">jwgxiii#sbcglobal.net</email></aff>
7. testest</contrib>
8. </contrib-group>
My output will look like:
2. <article-title>Education Finance: How It Differs from the and the Analytic and Data Collection Changes It Implies</article-title>
6. <contrib contrib-type="author"><name><surname>Guthrie</surname><given-names>James W.</given-names></name><aff>Department of Leadership, Policy and Organization, Peabody College of Vanderbil University, 230 Appleton Place, # Nashville, TN 37203-5721, E-mail: <email xlink="jwgxiii#sbcglobal.net">jwgxiii#sbcglobal.net</email></aff>
7. testest</contrib>
You will need to check using the HasLineInfo method if the XDocument supports line information.
If it does you can use it via the IXmlLineInfo Interface for functions like the LineNumber property.

How to modify an invoice in quickbooks using qbxml and qbsdk13?

This is my QBXML request
<?xml version="1.0" ?>
<?qbxml version="6.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<InvoiceModRq requestID="1">
<InvoiceMod>
<TxnID>85-1442639879</TxnID>
<EditSequence>1442639879</EditSequence>
<CustomerRef>
<ListID>80000005-1442639850</ListID>
<FullName>Bruce Banner</FullName>
</CustomerRef>
<TxnDate>2015-09-19</TxnDate>
<RefNumber>5462</RefNumber>
<InvoiceLineMod>
<ItemRef>
<ListID>8000000A-1442469770</ListID>
<FullName>Item 1</FullName>
</ItemRef>
<Quantity>1</Quantity>
<Rate>1100.00</Rate>
</InvoiceLineMod>
</InvoiceMod>
</InvoiceModRq>
</QBXMLMsgsRq>
</QBXML>
I am getting an error
QuickBooks found an error when parsing the provided XML text stream.
please help
If you refer to the QuickBooks OSR:
https://developer-static.intuit.com/qbSDK-current/Common/newOSR/index.html
You'll notice that within the <InvoiceLineMod> element, this node is required:
<TxnLineID>
The OSR gives you a bit more information too:
TxnLineID
Identification number of the transaction line. (TxnLineID
is supported as of v2.0 of the SDK. With qbXML v1.0 and v1.1,
TxnLineID is always returned as zero.)
If you need to add a new transaction line in a transaction Mod
request, you can do so by setting the TxnLineID to -1.
So, you'll need to add in a <TxnLineID> node. If it's a new line item, put -1 for the content within the node. If it's an existing line you're trying to update, put the TxnLineID value of the existing line in there.
Example:
...
<InvoiceLineMod>
<TxnLineID>-1</TxnLineID>
<ItemRef>
<ListID>8000000A-1442469770</ListID>
<FullName>Item 1</FullName>
</ItemRef>
<Quantity>1</Quantity>
<Rate>1100.00</Rate>
</InvoiceLineMod>
...

Preparing XSD of a complex xml

Thank you all for suggesting things and helping whenever in need.
Yesterday I was trying to develop and web app in asp.net 4.0 where I needed to parse the data from xml and save it in database. But before that I will also have to validate it.
I tried using .net provided tool xsd.exe to generate the schema file, but I dont know how will it know to mark which nodes or attributes are compulsory?
Like in my xml below items are mandatory
Root node <Market>
<Login> and its sub element
<ProductType> and its <ProductTypeID/>
The attribute DML is mandatory but should have only 3 values NONE, PUT or MODIFY
<ProductType> may or may not have <ProductItem>
If <ProductItem> is present then it should have <ProductItemID>
<ProductItem> may or may not have <Brand>
If <Brand> is present then it should have <BrandID>
Below is my xml
<?xml version="1.0" encoding="utf-8" ?>
<Market>
<Login>
<LoginId />
<Password />
</Login>
<ProductType DML="NONE">
<ProductTypeID/>
<Name/>
<Detail/>
<ProductItem DML="PUT">
<ProductItemID/>
<Name/>
<Detail/>
<Brand DML="PUT">
<BrandID/>
<Name/>
<Detail/>
</Brand>
<Brand DML="MODIFY">
<BrandID/>
<Name/>
<Detail/>
</Brand>
</ProductItem>
<ProductItem DML="MODIFY">
<ProductItemID/>
<Name/>
<Detail/>
</ProductItem>
</ProductType>
</Market>
How and where should I specify all the mandatory and optional parameters, so that my xsd is generated as per the requirement.
Thanks,
M.
xsd.exe can only try to infer, which elements/attributes are in you xml, but it cannot find out which information is mandatory. But this is a good startingpoint.
use a graphical XML_Schema_Editor to edit the genrated xsd to mark your mandatory fields. That is much easier than learning the xsd-language
I don't think XSD support nested XML. I would try to load the XML into an XmlDocument and check mandatory fields manually.

XmlDocument - I want <Item></Item> and not <Item/>

I have to send an XML as a SOAP response to a SAP WAS.
SAP is quite fussy with what you are sending (special characters and stuff), and by now I want to exhaust all possibilities.
Is there a way when you make a myXMLDoc.LoadXml
to specify something like "do not shorten tags when empty"?
Usually when you make this:
<item>
<Trkorr>TDEK978887</Trkorr>
<Sequence>0</Sequence>
<Solicit>cggaste</Solicit>
<Type></Type><Id></Id><Number></Number><Message></Message>
</item>
It transforms it to:
<item>
<Trkorr>TDEK978887</Trkorr>
<Sequence>0</Sequence>
<Solicit>cggaste</Solicit>
<Type/><Id/><Number/><Message/>
</item>
Any property I'm missing?
BTW (I don't think it's worth another question, so...)
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<soap-env:Body>
<soap-env:Fault>
<faultcode>soap-env:Server</faultcode>
<faultstring xml:lang="en">SOAP processing failure, error id = 112</faultstring>
</soap-env:Fault>
</soap-env:Body>
</soap-env:Envelope>
This is the error sap's returning.
Thanks in advance!
No, there isn't another way without writing everything yourself.
And even with that done, that's not the problem.
The problem is something on the SAP Server and/or the SAP Parameters you were sending beside those you show.
I'm not sure the end tags are the real problem. Take a look at SAP note 1318784 on how to enable tracing and use this to find out what's behind the error message 112.

How to create SQL Server table schema from a XML schema? (with .NET and Visual Studio 2008)

I have a XML schema, and I know that "xsd.exe" can generate the C# code for it. But I want to know if is possible to automatically create the MS SQL Server 2005+ tables from the XSD, with the help of this or other tools.
BTW I didn't get what the C# code generated by "xsd.exe" is worth for.
What's the difference between code generated by CodeXS and xsd.exe?
You can use the XSD2DB utility
This is the Example
xsd2db.exe -f true -l [Server Name] -n [Database Name] -s D:\po.xsd -t sql
Link for Help
http://xsd2db.sourceforge.net/
Disclaimer: I haven't done this myself, but I bookmarked these links a little while ago when I was thinking about doing this. This guy's T-SQL is usually brilliant, so I'd recommend it highly:
http://weblogs.sqlteam.com/peterl/archive/2009/03/05/Extract-XML-structure-automatically.aspx
http://weblogs.sqlteam.com/peterl/archive/2009/06/04/Extract-XML-structure-automatically-part-2.aspx
BTW I didn't get what the C# code
generated by "xsd.exe" is worth for.
I am assuming what you mean is "I don't understand how the generated code is useful"
The purpose of the code it generates is to serialize using the Microsoft serialization subsystem in .NET. If you create a new XmlSerializer(typeof(GeneratedType)), you can then call Serialize() and Deserialze() on it to go to/from Xml and objects.
In a more complicated code generator, such as CodeXS, it becomes even easier, as they generate helpers for you: GeneratedType.FromXML(Stream/String) to deserialize and myGeneratedType.Xml to serialize.
These generated classes allow you to work off a published schema, and have total confidence that any XML generated that meets the schema will parse and be generated using these types. You don't need to do any work to get the data out of the XML (ie no XML DOM access) and you don't need to think twice about generating XML that is compliant with your schema. It just works :)
As long as you can successfully parse your XML schema, you should be able to create the appropriate database scripts and execute them which will create your tables.
I know that this is an old topic, however it was really helpful to me to know how it can be done. Maybe it would be helpful to others.
More advanced examples can be seen at Microsoft page.
So, it is possible to create manually SQL table from XSD. For example, we have the following xml:
<?xml version="1.0" encoding="UTF-8"?>
<foo>
<row>
<CAR_NUM>624</CAR_NUM>
<CAR_ORDER>1</CAR_ORDER>
</row>
<row>
<CAR_NUM>623</CAR_NUM>
<CAR_ORDER>2</CAR_ORDER>
</row>
<row>
<CAR_NUM>681</CAR_NUM>
<CAR_ORDER>3</CAR_ORDER>
</row>
<row>
<CAR_NUM>625</CAR_NUM>
<CAR_ORDER>4</CAR_ORDER>
</row>
<row>
<CAR_NUM>680</CAR_NUM>
<CAR_ORDER>5</CAR_ORDER>
</row>
</foo>
So out XSD will look like this:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:sql="urn:schemas-microsoft-com:mapping-schema">
<xsd:element name="row" sql:relation="CAR"
sql:key-fields="CAR_NUM">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="CAR_NUM" type="xsd:integer" />
<xsd:element name="CAR_ORDER" type="xsd:integer" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
And SQL table will look like this:
CREATE TABLE CAR (
CAR_NUM INT ,
CAR_ORDER INT
GO
And then you can use Interop.SQLXMLBULKLOADLib library to load data into SQLServer:
try
{
var xmlFileName = #".your address here..\GetInformReplyEdited.xml";
var xsdScheme = #".your address here..\scheme.xsd";
var connString = "Provider=sqloledb;server=yourServer;database=Test;integrated security=SSPI";
SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class objBL = new SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class
{
ConnectionString = connString,
ErrorLogFile = "error.xml",
KeepIdentity = false
};
objBL.Execute(xsdScheme, xmlFileName);
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}

Categories

Resources