Missing TxnLineID for LineGroup in SalesReceiptAdd - qbxml

Working with examples I found I was able to add a SalesReceipt via QB WebConnector using QBXML. Specifically I was adding a LineGroup (SalesReceiptLineGroupAdd) - and after adding that group I need to modify it.
Well to modify it I need the TxnLineID of the LineGroup. It did not appear in my results - although the add and response were successes. Roughly here is the outline of the request:
<?qbxml version="2.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<SalesReceiptAddRq requestID="22">
<SalesReceiptAdd>
... customer, billing, etc...
<SalesReceiptLineGroupAdd>
<ItemGroupRef>
<FullName>2604-1</FullName>
</ItemGroupRef>
<Quantity>1</Quantity>
</SalesReceiptLineGroupAdd>
</SalesReceiptAdd>
</SalesReceiptAddRq>
</QBXMLMsgsRq>
</QBXML>
And in the response:
<SalesReceiptLineGroupRet>
<ItemGroupRef>
<ListID>800002A9-1389300902</ListID>
<FullName>2604-1</FullName>
</ItemGroupRef>
<Desc>test group 1</Desc>
<Quantity>1</Quantity>
... etc ...
but I expected
<SalesReceiptLineGroupRet>
<TxnLineID>619-1394725756</TxnLineID>
<ItemGroupRef>
<ListID>800002A9-1389300902</ListID>
<FullName>2604-1</FullName>
</ItemGroupRef>
<Desc>test group 1</Desc>
<Quantity>1</Quantity>
... etc ...
Based on the documentation. What is wrong?

Your problem is that the examples you copied from are way out of date. Switch to a newer version of qmxl. This worked for me:
<?qbxml version="13.0"?>

Related

OrientDB: How to return plugins results?

