cannot insert NULL into ("ESB"."ADDRESS_API"."LABEL_NAME_MAP") - intuit-partner-platform

Attempting to hit the Customers end point and the API keeps rejecting my request with this extremely nondescript error:
<ErrorCode>-3002</ErrorCode>
<ErrorDesc>cannot insert NULL into ("ESB"."ADDRESS_API"."LABEL_NAME_MAP")</ErrorDesc>
<DBErrorCode>01400</DBErrorCode>
Here is the sample XML:
<?xml version='1.0' encoding='utf-8' ?>
<Add RequestId='47e1633341s4521a24e269ad12ab3f6' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns='http://www.intuit.com/sb/cdm/v2'>
<ExternalRealmId>111111111</ExternalRealmId>
<Object xsi:type='Customer'>
<TypeOf>Organization</TypeOf>
<Name>SampleCustomer</Name>
<Address>
<Line1>123 E. Fake St</Line1>
<Line2>Suite 1</Line2>
<City>Somewhere</City>
<Country>USA</Country>
<CountrySubDivisionCode>FL</CountrySubDivisionCode>
<PostalCode>12345</PostalCode>
<Default>true</Default>
<Tag>Billing</Tag>
</Address>
<Phone>
<DeviceType>LandLine</DeviceType>
<FreeFormNumber>123-456-4563</FreeFormNumber>
<Default>true</Default>
<Tag>Main</Tag>
</Phone>
<DBAName>Sample Customer</DBAName>
<AcctNum>51f2ce86134c03000a000155</AcctNum>
</Object>
</Add>
Any suggestions? These exceptions are super confusion. I found the one related to "ESB"."PHONE_API"."LABEL_NAME_MAP" was related to an empty phone number field. That isn't the case with this request.

You edited your post to reflect a correct tag, so this answer may no longer be relevant
My first guess would be that, per the documentation, the Address/Tag node allowable values are defined by the PhysicalAddressLabelType enum.
Tag - String - Tag (or label) that identifies the use of the address. The
values allowed are defined in the PhysicalAddressLabelType.
If you look at the allowable values, you'll see the only allowable values are:
Billing
Shipping
But you specified:
Office
Can you try specifying a valid value?
Likewise, you're specifying an invalid Tag for the Phone node as well. The allowable values are here:
https://developer.intuit.com/docs/0025_quickbooksapi/0050_data_services/v2/0500_quickbooks_windows/062_enumerations/telephonenumberlabeltype
But you've specified:
Main
Can you try specifying a valid value?

Related

JAXB binding XBRL element does not work

I am trying to generate localised XBRL classes with JAXB in Eclipse, but I have been getting an error:
[ERROR] Property "Title" is already defined. Use <jaxb:property> to resolve this conflict.
line 145 of http://www.xbrl.org/2003/xl-2003-12-31.xsd
[ERROR] The following location is relevant to the above error
line 151 of http://www.xbrl.org/2003/xl-2003-12-31.xsd
As the error suggests, an element and an attribute name conflicts. These are lines 145 and 151:
<element ref="xl:title" minOccurs="0" maxOccurs="unbounded" />
<attribute ref="xlink:title" use="optional" />
So I'd need to rename either (or both). This is what I've been trying to do - bind the element title to titleElement:
<jxb:bindings version="1.0"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xl="http://www.xbrl.org/2003/XLink"
schemaLocation="http://www.xbrl.org/2003/xl-2003-12-31.xsd">
<jxb:bindings node="//element[#ref='xl:title']">
<jxb:property ref="xl:titleElement"/>
</jxb:bindings>
</jxb:bindings>
This produces the following error, plus the original "title already defined" errors:
[ERROR] XPath evaluation of "//element[#ref='xl:title']" results in empty target node
line 6 of titleElementAttributeFixer.xjb
Suggestions to get it working?
EDIT: as helderdarocha suggested, my expression was wrong. I am new to XML and XPath, and it was a bit confusing since the element does not have the "xs:" namespace typed excplicitly. After I fixed that error, I got another one:
[ERROR] XPath evaluation of "//xs:element[#ref='xl:title']" results in too many (3) target nodes
As all the "ref" attributes need to be updated, I put the tag "multiple='true'" in the binding. Now I am getting the following error, and cannot figure out how to solve it:
[ERROR] cvc-complex-type.3.2.2: Attribute 'ref' is not allowed to appear in element 'jxb:property'.
Ideas for this? I do want to bind the contents in the attribute 'ref' for the element in question to another name.
I solved the problem after all by applying these SO questions:
JAXB fails to generate Java classes for XBRL
JAXB XJC Two declarations cause a collision. Customized binding cannot be honored
So after I solved the original problem, I had additional problems with objectfactory collisions, which I fixed as well. This is how my working bindings.xjb looks in general:
<bindings xmlns="http://java.sun.com/xml/ns/jaxb"
xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
version="2.1">
<bindings schemaLocation="http://www.xbrl.org/2003/xl-2003-12-31.xsd"
node="//xsd:schema//xsd:element[#name='title']">
<property name="xlTitle"/>
</bindings>
<bindings schemaLocation="<local_dimension_file_D002>.xsd"
node="//xsd:schema//xsd:element[#name='AcceleratedDepreciation']">
<factoryMethod name="AcceleratedDepreciationD002"/>
</bindings>
...many more objectfactory collisions solved...
</bindings>
I hope this helps other XBRL/XML/JAXB newcomers to get started.
Your XPath expression is incorrect. Your bindings XML declares an xs prefix to qualify all XML Schema elements, but your XPath expression tries to find an element element from no-namespace since it's not qualified.
You should use:
<jxb:bindings node="//xs:element[#ref='xl:title']">
<jxb:property ref="xl:titleElement"/>
</jxb:bindings>

