error printing report <traceback object at 0x06F19DC8>)? - python-2.7

I want to print a report. I have a module named partnership is under the addons folder. and under the partnership folder I carry the folder that contains new_report.rml new_report.sxw and new_report.py class containing this code:
import time
from openerp.report import report_sxw
class new_report(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(new_report, self).__init__(cr, uid, name, context=context)
self.localcontext.update( {'time': time,})
report_sxw.report_sxw('report.new.report', 'contratcommercial',
'addons/partnership/report/new_report.rml',
parser=new_report)
under addons / partnership partnership I report.xml containing this code:
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<report
auto="False"
id="new_report_id"
model="contratcommercial"
name="commercial_report"
rml="partnership/report/new_report.rml"
string="imprimer contrat "/>
</data>
</openerp>
but I still have this error
report.commercial_report (<type 'exceptions.KeyError'>, KeyError(u'report.commercial_report',), <traceback objectat 0x06F19DC8>)

Your report id is given wrong.name attribute of <report> tag is same as in .py side. Just put ahead report for example report.name.value
Try this code.
in .py side
report_sxw.report_sxw('report.commercial.report', 'contratcommercial',
'addons/partnership/report/new_report.rml',
parser=new_report)
in .xml side
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<report
auto="False"
id="new_report_id"
model="contratcommercial"
name="commercial.report"
rml="partnership/report/new_report.rml"
string="imprimer contrat "/>
</data>
</openerp>
Hope this will solve your problem.

Related

schema validation error with spyne and soappy

I'm using Spyne to create simple webservie, and when i call that sample service i get following error :
faultType: <Fault senv:Client.SchemaValidationError: :10:0:ERROR:SCHEMASV:SCHEMAV_CVC_ELT_1: Element 'testMethod': No matching global declaration available for the validation root.>
************************************************************************
*** Outgoing SOAP ******************************************************
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/1999/XMLSchema"
>
<SOAP-ENV:Body>
<testMethod SOAP-ENC:root="1">
<name xsi:type="xsd:string">john</name>
</testMethod>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
*** Incoming SOAP ******************************************************
<?xml version='1.0' encoding='UTF-8'?>
<senv:Envelope xmlns:senv="http://schemas.xmlsoap.org/soap/envelope /"><senv:Body><senv:Fault> <faultcode>senv:Client.SchemaValidationError</faultcode> <faultstring>:10:0:ERROR:SCHEMASV:SCHEMAV_CVC_ELT_1: Element 'testMethod': No matching global declaration available for the validation root.</faultstring><faultactor></faultactor></senv:Fault></senv:Body></senv:Envelope>
SERVICE
views.py
class ServiceWsTest(ServiceBase):
__namespace__ = "appname"
#rpc(Unicode, _returns=Unicode)
def testMethod(self, name):
return "Hello {}" .format(name)
ws_test = csrf_exempt(DjangoApplication(Application([ServiceWsTest],
'appname',
in_protocol=Soap11(validator='lxml'),
out_protocol=Soap11(cleanup_namespaces=True),
#interface=Wsdl11(),
)))
urls.py
url(r'^sample/service', DjangoView.as_view(
services=[ServiceWsTest], tns='appname',
in_protocol=Soap11(validator='lxml'),
out_protocol=Soap11(cleanup_namespaces=True))),
Service call using soappy
from SOAPpy import WSDL, SOAPProxy
server = SOAPProxy('http://IP ADDRESS/sandbox/sample/service/')
server.testMethod('john')
If I use suds, everything is working fine.
client = suds.client.Client("http://IP ADDRESS/sandbox/sample/service.wsdl", cache=None)
client.service.testMethod('jane')
Hello jane
Please advise
Soappy's request has two issues:
It's not using the correct namespace. testMethod tag must be in "appname" namespace. As there's no null namespace declaration (xmlns="appname") in the document, the actual namespace of the tag is undefined.
It's using rpc encoding style (there are xsi:type attributes), whereas in the WSDL generated by Spyne, it explicitly says to use document encoding.
Don't use soappy, just use suds. To my knowledge, soappy hasn't been maintained for years.

How do I search property value of some type in XML file and write them to a text file in C++

I have 200 xml files. each one consists of pathways (something like network information). each pathway consists of entities with some attributes. I would like to ask how I can creat a text file for each xml file that contain the only name attributes for all the entities inside this xml file. I have the xml files in this format:
<?xml version="1.0" ?>
<!DOCTYPE pathway (View Source for full doctype...)>
- <!-- Creation date: Oct 7, 2014 11:01:31 +0900 (GMT+09:00) -->
- <pathway name="path:gmx00010" org="gmx" number="00010" title="Glycolysis / Gluconeogenesis">
- <entry id="13" name="gmx:100527532 gmx:100775844 gmx:100778363 gmx:100786504 gmx:100792394
gmx:100795446 gmx:100798677 gmx:100802732 gmx:100815070 gmx:100818383 gmx:100818915 gmx:547751"
type="gene" >
</entry>
- <entry id="37" name="gmx:100777399 gmx:100778722 gmx:100782019 gmx:100783726 gmx:100784210
gmx:100786773 gmx:100798020 gmx:100798892 gmx:100800699 gmx:100803104 gmx:100808513
gmx:100809812 gmx:100811186 gmx:100811501 gmx:100811891 gmx:100816594 gmx:100817701
gmx:100819197 gmx:547717" type="gene">
</entry>
- <entry id="38" name="ko:K01905" type="ortholog">
</entry>
- <entry id="39" name="ko:K00129" type="ortholog">
</entry>
I want to write a program in visual C++ to create a text file with the same title as the xml file and this text file contains the name attribute values (ex: gmx:100527532 gmx:100775844 gmx:100778363 gmx:100786504 gmx:100792394 gmx:100795446 gmx:100798677 gmx:100802732 gmx:100815070 gmx:100818383 gmx:100818915 gmx:547751) for all the entities of type="gene" and ignore any entity with other types.
Thanks.

apigee policy error - java.lang.String cannot be cast to com.apigee.flow.message.Message

I am trying to transform a JSON response from a target end point into soap message. I have 2 policies in the post flow.
JSONTOXML - If I disable xsltransform I see the xml result so this work.
xsltransform - this just point to my xsltransform file which has the template and dynamic content supposed to come from the xml from step 1.
Both source and output are set to "response" but it looks like it failed to cast in step 2. What should I make step 2 to pick up the xml and apply the xsl? How else can I do this? Thanks
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<JSONToXML async="false" continueOnError="false" enabled="true" name="jsontoxml-2">
<DisplayName>JSONtoXML-2</DisplayName>
<FaultRules/>
<Properties/>
<Options>
<NullValue>NULL</NullValue>
<NamespaceBlockName>#namespaces</NamespaceBlockName>
<DefaultNamespaceNodeName>$default</DefaultNamespaceNodeName>
<NamespaceSeparator>:</NamespaceSeparator>
<TextNodeName>#text</TextNodeName>
<AttributeBlockName>#attrs</AttributeBlockName>
<AttributePrefix>#</AttributePrefix>
<InvalidCharsReplacement>_</InvalidCharsReplacement>
<ObjectRootElementName>Root</ObjectRootElementName>
<ArrayRootElementName>Array</ArrayRootElementName>
<ArrayItemElementName>Item</ArrayItemElementName>
</Options>
<OutputVariable>response</OutputVariable>
<Source>response</Source>
</JSONToXML>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<XSL async="false" continueOnError="false" enabled="true" name="xsltransform-1">
<DisplayName>XSLTransform-1</DisplayName>
<FaultRules/>
<Properties/>
<Source>response</Source>
<ResourceURL>xsl://xsltransform-1</ResourceURL>
<Parameters ignoreUnresolvedVariables="true"/>
<OutputVariable>response</OutputVariable>
</XSL>
OutputVariable cannot be set to 'response'.
Try removing the 'OutputVariable' line, or leaving it empty. Removing it, should cause the output to go to the response payload.
In other words, try this:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<XSL async="false" continueOnError="false" enabled="true" name="xsltransform-1">
<DisplayName>XSLTransform-1</DisplayName>
<FaultRules/>
<Properties/>
<Source>response</Source>
<ResourceURL>xsl://xsltransform-1</ResourceURL>
<Parameters ignoreUnresolvedVariables="true"/>
</XSL>
Is this always the case? Can OutputVariable never be set on response?

How to create news ticker XML file in Joomla?

I got this extensions and all I want to know is how I am able to get the news ticker from XML file and how should I create this file?
I tried this one and it is not working.
XML file
http://www.4shared.com/document/uNJ9sdmD/newsxml.html
Extension link
http://extensions.joomla.org/extensions/news-display/articles-display/news-tickers-a-scrollers/6633?qh=YToxMDp7aTowO3M6NDoibmV3cyI7aToxO3M6MzoibmV3IjtpOjI7czo3OiJuZXduZXNzIjtpOjM7czo1OiInbmV3cyI7aTo0O3M6NToibmV3J3MiO2k6NTtzOjY6Im5ld2VseSI7aTo2O3M6NToibmV3cyciO2k6NztzOjY6Im5ld3MnLCI7aTo4O3M6NjoiJ25ldycsIjtpOjk7czo2OiInbmV3cyciO30%3D
First create the XML file and insert it in the correct directory
/modules/mod_highlighter_gk4/xml --> this is where you need to insert the file.
You can find a sample XML file named Sample on that folder which tells you exactly how to format you XML file. It's something like this:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<highlighter>
<item>
<title>Title 1</title>
<desc>Item description 1</desc>
<link>http://item1.title.com</link>
</item>
<item>
<title>Title 1</title>
<desc>Item description 1</desc>
<link>http://item1.title.com</link>
</item>
On the module itself first make sure you select the XML file on the "data source".
Then on the XML File option put the name of the XML File you created and it should work.
You can find more info from their website as well.
http://www.gavick.com/forums/highlighter.html

Removing specific element from xml using sax with xerces library in c++

My problem is that I want to remove lastfiles and all it's child element using sax with the API of Xerces in c++ language??
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE config>
<config datecreated="20011210">
<user>
John Smith
</user>
<login>jsmith</login>
<password>topsecret</password>
<lastfiles>
<lastfile timestamp="20011210T1002">accounts.txt</lastfile>
<lastfile timestamp="20011190T1132">/home/jsmith/docs/letter.doc</lastfile>
</lastfiles>
</config>