[Servingxml-help] (no subject)
Brought to you by:
danielaparker
From: Akhil S. S. <ak...@ma...> - 2006-02-02 13:01:10
|
Hi=0D=0A=0D=0AI am having a problem with the CVS to XML transformation. The= ServingXml=0D=0Acomponent is embedded inside a JBI container called Servic= eMix. On=0D=0Areceiving a string=0D=0A=0D=0AIt tries to convert it into xml= =2E While no error is throw, the=0D=0Atransformation is not happening eithe= r.=0D=0A=0D=0AThe code snippet=20=0D=0A=0D=0A=20=0D=0A=0D=0AServingXMLTrans= former.java=0D=0A=0D=0A=20=0D=0A=0D=0A public Source toSource(St= ring text)=0D=0A=0D=0A {=0D=0A=0D=0A Sour= ce source =3D null;=0D=0A=0D=0A try=0D=0A=0D=0A = {=0D=0A=0D=0A AppCont= ext appContext =3D new=0D=0ADefaultAppContext(APPLICATION_NAME,=20=0D=0A=0D= =0A=20=0D=0Adriver.getResources(), driver.getNameTable());=0D=0A=0D=0A = ServiceContext serviceContext =3D new=0D=0AD= efaultServiceContext(appContext, "servingxml");=0D=0A=0D=0A = =20=0D=0A=0D=0A Name = serviceName =3D=0D=0AName.parse(serviceContext, SERVICE_SOURCE_NAME);=0D=0A=0D= =0A =20=0D=0A=0D=0A = StreamSource defaultStreamSource =3D=0D=0Anew StringStreamSou= rce(text);=0D=0A=0D=0A ByteArrayOutputSt= ream boss =3D new=0D=0AByteArrayOutputStream();=0D=0A=0D=0A = StreamSink defaultStreamSink =3D new=0D=0AOutputStreamS= inkAdaptor(boss);=0D=0A=0D=0A =20=0D=0A=0D= =0A Flow flow =3D new=0D=0AFlowImpl(def= aultStreamSource, defaultStreamSink);=0D=0A=0D=0A = =20=0D=0A=0D=0A RecordBuilder r= ecordBuilder =3D new=0D=0ARecordBuilder(SystemConstants.PARAMETERS_TYPE_NAM= E);=0D=0A=0D=0A // Add some parameters,= if any =20=0D=0A=0D=0A Record parameter= s =3D=0D=0ArecordBuilder.toRecord();=0D=0A=0D=0A = =20=0D=0A=0D=0A Service service = =3D=0D=0A(Service)appContext.getResources().lookupServiceComponent(Service.= class,=0D=0AserviceName);=0D=0A=0D=0A if= (service =3D=3D null) {=0D=0A=0D=0A = throw new=0D=0AServingXmlException("Cannot find service " + servic= eName);=0D=0A=0D=0A }=0D=0A=0D=0A = service.execute(serviceContext,=0D=0Aparameter= s, flow);=0D=0A=0D=0A =20=0D=0A=0D=0A = boss.flush();=0D=0A=0D=0A = source =3D new=0D=0ABytesSource(boss.toByteArray());=0D=0A=0D= =0A }catch(ServingXmlException sxe)=0D=0A=0D=0A = {=0D=0A=0D=0A sxe.pri= ntStackTrace();=0D=0A=0D=0A }=0D=0A=0D=0A = catch(IOException ioe)=0D=0A=0D=0A {=0D= =0A=0D=0A ioe.printStackTrace();=0D=0A=0D= =0A }=0D=0A=0D=0A =20=0D=0A=0D= =0A return source;=0D=0A=0D=0A }=0D=0A=0D= =0A=20=0D=0A=0D=0AIs supposed to turn "b,amzn,Amazon,10" into xml, while th= e transform=0D=0Aworks if I point it to a file source, when I use this xml = config,=0D=0Anothing happens=0D=0A=0D=0A=20=0D=0A=0D=0A <sx:service id=3D"= orderstoxml">=0D=0A=0D=0A <sx:serialize>=0D=0A=0D=0A <sx:transform>=0D= =0A=0D=0A <sx:content ref=3D"orders"/>=20=0D=0A=0D=0A </sx:tran= sform>=0D=0A=0D=0A </sx:serialize>=0D=0A=0D=0A </sx:service>=0D=0A=0D=0A= =20=0D=0A=0D=0A <sx:recordContent id=3D"orders">=0D=0A=0D=0A <sx:flatFi= leReader>=0D=0A=0D=0A <sx:stringSource />=0D=0A=0D=0A <!-- <sx:ur= lSource url=3D"orders.csv"/> -->=0D=0A=0D=0A <sx:flatFile ref=3D"order= sFlatFile"/>=0D=0A=0D=0A <!--<msv:msvRecordFilter schema=3D"order-reco= rd.xsd"/>-->=0D=0A=0D=0A </sx:flatFileReader>=0D=0A=0D=0A <sx:recordM= apping ref=3D"ordersToXmlMapping"/>=0D=0A=0D=0A </sx:recordContent>=0D=0A=0D= =0A =20=0D=0A=0D=0A <sx:flatFile id=3D"ordersFlatFile">=0D=0A=0D=0A <sx= :commentSymbol value=3D"#"/>=0D=0A=0D=0A <sx:flatFileBody>=0D=0A=0D=0A = <sx:flatRecordType id=3D"order">=0D=0A=0D=0A <sx:fieldDelimite= r value=3D","/>=0D=0A=0D=0A <sx:delimitedField name=3D"ordertype-f= ield" label=3D"OrderType"/>=0D=0A=0D=0A <sx:delimitedField name=3D"com= panyticker-field"=0D=0Alabel=3D"CompanyTicker"/>=0D=0A=0D=0A <sx:d= elimitedField name=3D"companyname-field"=0D=0Alabel=3D"CompanyName"/>=0D=0A=0D= =0A <sx:delimitedField name=3D"quantity-field" label=3D"Quantity"/= >=0D=0A=0D=0A </sx:flatRecordType>=0D=0A=0D=0A </sx:flatFileBody>=0D= =0A=0D=0A </sx:flatFile> =20=0D=0A=0D=0A=20=0D=0A=0D=0A <sx:recordMap= ping id=3D"ordersToXmlMapping">=0D=0A=0D=0A <orders>=0D=0A=0D=0A <s= x:onRecord>=0D=0A=0D=0A <order>=0D=0A=0D=0A <sx:fieldElemen= tMap field=3D"ordertype-field"=0D=0Aelement=3D"ordertype"/> =20=0D=0A=0D=0A= <sx:fieldElementMap field=3D"companyticker-field"=0D=0Aelement=3D= "companyticker"/> =20=0D=0A=0D=0A <sx:fieldElementMap fiel= d=3D"companyname-field"=0D=0Aelement=3D"companyname"/> =20=0D=0A=0D=0A = <sx:fieldElementMap field=3D"quantity-field"=0D=0Aelement=3D"quantity"= /> =20=0D=0A=0D=0A </order> =20=0D=0A=0D=0A </sx:onReco= rd>=0D=0A=0D=0A </orders>=0D=0A=0D=0A </sx:recordMapping>=20=0D=0A=0D=0A= =20=0D=0A=0D=0AAppreciate any pointer on what might be the problem.=0D=0A=0D= =0A=20=0D=0A=0D=0AThanks=20=0D=0A=0D=0AAkhil Srinivasan=0D=0A=0D=0A=20=0D=0A=0D= =0A=20=0D=0A=0D=0A =20=0D=0A=0D=0AMASTEK=20=0D=0A"Making a valuab= le difference"=0D=0AMastek in NASSCOM's 'India Top 20' Software Service Exp= orters List.=0D=0AIn the US, we're called MAJESCOMASTEK=0D=0A=0D=0A~~~~~~~~= ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~~~~~~~~~~~~~~~~~~~~~~~~~~=0D=0AOpinions expressed in this e-mail are thos= e of the individual and not that of Mastek Limited, unless specifically ind= icated to that effect. Mastek Limited does not accept any responsibility or= liability for it. This e-mail and attachments (if any) transmitted with it= are confidential and/or privileged and solely for the use of the intended = person or entity to which it is addressed. Any review, re-transmission, dis= semination or other use of or taking of any action in reliance upon this in= formation by persons or entities other than the intended recipient is prohi= bited. This e-mail and its attachments have been scanned for the presence o= f computer viruses. It is the responsibility of the recipient to run the vi= rus check on e-mails and attachments before opening them. If you have recei= ved this e-mail in error, kindly delete this e-mail from all computers.=0D=0A= ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=0D=0A |