Adding a VersionOne expression using the REST API

I am trying to create a new 'Expression' in VersionOne - effectively adding a new 'comment' to a conversation.
In theory, the rest-1.v1/Data API should allow this, but I can't figure out how to do it - there is precious little documentation about using the API (using POST) to create objects.
FWIW, here's what I'm doing (after successfully accessing the server with valid credentials):
URL:
/rest-1.v1/Data/Expression
XML:
<Asset href="<Server Base URI>/rest-1.v1/Data/Expression">
<Attribute name="AssetType">Expression</Attribute>
<Relation name="InReplyTo" />
<Attribute name="AuthoredAt">2014-05-28T21:48:37.940</Attribute>
<Attribute name="Content">A new comment</Attribute>
<Attribute name="AssetState">64</Attribute>
<Relation name="Author">
<Asset href="<Server Base URI>/rest-1.v1/Data/Member/2015" idref="Member:2015" />
</Relation>
<Relation name="BelongsTo">
<Asset href="<Server Base URI>/rest-1.v1/Data/Conversation/2018" idref="Conversation:2018" />
</Relation>
<Attribute name="Author.Name">user#example.com</Attribute>
<Attribute name="Author.Nickname">User Name</Attribute>
<Relation name="Mentions">
<Asset href="<Server Base URI>/rest-1.v1/Data/Story/2017" idref="Story:2017" />
</Relation>
</Asset>
I keep getting a 400 Bad Request the following error:
<Error href="<Server Base URI>/rest-1.v1/Data/Expression">
<Message>Violation'Required'AttributeDefinition'Content'Expression</Message>
<Exception class="VersionOne.DataException">
<Message>Violation'Required'AttributeDefinition'Content'Expression</Message>
</Exception>
</Error>
I assume I'm missing something obvious - does anyone know what it is?
IF you examine the metadata for a VersionOne Expression, you will see 3 required fields (Author,AuthoredAt,Content). Logically this makes sense to be able to just create a single, zombie expression but I witnessed otherwise. This might be a mistake in the stylesheet or just my browser because it seems POSTing with only those three will return a 400 error. To get a guaranteed working payload, include the relation "inReplyTo" and that is all that you will need to create an expression within the context of a particular Conversation.
Given that you are responding to an existing expression (comment) This should work fine.
POST to rest-1.v1/Data/Expression
<Asset>
<Relation name="Author" act="set">
<Asset idref="Member:2015" />
</Relation>
<Attribute name="AuthoredAt">2014-05-02T21:48:37.940</Attribute>
<Attribute name="Content" act="set">A new comment</Attribute>
<Relation name="InReplyTo" act="set">
<Asset idref="Expression:xxxxx" />
</Relation>
</Asset>
You don't need Asset state or mentions or belongs to. AssetState is readonly, and BelongsTo is filled in automatically after your Expression is created. It inherits a reference to the containing Conversation from the Expression object entered in the InReplyTo field and the Mentions relation is optional.
FYI,
I believe that you didn't see the Legend on the right hand side of a the meta query output as seen in a browser. Real quick here, when you do a meta query, the items with * are required to Post, Bold items are Read/Write optional, the italicized items are readonly, and the bold items towards the bottom that are appended with ": operation" is the operation that you are allow to do against that particular asset.

