...
Next, open the web page of your application : http://localhost:8080/reportincidentweb/
Code Block |
---|
Report Incident HomePage
List of incidents coming from web services or file :
Id Incident Date Incident Ref First Name Last Name Summary Details Email Phone Origin Creation date
1 2009-01-29 00:04:00.0 666 Charles Moulliard This is a web service incident This is an web service report incident,This is an web service report incident. cmoulliard@gmail.com +222 10 20 30 40 webservice 2009-04-30 17:41:33.0
2 2009-01-15 00:04:00.0 703 Claus Ibsen incident camel-703 this is a report incident for camel-703 claus.ibsen@gmail.com +777 10 20 300 file 2009-04-30 17:44:27.0
3 2009-01-29 00:04:00.0 001 Claus Ibsen incident camel-001 this is a report incident for camel-001 cibsen@gmail.com +111 10 20 300 file 2009-04-30 17:45:18.0
4 2009-01-29 00:04:00.0 002 Charles Moulliard incident smx-002 this is a report incident for smx-002 cmoulliard@gmail.com +222 10 20 300 file 2009-04-30 17:45:18.0
5 2009-01-28 00:04:00.0 003 Guillaume Nodet incident camel-123 this is a report incident for camel-123 gnodet@gmail.com +333 10 20 300 file 2009-04-30 17:45:18.0
6 2009-01-25 00:04:00.0 004 Gert Vanthienen incident camel-454 this is a report incident for camel-454 gvanthienen@gmail.com +444 10 20 300 file 2009-04-30 17:45:18.0
7 2009-01-24 00:04:00.0 005 James Anstey incident smx-023 this is a report incident for smx-023 janstey@gmail.com +555 10 20 300 file 2009-04-30 17:45:18.0
8 2009-01-01 00:04:00.0 007 Willem Jiang incident smx-456 this is a report incident for smx-456 wjiang@gmail.com +666 10 20 300 file 2009-04-30 17:45:18.0
9 2009-01-27 00:04:00.0 008 Matt Raibble incident appfuse-123 this is a report incident for appfuse-123 mraibble@gmail.com +777 10 20 300 file 2009-04-30 17:45:18.0
10 2009-01-12 00:04:00.0 009 Jean-Baptiste Onofré incident smx3-088 this is a report incident for smx3-088 cjbonofre@gmail.com +888 10 20 300 file 2009-04-30 17:45:18.0
11 2009-01-17 00:04:00.0 010 Hadrian Zbarcea incident camel-005 this is a report incident for camel-005 hzbarcea@gmail.com +999 10 20 300 file 2009-04-30 17:45:18.0
|
Step 4 : Call a webservice
You can use the tool Soapui to call the web service of the application.
Use the following url from Soapui, to generate the client interface to communicate with the web service : http://localhost:8080/cxf/camel-example/incident?wsdl.
Call the web service with the request : http://localhost:8080/cxf/camel-example/incident
and the following SOAP message request by example :
...
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:rep="http://reportincident.example.camel.apache.org">
<soapenv:Header/>
<soapenv:Body>
<rep:inputReportIncident>
<incidentId>000</incidentId>
<incidentDate>29-04-2009</incidentDate>
<givenName>Charles</givenName>
<familyName>Moulliard</familyName>
<summary>This is an web service report incident</summary>
<details>This is an web service report incident,This is an web service report incident.</details>
<email>cmoulliard@gmail.com</email>
<phone>+222 10 20 30 40</phone>
</rep:inputReportIncident>
</soapenv:Body>
</soapenv:Envelope>
Step 4 : Call a webservice
You can use the tool Soapui to call the web service of the application.
Use the following url from Soapui, to generate the client interface to communicate with the web service : http://localhost:8080/cxf/camel-example/incident?wsdl.
Call the web service with the request : http://localhost:8080/cxf/camel-example/incident
and the following SOAP message request by example :
Code Block | ||||
---|---|---|---|---|
| ||||
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:rep=" |
Check the Servicemix log :
Code Block |
---|
17:41:33,463 | INFO | 14752391@qtp1-0 | TraceInterceptor | rg.apache.camel.processor.Logger 88 | ID-dell-charles-2274-1241105486478-2-8 >>> /camel-example/incident --> setHeader(webservice), Pattern:InOut, Properties:{org.apache.camel.component.cxf.DataFormat=POJO, org.apache.cxf.service.model.BindingOperationInfo=[BindingOperationInfo: {http://reportincident.example.camel.apache.org}ReportIncident]}, Headers:{content-type=text/xml;charset=UTF-8, content.type=text/xml;charset=UTF-8, operationName=ReportIncident, Host=localhost:8080, Content-Length=701, SOAPAction="http://reportincident.example.camel.apache.org/ReportIncident", User-Agent=Jakarta Commons-HttpClient/3.1, operationNameSpace=http://reportincident.example.camel.apache.org}, BodyType:org.apache.cxf.message.MessageContentsList, Body:[org.apache.camel.example.reportincident.InputReportIncident@15099a1] 17:41:33,478 | INFO | 14752391@qtp1-0 | TraceInterceptor "> <soapenv:Header/> <soapenv:Body> <rep:inputReportIncident> <incidentId>000</incidentId> <incidentDate>29-04-2009</incidentDate> <givenName>Charles</givenName> <familyName>Moulliard</familyName> <summary>This is an web service report incident</summary> <details>This is an web service report incident,This is an web service report incident.</details> | rg.apache.camel.processor.Logger<email>cmoulliard@gmail.com</email> 88 | ID-dell-charles-2274-1241105486478-2-8 >>> setHeader(webservice) <phone>+222 10 20 30 40</phone> </rep:inputReportIncident> </soapenv:Body> </soapenv:Envelope> |
Check the Servicemix log :
Code Block |
---|
--> convertBodyTo(), Pattern:InOut, Properties:{org.apache.camel.component.cxf.DataFormat=POJO, org.apache.cxf.service.model.BindingOperationInfo=[BindingOperationInfo: {http://reportincident.example.camel.apache.org}ReportIncident]}, Headers:{content-type=text/xml;charset=UTF-8, operationName=ReportIncident, content.type=text/xml;charset=UTF-8, Host=localhost:8080, Content-Length=701, SOAPAction="http://reportincident.example.camel.apache.org/ReportIncident", origin=webservice, User-Agent=Jakarta Commons-HttpClient/3.1, operationNameSpace=http://reportincident.example.camel.apache.org}, BodyType:org.apache.cxf.message.MessageContentsList, Body:[org.apache.camel.example.reportincident.InputReportIncident@15099a1] 17:41:33,494463 | INFO | 14752391@qtp1-0 | TraceInterceptor | rg.apache.camel.processor.Logger 88 | ID-dell-charles-2274-1241105486478-2-8 >>> convertBodyTo()/camel-example/incident --> tosetHeader(bean:webservice), Pattern:InOut, Properties:{org.apache.camel.component.cxf.DataFormat=POJO, org.apache.cxf.service.model.BindingOperationInfo=[BindingOperationInfo: {http://reportincident.example.camel.apache.org}ReportIncident]}, Headers:{content-type=text/xml;charset=UTF-8, operationName=ReportIncident, content.type=text/xml;charset=UTF-8, operationName=ReportIncident, Host=localhost:8080, Content-Length=701, SOAPAction="http://reportincident.example.camel.apache.org/ReportIncident", origin=webservice, User-Agent=Jakarta Commons-HttpClient/3.1, operationNameSpace=http://reportincident.example.camel.apache.org}, BodyType:org.apache.camelcxf.examplemessage.reportincident.InputReportIncidentMessageContentsList, Body:[org.apache.camel.example.reportincident.InputReportIncident@15099a1] 17:41:33,510478 | INFO | 14752391@qtp1-0 | TraceInterceptor | rg.apache.camel.processor.Logger 88 | ID-dell-charles-2274-1241105486478-2-8 >>> tosetHeader(bean:webservice) --> inOnlyconvertBodyTo(queuingservice:queue:in), Pattern:InOut, Properties:{CamelBeanHolder=bean: webservice, org.apache.camel.component.cxf.DataFormat=POJO, org.apache.cxf.service.model.BindingOperationInfo=[BindingOperationInfo: {http://reportincident.example.camel.apache.org}ReportIncident]}, Headers:{origin=webservice}, BodyType:java.util.ArrayList, Body:[{org.apache.camel.example.reportincident.model.Incident=org.apache.camel.example.reportincident.model.Incident@1a6895c[ incidentId=0 incidentRef=666 incidentDate=Thu Jan 29 00:04:00 CET 2009 givenName=Charles familyName=Moulliard summary=This is a web service incident details=This is an web service report incident,This is an web service report incident. email=cmoulliard@gmail.com phone=+222 10 20 30 40 creationUser=webservice creationDate=Thu Apr 30 17:41:33 CEST 2009 ]}] 17:41:33,619 | INFO | ActiveMQ Task | FailoverTransport | sport.failover.FailoverTransport 714 | Successfully connected to tcp://localhost:61616 17:41:33,650content-type=text/xml;charset=UTF-8, operationName=ReportIncident, content.type=text/xml;charset=UTF-8, Host=localhost:8080, Content-Length=701, SOAPAction="http://reportincident.example.camel.apache.org/ReportIncident", origin=webservice, User-Agent=Jakarta Commons-HttpClient/3.1, operationNameSpace=http://reportincident.example.camel.apache.org}, BodyType:org.apache.cxf.message.MessageContentsList, Body:[org.apache.camel.example.reportincident.InputReportIncident@15099a1] 17:41:33,494 | INFO | 14752391@qtp1-0 | TraceInterceptor | rg.apache.camel.processor.Logger 88 | ID-dell-charles-2274-1241105486478-2-8 >>> convertBodyTo() --> to(bean:webservice), Pattern:InOut, Properties:{org.apache.camel.component.cxf.DataFormat=POJO, org.apache.cxf.service.model.BindingOperationInfo=[BindingOperationInfo: {http://reportincident.example.camel.apache.org}ReportIncident]}, Headers:{content-type=text/xml;charset=UTF-8, operationName=ReportIncident, content.type=text/xml;charset=UTF-8, Host=localhost:8080, Content-Length=701, SOAPAction="http://reportincident.example.camel.apache.org/ReportIncident", origin=webservice, User-Agent=Jakarta Commons-HttpClient/3.1, operationNameSpace=http://reportincident.example.camel.apache.org}, BodyType:org.apache.camel.example.reportincident.InputReportIncident, Body:org.apache.camel.example.reportincident.InputReportIncident@15099a1 17:41:33,510 | INFO | 14752391@qtp1-0 | TraceInterceptor | rg.apache.camel.processor.Logger 88 | ID-dell-charles-2274-1241105486478-2-8 >>> inOnlyto(queuingservicebean:queue:inwebservice) --> transforminOnly(queuingservice:queue:in), Pattern:InOnlyInOut, Properties:{CamelBeanHolder=bean: webservice, org.apache.camel.component.cxf.DataFormat=POJO, org.apache.cxf.service.model.BindingOperationInfo=[BindingOperationInfo: {http://reportincident.example.camel.apache.org}ReportIncident]}, Headers:{origin=webservice}, BodyType:java.util.ArrayList, Body:[{org.apache.camel.example.reportincident.model.Incident=org.apache.camel.example.reportincident.model.Incident@1a6895c[ incidentId=0 incidentRef=666 incidentDate=Thu Jan 29 00:04:00 CET 2009 givenName=Charles familyName=Moulliard summary=This is a web service incident details=This is an web service report incident,This is an web service report incident. email=cmoulliard@gmail.com phone=+222 10 20 30 40 creationUser=webservice creationDate=Thu Apr 30 17:41:33 CEST 2009 ]}] Apr 30 17:41:33 CEST 2009 ]}] 17:41:33,619 | INFO | ActiveMQ Task | FailoverTransport | sport.failover.FailoverTransport 714 | Successfully connected to tcp://localhost:61616 17:41:33,681650 | INFO | nerContainer14752391@qtp1-5890 | TraceInterceptor | rg.apache.camel.processor.Logger 88 | ID-dell-charles-2274-1241105486478-2-98 >>> inOnly(queuingservice:queue:in) --> to(bean:incidentSaver?method=processtransform(), Pattern:InOnly, HeadersProperties:{JMSXGroupIDCamelBeanHolder=null, JMSCorrelationID=null, JMSType=null, JMSExpiration=0, JMSMessageID=ID:dell-charles-3593-1241089972416-2:5:1:1:1, JMSRedelivered=false, JMSDeliveryMode=2, origin=webservice, JMSPriority=4, JMSReplyTo=null, JMSTimestamp=1241106093635, JMSDestination=queue://inbean: webservice, org.apache.camel.component.cxf.DataFormat=POJO, org.apache.cxf.service.model.BindingOperationInfo=[BindingOperationInfo: {http://reportincident.example.camel.apache.org}ReportIncident]}, Headers:{origin=webservice}, BodyType:java.util.ArrayList, Body:[{org.apache.camel.example.reportincident.model.Incident=org.apache.camel.example.reportincident.model.Incident@37a96Incident@1a6895c[ incidentId=0 incidentRef=666 incidentDate=Thu Jan 29 00:04:00 CET 2009 givenName=Charles familyName=Moulliard summary=This is a web service incident details=This is an web service report incident,This is an web service report incident. email=cmoulliard@gmail.com phone=+222 10 20 30 40 creationUser=webservice creationDate=Thu email=cmoulliard@gmail.com phone=+222 10 20 30 40 creationUser=webservice creationDate=Thu Apr 30 17:41:33 CEST 2009 ]}] |
and web screen result : http://localhost:8080/reportincidentweb/
Code Block |
---|
Report Incident HomePage List of incidents coming from web services or file : Id Incident Date Incident Ref First Name Last Name Summary Details Email Phone Origin Creation date 1 2009-01-Apr 30 17:41:33 CEST 2009 ]}] 17:41:33,681 | INFO | nerContainer-589 | TraceInterceptor | rg.apache.camel.processor.Logger 88 | ID-dell-charles-2274-1241105486478-2-9 >>> queuingservice:queue:in --> to(bean:incidentSaver?method=process), Pattern:InOnly, Headers:{JMSXGroupID=null, JMSCorrelationID=null, JMSType=null, JMSExpiration=0, JMSMessageID=ID:dell-charles-3593-1241089972416-2:5:1:1:1, JMSRedelivered=false, JMSDeliveryMode=2, origin=webservice, JMSPriority=4, JMSReplyTo=null, JMSTimestamp=1241106093635, JMSDestination=queue://in}, BodyType:java.util.ArrayList, Body:[{org.apache.camel.example.reportincident.model.Incident=org.apache.camel.example.reportincident.model.Incident@37a96[ incidentId=0 incidentRef=666 incidentDate=Thu Jan 29 00:04:00.0 666 Charles Moulliard CET 2009 givenName=Charles familyName=Moulliard summary=This is a web service incident details=This is an web service report incident,This is an web service report incident. email=cmoulliard@gmail.com phone=+222 10 20 30 40 webservice 2009-04- creationUser=webservice creationDate=Thu Apr 30 17:41:33.0 CEST 2009 ]}] |
and web screen result : http://localhost:8080/reportincidentweb/
Conclusion
TODO
Links
- Part 1 : simple example
- Part 2a : real example, architecture, project setup, database creation
- Part 2b : transform projects in bundles
- Part 2c : add infrastructure and routing
- Part 2d : web and deployment
...