I have create a java-function that return the full path between two OElement but I do not found the correct way to return it results.
Actually it collect all the path in ArraList<ArrayList> but it is not shown in the Studio. I suppose that I should use something like OResultSet but I don't found anythig about its.
Example:
I implemented this: fullpath(from, to, maxDepth, conditions)
select fullPath(#58:0, #65:0)
n1,path_1,n2_1,path_1,n3_1,path_1,n4
n1,path_2,n2_3,path_1,n4
n1,path_1,n2_2,path_1,n3_2,path_1,n4
n1,path_1,n2_2,path_2,n3_3,path_1,n4_1,path_2,n3_2,path_1,n4
and I'am working on this:
select fullPath(n1, n4, 100, include(path_1))
n1,path_1,n2_1,path_1,n3_1,path_1,n4
n1,path_1,n2_2,path_1,n3_2,path_1,n4
The code is here: fullPath on github
Thanks.
I think the main problem here is that the result of the function is being returned as a single result, so Studio cannot manage it.
As a first attempt, I'd try to do a
SELECT expand(fullPath(...))
This will definitely work in the tabular view in Studio, but it will still not display in the GRAPH view.
For the GRAPH view, my suggestion is to put all the RIDs in a single ArrayList and then do the expand()
With ArraList<ArrayList> did not work, but an ArrayList<OIdentifiable[ ] > did the job.

Grails mail plugin runtime configuration

Using grails mail plugin 1.0.7.
https://jira.grails.org/browse/GPMAIL-36 states that it's possible to change plguin configuration since 1.0.1 at runtime. Sadly it does not explains how to achieve it.
I want to be able to change the username at runtime to be able to use different mail accounts.
Thanks.
Based on this code, you should be able to change the configuration at runtime and the mail plugin will automagically re-deploy and update mail sender based on your changes.
Example:
Holders.config.grails.mail.username = 'foo'
Holders.config.grails.mail.password = 'bar'
sendMail {
to "foo#bar.com"
from "bar#foo.com"
subject "Hi"
body "This is an email"
}
Update:
It would appear that changing the configuration in this manner does not, in fact, fire the onConfigChange event. Per this, you can fire the event manually. Something like this:
Holders.pluginManager.getGrailsPlugin('mail').notifyOfEvent(GrailsPlugin.EVENT_ON_CONFIG_CHANGE, Holders.config)
I've realized this can be done accessing the mailSender bean from the context and updating it like is explained here
Changing mail configuration in runtime
However if #rmlan solution finally works it may be a much cleaner solution.
Actually thr rmlan solution works with the following fix. Since the onConfigChange compares hashCode of existing config map and new one, so if you set new configs in original configuration (Holders.config.grails.mail), then both configs are same and it never pass the condition to apply new changes, so a new structure should be created and pass it to notifyOfEvent method to mark the change as different hashCodes.
def mailConfig = [ grails: [ mail: [:] ] ]
mailConfig.grails.mail.host = newHost
mailConfig.grails.mail.port = newPort
Holders.pluginManager.getGrailsPlugin('mail').
notifyOfEvent(GrailsPlugin.EVENT_ON_CONFIG_CHANGE, mailConfig)
Still using async-mail and this one make the below exception
No qualifying bean of type [grails.plugin.mail.MailService] is defined: expected single matching bean but found 2: nonAsynchronousMailService,mailService
that is thrown because of the following part of onConfigChange
event.ctx.getBean(MailService.class).setPoolSize(mailConfig.poolSize?:null)
Commenting it let it works as a workaround, but making sendMail of mail plugin is called, not async-mail, so exception may raise if async-mail features is used on constructing mail. Hence to use async-mail in this workaround should use sendAsynchronousMail method.

apigee overwriting the target.url with a custom variable

I have been trying to overwrite the target.url with a variable using the Assign Message Policy. Per other solutions, I have put this in the "Target EndPoint" Section. The issue is, unless I hard-code the root section of the URL, the substitution fails. I have tried all the commented VALUE stmts below with and then started adding the "REF"stmts to attempt to solve the issue - to no avail. You can see I have tried cutting the target into various snippets using Extract policies, but cannot get a solution that works.
Thanks for help.
For the purposes of the code snippet below
entireURL = "http://my.root.url/thestuff/morestuff"
AppServerURL = "my.root.url/thestuff/morestuff"
AppServerRoot = "my.root.url"
AppServerSfx = "thestuff/morestuff"
codee from Assign Message Policy
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AssignMessage async="false" continueOnError="false" enabled="true" name="Post-to-named-serverL">
<DisplayName>Post to named server</DisplayName>
<FaultRules/>
<Properties/>
<AssignVariable>
<Name>target.url</Name>
<Value>http://${AppServerRoot}/{AppServerSfx}</Value>
<Ref/>
<!--
<Value>http://my.root.url/{AppServerSfx}</Value> works but I need the root changed
<Value>http://{AppServerRoot}/{AppServerSfx}</Value>
<Value>http://${AppServerRoot}/{AppServerSfx}</Value>
<Value>http://{AppServerURL}</Value>
<Value>http://${AppServerURL}</Value>
<Value>entireURL</Value>
<Value>{entireURL}</Value> -- this was my first try
<Value>${entireURL}</Value>
<Ref>entireURL</Ref>
<Ref>{entireURL}</Ref>
<Ref>${entireURL}</Ref>
-->
</AssignVariable>
<IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
<AssignTo createNew="false" transport="http" type="request"/>
</AssignMessage>
You are correctly putting the target.url manipulation in the Target Request flow.
Using AssignMessage/AssignVariable can be limiting. The Value element doesn't allow you to do any variable substitutions.
The following worked for me:
<Ref>entireURL</Ref>
Ref also doesn't allow variable substitutions -- it just takes the name of the variable. Since you have to build the value of that variable ahead of time, using the Ref example above doesn't buy you much.
I usually accomplish target URL rewriting using a JavaScript callout with code similar to the following:
var appServerRoot = context.getVariable("AppServerRoot");
var appServerSfx = context.getVariable("AppServerSfx");
context.setVariable("target.url", "http://" + appServerRoot + "/" + appServerSuffix);

Add model into an existing model RDF

I tried to merge 2 existing RDF/XML models. I tried different solutions:
model1.union(model2)
model1.add(model2) //adding a complete model
model1.add(model2.listStatements())
I'm using Jena in Java.
I removed enveloping tags (like Equipment) from the second model, but I always have the same problem: the resulting model is not really merged: it contains an envelopment for each added model. E.g., I have 2 documents, but different endpoints. They should be merged to have one document which contains all data:
bookid123 in endpointA
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:si="http://www.w3schools.com/rdf/">
<rdf:Description rdf:about="http://endpointA/bookid123">
<si:title>W3Schools.com</si:title>
</rdf:Description>
</rdf:RDF>
bookid123 in endpointB
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:si="http://www.w3schools.com/rdf/">
<rdf:Description rdf:about="http://endpointB/bookid123">
<si:author>Jan Egil Refsnes</si:author>
</rdf:Description>
</rdf:RDF>
As result, I something like this:
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:si="http://www.w3schools.com/rdf/">
<rdf:Description rdf:about="http://endpointA/bookid123">
<si:title>W3Schools.com</si:title>
</rdf:Description>
<rdf:Description rdf:about="http://endpointB/bookid123">
<si:author>Jan Egil Refsnes</si:author>
</rdf:Description>
</rdf:RDF>
but I need something like this:
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:si="http://www.w3schools.com/rdf/">
<rdf:Description rdf:about="http://couldbeanything/bookid123">
<si:title>W3Schools.com</si:title>
<si:author>Jan Egil Refsnes</si:author>
</rdf:Description>
</rdf:RDF>
Is there a smarter way than getting every statement of model1, adding them to model2, except statements which are different because of the source-uri?
In RDF, the identifiers are complete URI's and they are not considered part of any document you happen to find them in. So in your example,
http://endpointA/bookid123
http://endpointB/bookid123
are unique and independent names for things. So it is quite correct from an RDF perspective that merge will not combine triples with those subjects together.
In your case, you are wanting to assert that, by some means outside of the RDF model, you know that http://endpointA/bookid123 and http://endpointB/bookid123 are actually the same resource and that therefore statements about one can be considered to be also statements about the other.
There are two ways to handle this. Firstly, you could use OWL to express that the two resources denote the same individual (I'll use Turtle syntax for brevity, it doesn't change the meaning):
<http://endpointA/bookid123> owl:sameAs <http://endpointB/bookid123> .
In order for this to work, you'll need to use a model with an OWL reasoner (such as OWL_MEM_MICRO_RULE_INF) attached.
The second way is more brute force: for each two resources resource1 and resource2 that you want to merge, run a loop to copy the statements of one to also be statement of the other:
for (StmtIterator i = resource1.listStatements(); i.hasNext(); ) {
Statement s = i.next();
resource2.addProperty( s.getPredicate(), s.getObject() );
}

Entity Framework - Error while trying to call parametrized function

I've mapped some function that is being used as a wrapper for the one of the Oracle functions (I really need to call that Oracle function from my LINQ).
My mapping looks like (Storage Model):
<Function Name="RunTranslate" IsComposable="false" BuiltIn="false">
<CommandText>
SELECT Translate(#DataToTranslate using char_cs) AS ResultData FROM dual
</CommandText>
<Parameter Name="DataToTranslate" Type="char" Mode="In" />
</Function>
And:
<FunctionImport Name="OracleTranslate" ReturnType="Collection(String)">
<Parameter Name="DataToTranslate" Mode="In" Type="String" />
</FunctionImport>
I try to use it from the code this way:
using (var context = new TestEntities())
{
....
var result = from myData in context.OracleTranslate("test")
select myData; // Error ORA-00936!
....
}
I tried to use Entity Framework Profiler (EFProf) to see the query that is actually being sent to the DB. Intercepted query is the next:
SELECT Translate('test' /*#DataToTranslate*/ using char_cs) AS ResultData FROM dual
(looks fine)
But my application stops with the next error:
ORA-00936: missing expression
If I copy-paste the intercepted query into the VS2010's Server Explorer Query Window - it works! DB returns correct data to me!
So, where the problem can be? What is the difference between the code and the query window in my case? I thought they use the same provider, etc...
Thank you very much!
EDIT:
I've just used standard Inet-sniffer to check the real data that is being sent over the sockets and Internet when I run my query.
And it's not the same with the first one! It's exactly my source SQL query:
SELECT Translate(#DataToTranslate using char_cs) AS ResultData FROM dual
It seems, that parameter is not recognized, but why?
I've found a solution, I hope this info will help someone:
DataToTranslate parameter should be mapped with the colon symbol (":DataToTranslate"), not "#".
Another important experience (as to me): Entity Framework Profiler (EFProf) shows something that it wants, not the real data - much better to use TCP-sniffers like Wireshark to see that data.