The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

gaoming25 (3) [Avatar] Offline
#1
Environment: servicemix3.3 + sun the + file components JDBC components

I would like to achieve the function is: through the jdbc component, write a wsdl file, database table read person, to get the records to generate a xml file, and finally read the xml file into the other
Person_bak in Table 1, the situation is person can read the record, you can generate a xml file, but to read xml file into the table person_bak
The middle, resulting in abnormal, the data can not write.

×××××××××××××××××××××××××××××××××××××××××××××××××× × × × ×
Anomaly as follows:
at java.lang.Thread.run (Thread.java: 619)
WARN - FileComponent - Message in file chapter6 3-jdbc in serv
icemix-537959706700962395.xml could not be handled successfully: Error occured w
hile executing SQL.INSERT into PERSON_BAK (id, name, processed) values (?,?,?) R
eason: Statement parameter 1 not set. SQLState: S1009 ErrorCode: 0
java.sql.SQLException: Error occured while executing SQL.INSERT into PERSON_BAK
(id, name, processed) values (?,?,?) Reason: Statement parameter 1 not set. SQLS
tate: S1009 ErrorCode: 0
at org.glassfish.openesb.databasebc.OutboundMessageProcessor.executeOutb
oundSQL (OutboundMessageProcessor.java: 1377)
at org.glassfish.openesb.databasebc.OutboundMessageProcessor.processInOn
ly (OutboundMessageProcessor.java: 1241)
at org.glassfish.openesb.databasebc.OutboundMessageProcessor.execute (Out
boundMessageProcessor.java: 297)
at org.glassfish.openesb.databasebc.OutboundMessageProcessor.run (Outboun
dMessageProcessor.java: 171)
at java.util.concurrent.ThreadPoolExecutor $ Worker.runTask (ThreadPoolExec
utor.java: 886)
at java.util.concurrent.ThreadPoolExecutor $ Worker.run (ThreadPoolExecutor
. java: 90smilie
at java.lang.Thread.run (Thread.java: 619)
2009-4-15 13:13:15 org.glassfish.openesb.databasebc.OutboundMessageProcessor run

Information: Finished processing outbound messages.

×××××××××××××××××××××××××××××××××××××××××××××××××× × × × ×


wsdl file as follows:


<? 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="nssmilieERSON" />
</ message>
<message name="insertRetMsg">
<part name="part" type="xsd:int" />
</ message>
<message name="outputMsg">
<part name="part" element="nssmilieERSON" />
</ 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>


This is the person described in table format.
Person.xsd description of the corresponding documents as follows:
<? xml version = "1.0" encoding = "UTF-8"?>
<xsd: schema elementFormDefault = "qualified" targetNamespace = "http:// <br /> j2ee.netbeans.org/xsd/tableSchema "xmlns =" http://j2ee.netbeans.org/xsd/ <br /> 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 to read the table records, generated xml file servicemix-24532545.xml as follows:
<? xml version = "1.0" encoding = "UTF-8"?>
<jbi: message xmlns: jbi = "http://java.sun.com/xml/ns/jbi/wsdl-11- <br /> 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>

As can be seen, servicemix-24532545.xml and person.xsd above compared to more than <PERSON_Record> attributes.
I've tested, and if the <PERSON_Record> deleted,, servicemix components can be read through the file
servicemix-24532545.xml, and which record inserted in the table person_bak.

I hope that boss, you can help me, how to write the complete file.