thanks ! i see,I hope who can help me!!
Freeman Fang wrote: > > Hi, > > One basic rule is all message send to this mailling list should be in > English, so that more people can understand and help you. :-) > Cheers > > Freeman > > [email protected] wrote: >> 环境:servicemix3.3 + sun 的 JDBC组件 + file 组件 >> >> 我想实现的功能是:通过jdbc组件,写一个wsdl文件,读取数据库表person,把得到的记录生成一个xml文件,最后读取这个xml文件写入另 >> 一张表person_bak中,现在的情况是可以读取person记录,也可以生成一个xml文件,但是在读取xml文件写入到person_bak表 >> 中时,产生异常,数据不能写入。 >> >> >> wsdl文件如下: >> >> >> <?xml version="1.0" encoding="UTF-8"?> >> <definitions name="jdbc-example" >> xmlns="http://schemas.xmlsoap.org/wsdl/" >> xmlns:xsd="http://www.w3.org/2001/XMLSchema" >> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" >> xmlns:jdbc="http://schemas.sun.com/jbi/wsdl-extensions/jdbc/" >> xmlns:ns="http://j2ee.netbeans.org/xsd/tableSchema" >> xmlns:tns="http://www.njusoft.com/datachange/jdbc" >> targetNamespace="http://www.njusoft.com/datachange/jdbc"> >> >> <!--http://esbinaction.com/chapter6/jdbc--> >> <!-- import the types which represent the table in the database --> >> <types> >> <xsd:schema> >> <xsd:import namespace="http://j2ee.netbeans.org/xsd/tableSchema" >> schemaLocation="PERSON.xsd" /> >> </xsd:schema> >> </types> >> >> <!-- define the messages which are sent and returned from this >> service --> >> <message name="inputMsg"> >> <part name="part" element="ns:PERSON" /> >> </message> >> <message name="insertRetMsg"> >> <part name="part" type="xsd:int" /> >> </message> >> <message name="outputMsg"> >> <part name="part" element="ns:PERSON" /> >> </message> >> >> <!-- define the operations for the interfaces --> >> <portType name="jdbcInsertPortType"> >> <operation name="insert"> >> <input name="inputInsert" message="tns:inputMsg" /> >> <output name="outputInsert" message="tns:insertRetMsg" /> >> </operation> >> </portType> >> <portType name="jdbcPollerPortType"> >> <operation name="pollrecords"> >> <input name="inputPoll" message="tns:inputMsg" /> >> <output name="outputPoll" message="tns:outputMsg" /> >> </operation> >> </portType> >> >> <!-- define the binding/implementation for the interface definition >> --> >> <binding name="insertBinding" type="tns:jdbcInsertPortType"> >> <jdbc:binding /> >> <operation name="insert"> >> <jdbc:operation/> >> <input name="inputInsert"> >> <jdbc:input PKName="ID" TableName="PERSON_BAK" >> Transaction="NOTransaction" >> operationType="insert" paramOrder="id, name, processed" >> sql="INSERT into PERSON_BAK (id, name, processed) values >> (?,?,?)" /> >> </input> >> <output name="outputInsert"> >> <jdbc:output returnPartName="part" /> >> </output> >> </operation> >> </binding> >> >> <!-- define the binding/implementation for the interface definition -- >> >> <binding name="pollerBinding" type="tns:jdbcPollerPortType"> >> <jdbc:binding /> >> <operation name="pollrecords"> >> <jdbc:operation /> >> <input name="inputPoll"> >> <jdbc:input PKName="ID" PollMilliSeconds="5000" >> PollingPostProcessing="MarkColumn" >> MarkColumnName="PROCESSED" >> MarkColumnValue="2" TableName="PERSON" numberOfRecords="2" >> operationType="poll" Transaction="NOTransaction" >> sql="SELECT * FROM PERSON where processed = 0" /> >> </input> >> <output name="outputPoll"> >> <jdbc:output returnPartName="part" /> >> </output> >> </operation> >> </binding> >> >> <!-- define the service with two ports --> >> <service name="jdbc-service"> >> <port name="insertPort" binding="tns:insertBinding"> >> <jdbc:address jndiName="java:comp/env/jdbc/defaultDS" /> >> </port> >> <port name="pollerPort" binding="tns:pollerBinding"> >> <jdbc:address jndiName="java:comp/env/jdbc/defaultDS" /> >> </port> >> </service> >> </definitions> >> >> >> 这个是对表person的描述格式。 >> 相应的描述文件person.xsd如下: >> <?xml version="1.0" encoding="UTF-8"?> >> <xsd:schema elementFormDefault="qualified" targetNamespace="http:// >> j2ee.netbeans.org/xsd/tableSchema" xmlns="http://j2ee.netbeans.org/xsd/ >> tableSchema" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> >> <xsd:element name="PERSON" type="PERSON"></xsd:element> >> <xsd:complexType name="PERSON"> >> <xsd:sequence maxOccurs="unbounded"> >> <xsd:element name="ID" type="xsd:string"></xsd:element> >> <xsd:element name="NAME" type="xsd:string"></xsd:element> >> <xsd:element name="PROCESSED" type="xsd:boolean"></ >> xsd:element> >> </xsd:sequence> >> </xsd:complexType> >> </xsd:schema> >> >> >> 读取person表中记录,生成的xml文件servicemix-24532545.xml如下: >> <?xml version="1.0" encoding="UTF-8"?> >> <jbi:message xmlns:jbi="http://java.sun.com/xml/ns/jbi/wsdl-11- >> wrapper" >> xmlns:msgns="http://www.njusoft.com/datachange/jdbc" >> name="inputPoll" >> type="msgns:inputMsg" version="1.0"> >> <jbi:part> >> <PERSON xmlns="http://j2ee.netbeans.org/xsd/tableSchema"> >> <PERSON_Record> >> <ID>1</ID> >> <NAME>mysqlservicemixdb1</NAME> >> <PROCESSED>0</PROCESSED> >> </PERSON_Record> >> </PERSON> >> </jbi:part> >> </jbi:message> >> >> 可以看出,servicemix-24532545.xml和上面的person.xsd相比,多个<PERSON_Record>属性。 >> 我测试过了,如果把<PERSON_Record>删除,则,servicemix可以通过file组件读取 >> servicemix-24532545.xml,并且插入该条记录到表person_bak中。 >> >> 希望各位老大,可以帮帮我,怎么才能实现文件的完全写入。 >> > > > -- > Freeman Fang > ------------------------ > Open Source SOA: http://fusesource.com > > > -- View this message in context: http://www.nabble.com/servicemix-store-database----tp23051689p23051782.html Sent from the ServiceMix - User mailing list archive at Nabble.com.