Xforms checkbox - replacing True / False with Y / N

I am writing a form (betterFORMs/Xforms) to be displayed to the user with a selection of checkboxes.
If a checkbox is empty the form should bind an "N" into the element. When ticked, a "Y".
I realise there are answers to this question already but I have tried all answered solutions with no luck.
The first solution I attempted to use is here - stackoverflow link
(the first solution looks good, but I have had more success with solution 2 as I am not using Orbeon)
The answer given is what I am looking for, but I am having trouble implementing this into my form. I am not using Xhtml or Orbeon and so the binding I use seems to be different to that used in the solution.) I have tried tweaking this code to fit into my form but I get a repetitive error from the xml parser every time I load the page - but it doesn't point me to anywhere related to the new code.
The next solution I have tried is found here - stackoverflow link
This answer has had the best results in my code because the checkbox values change to N when not used and when they are deselected. The problem I have with this solution is that the Y set in the form element is contained in braces - [].
output example:
<addressProof>N</addressProof><other>[Y]</other><otherText>_text_</otherText>
Here is a snippet of my form:
model:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns="http://www.w3.org/2002/06/xhtml2" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
<xsl:output method="xml" />
<xsl:template match="/">
<xforms:model id="documentsChecklist">
<xforms:instance>
<actionform xmlns="">
<xforms:model id="documentsChecklist">
<xforms:instance>
<actionform xmlns="">
<detail>
<other></other>
<otherText></otherText>
</detail>
</actionform>
</xforms:instance>
<xforms:bind id="other" nodeset="/actionform/detail/other" calculate="choose(. = 'Y', ., 'N')"/>
<xforms:bind nodeset="/actionform/detail/otherBox" relevant="/actionform/detail/other ='Y'" />
</xforms:model>
form:
<div id="formBody"><br />
<xforms:select bind="other" appearance="full" align="right">
<xforms:item>
<xforms:label>Other</xforms:label>
<xforms:value>Y</xforms:value>
</xforms:item>
</xforms:select>
<xforms:input ref="/actionform/detail/otherText">
<xforms:label>Please specify:*</xforms:label>
</xforms:input>
</div>
</xsl:template>
</xsl:stylesheet>
Why does the checkbox value now get set to "[Y]" instead of "Y"? (Could it be something to do with an Array?) Thanks.
PS. I know I could do this using a boolean for each checkbox, with the checkbox value corresponding to the boolean, which in turn updates the bind value. I would rather not have to have a big block of boolean elements and binds as I have a large amount of check boxes. this solution has an example here - stackoverflow link
A select control allows you to select more than one item and I wonder if it is why the XForms implementation you are using is adding square brackets (according to specifications selected values have to be separated by a space character, which is not always very convenient by the way).
I am afraid that XForms 1.1 and XForms 2.0 require to use extra intermediate nodes and bindings. It would be useful to be able to add 2 XPath expressions for bindings: one to convert node value to control value and the other one back from control value to node value.
As a workaround, I use another extension in XSLTForms: XSLT stylesheets for converting instances.
-Alain

Unable to Add/Modify Mobile Phone field using IPP against QuickBooks desktop

I can't seem to modify or add the Mobile phone field in QuickBooks for QB Desktop. Online works fine, no dice in desktop but according to the XML response of the MOD request it seems to be working fine.
It shows the field being created/modified (idDomain is created, id value generated) however SyncManager never pushes the changes to QuickBooks.
I can modify the Mobile value on the QB side and I'll be able to see that change in my IPP application but no go when heading the other direction.
Here's the XML traces:
http://pastebin.com/qprwAh9z
Any ideas?
I was able to replicate this. The mobile phone number does not sync to the QB desktop file.Seems like a bug.
Please submit a support ticket here:
Link - http://developer.intuit.com/Support/Incident
It looks like, the problem is when you use 'Mobile' in the Phone's 'Tag' field.
Instead of 'Mobile', I tried 'Home' in the Tag field. As an alternate solution you can try the following (I will take a look if there is any constraint in the intermediate QBXML/QBSDK side )
IDS Req
<?xml version="1.0" encoding="UTF-8"?>
<Add xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" RequestId="22f39648c5ab1111988854e808163dc9" xmlns="http://www.intuit.com/sb/cdm/v2">
<ExternalRealmId>657117515</ExternalRealmId>
<Object xsi:type="Customer">
<TypeOf>Person</TypeOf>
<Name>SampleCust-IDS12</Name>
<Address>
...
</Address>
<Address>
...
</Address>
<Phone>
<DeviceType>LandLine</DeviceType>
<FreeFormNumber>0123456789</FreeFormNumber>
<Default>1</Default>
<Tag>Business</Tag>
</Phone>
<Phone>
<DeviceType>LandLine</DeviceType>
<FreeFormNumber>1234567890</FreeFormNumber>
<Default>0</Default>
<Tag>Home</Tag>
</Phone>
...
</Object>
</Add>
Create Response
<RestResponse xmlns="http://www.intuit.com/sb/cdm/v2">
<Success RequestId="22f39648c5ab1111988854e808163dc9">
<PartyRoleRef>
<Id idDomain="NG">1221097</Id>
<SyncToken>1</SyncToken>
<LastUpdatedTime>2013-07-19T11:25:43Z</LastUpdatedTime>
<PartyReferenceId idDomain="NG">1261065</PartyReferenceId>
</PartyRoleRef>
<RequestName>CustomerAdd</RequestName>
<ProcessedTime>2013-07-19T11:25:43Z</ProcessedTime>
</Success>
</RestResponse>
QBXML [ 2nd phone no is coming under AltPhone tag ]
<?qbxml version="9.0" ?>
<QBXML>
<QBXMLMsgsRq onError="continueOnError" newMessageSetID="13ff6ae6e2c76b59e49">
<CustomerAddRq requestID="EsbKeyMapHeader:1221097:0">
<CustomerAdd>
<Name>SampleCust-IDS12</Name>
..
<BillAddress>
...
</BillAddress>
<ShipAddress>
...
</ShipAddress>
<PrintAs>SampleCust</PrintAs>
<Phone>0123456789</Phone>
<AltPhone>1234567890</AltPhone>
<Fax></Fax>
..
</CustomerAddRq>
</QBXMLMsgsRq>
</QBXML>
QB's view [ There is no specific field for Mobile. Mobile/LandLine is kindOf Metadata. I'll check and confirm this behaviour ]
Thanks

Does Castle Windsor allow the resolution of value types?

I'm trying to pass a parameter into a component that requires a System.TimeSpan. I'm only able to get the 'long ticks' ctor to resolve.
Here's a snippet of the config file:
<component id="timeInForce" type="System.TimeSpan, mscorlib">
<parameters>
<hours>0</hours>
<minutes>15</minutes>
<seconds>0</seconds>
</parameters>
</component>
<component id="FooSettings" type="Foo.FooSettings, Foo">
<parameters>
<tif>${timeInForce}</tif>
</parameters>
</component>
This is the exception:
Castle.MicroKernel.Handlers.HandlerException : Cant create component 'timeInForce'
as it has dependencies to be satisfied.
timeInForce is waiting for the following dependencies:
Keys (components with specific keys)
- ticks which was not registered.
Passing a tick value for the component parameter works, as in:
<parameters><tif>0</tif></parameters>
but this defeats the purpose.
What's happening (from what I can see) is that the ticks property is being incorrectly identified as a compulsory parameter (because it belongs to the constructor with the least number of arguments) even though all value types have a default parameter-less constructor.
However the constructor candidate matching the most parameters will still be selected even if you supply additional parameters (i.e. ticks) so you can work around this by just including ticks in the list of parameters:
<component id="timeInForce"" type="System.TimeSpan, mscorlib">
<parameters>
<ticks>0</ticks>
<hours>0</hours>
<minutes>15</minutes>
<seconds>0</seconds>
</parameters>
</component>
Here is a quick test to verify it works (which passes for against the castle trunk):
string xml = #"<?xml version=""1.0"" encoding=""utf-8"" ?>
<castle>
<components>
<component id=""timeInForce"" type=""System.TimeSpan, mscorlib"">
<parameters>
<ticks>0</ticks>
<hours>0</hours>
<minutes>15</minutes>
<seconds>0</seconds>
</parameters>
</component>
</components>
</castle>";
WindsorContainer container = new WindsorContainer(
new XmlInterpreter(new StaticContentResource(xml)));
TimeSpan span = container.Resolve<TimeSpan>("timeInForce");
Assert.AreEqual(new TimeSpan(0, 15, 0), span);
However, what I would suggest rather then the approach your using is to implement your own type converter, as discussed in the castle documentation.
That way you could develop your own shorthand form for a timespan i.e. "15m" or "2h15m" or whatever takes your fancy - making your config a little easier to read and maintain and working round the issues you're currently experiencing.