You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by ch...@apache.org on 2006/11/15 21:31:19 UTC
svn commit: r475407 -
/incubator/servicemix/site/main/orchestration-with-jsr181.html
Author: chirino
Date: Wed Nov 15 12:31:19 2006
New Revision: 475407
URL: http://svn.apache.org/viewvc?view=rev&rev=475407
Log:
Latest export from confluence
Modified:
incubator/servicemix/site/main/orchestration-with-jsr181.html
Modified: incubator/servicemix/site/main/orchestration-with-jsr181.html
URL: http://svn.apache.org/viewvc/incubator/servicemix/site/main/orchestration-with-jsr181.html?view=diff&rev=475407&r1=475406&r2=475407
==============================================================================
--- incubator/servicemix/site/main/orchestration-with-jsr181.html (original)
+++ incubator/servicemix/site/main/orchestration-with-jsr181.html Wed Nov 15 12:31:19 2006
@@ -146,7 +146,6 @@
<P>We will call them in a simple way to provide an aggregate web service which will return the weather forecast for a given city / state and expose it through as an HTTP/SOAP service.</P>
<P>For this tutorial, you will need a 3.1-incubating-SNAPSHOT version of ServiceMix built from sources.</P>
-
<H2><A name="OrchestrationwithJSR181-Projectstructure%2CSUsandSA"></A>Project structure, SUs and SA</H2>
<P>In this example, we will only use two components:</P>
@@ -177,7 +176,9 @@
<P>Then, we can use maven archetypes to create the two SUs and the SA. In the <TT>weather</TT> directory, launch the following commands:</P>
<DIV class="code"><DIV class="codeContent">
-<PRE class="code-java">mvn archetype:create \
+<PRE class="code-java">cd weather
+
+mvn archetype:create \
-DarchetypeGroupId=org.apache.servicemix.tooling \
-DarchetypeArtifactId=servicemix-http-consumer-service-unit \
-DarchetypeVersion=3.1-incubating-SNAPSHOT \
@@ -189,7 +190,7 @@
-DarchetypeArtifactId=servicemix-jsr181-wsdl-first-service-unit \
-DarchetypeVersion=3.1-incubating-SNAPSHOT \
-DgroupId=org.apache.servicemix.samples.weather \
- -DartifactId=bridge-http-su
+ -DartifactId=weather-jsr181-su
mvn archetype:create \
-DarchetypeGroupId=org.apache.servicemix.tooling \
@@ -209,7 +210,127 @@
...
weather-sa\
...</PRE>
-</DIV></DIV></DIV>
+</DIV></DIV>
+
+<H2><A name="OrchestrationwithJSR181-GeneratingEclipseprojects"></A>Generating Eclipse projects</H2>
+
+<P>Now that we have the projects created, be can import them in Eclipse. Run the following command to build the eclipse project files:</P>
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-java">cd weather
+mvn eclipse:eclipse</PRE>
+</DIV></DIV>
+
+<P>Now, we can import the projects in Eclipse.</P>
+
+<H2><A name="OrchestrationwithJSR181-Thejsr181SU"></A>The jsr181 SU</H2>
+
+<P>The first thing to do is to design the WSDL that will be exposed as a service, so that we can generate the needed classes and implement the service.</P>
+
+<P>Edit the <TT>weather/weather-jsr181-su/src/main/resources/service.wsdl</TT> and replace it by the following one:</P>
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-xml"><SPAN class="code-tag"><?xml version=<SPAN class="code-quote">"1.0"</SPAN> encoding=<SPAN class="code-quote">"UTF-8"</SPAN>?></SPAN>
+<wsdl:definitions <SPAN class="code-keyword">xmlns:soap</SPAN>=<SPAN class="code-quote">"http://schemas.xmlsoap.org/wsdl/soap/"</SPAN>
+ <SPAN class="code-keyword">xmlns:wsdl</SPAN>=<SPAN class="code-quote">"http://schemas.xmlsoap.org/wsdl/"</SPAN>
+ <SPAN class="code-keyword">xmlns:xsd</SPAN>=<SPAN class="code-quote">"http://www.w3.org/2001/XMLSchema"</SPAN> name=<SPAN class="code-quote">"Weather"</SPAN>
+ targetNamespace=<SPAN class="code-quote">"http://servicemix.apache.org/samples/weather"</SPAN>
+ <SPAN class="code-keyword">xmlns:tns</SPAN>=<SPAN class="code-quote">"http://servicemix.apache.org/samples/weather"</SPAN>>
+
+ <SPAN class="code-tag"><wsdl:types></SPAN>
+ <xsd:schema
+ targetNamespace=<SPAN class="code-quote">"http://servicemix.apache.org/samples/weather"</SPAN>
+ <SPAN class="code-keyword">xmlns:xsd</SPAN>=<SPAN class="code-quote">"http://www.w3.org/2001/XMLSchema"</SPAN>
+ <SPAN class="code-keyword">xmlns:tns</SPAN>=<SPAN class="code-quote">"http://servicemix.apache.org/samples/weather"</SPAN>>
+ <SPAN class="code-tag"><xsd:element name=<SPAN class="code-quote">"GetWeatherRequest"</SPAN>></SPAN>
+ <SPAN class="code-tag"><xsd:complexType></SPAN>
+ <SPAN class="code-tag"><xsd:sequence></SPAN>
+ <SPAN class="code-tag"><xsd:element name=<SPAN class="code-quote">"City"</SPAN> type=<SPAN class="code-quote">"xsd:string"</SPAN>></SPAN><SPAN class="code-tag"></xsd:element></SPAN>
+ <SPAN class="code-tag"><xsd:element name=<SPAN class="code-quote">"State"</SPAN> type=<SPAN class="code-quote">"xsd:string"</SPAN>></SPAN><SPAN class="code-tag"></xsd:element></SPAN>
+ <SPAN class="code-tag"></xsd:sequence></SPAN>
+ <SPAN class="code-tag"></xsd:complexType></SPAN>
+ <SPAN class="code-tag"></xsd:element></SPAN>
+ <SPAN class="code-tag"><xsd:element name=<SPAN class="code-quote">"GetWeatherResponse"</SPAN>></SPAN>
+ <SPAN class="code-tag"><xsd:complexType></SPAN>
+ <SPAN class="code-tag"><xsd:sequence></SPAN>
+ <xsd:element name=<SPAN class="code-quote">"string"</SPAN> type=<SPAN class="code-quote">"xsd:string"</SPAN>
+ minOccurs=<SPAN class="code-quote">"0"</SPAN> maxOccurs=<SPAN class="code-quote">"unbounded"</SPAN>>
+ <SPAN class="code-tag"></xsd:element></SPAN>
+ <SPAN class="code-tag"></xsd:sequence></SPAN>
+ <SPAN class="code-tag"></xsd:complexType></SPAN>
+ <SPAN class="code-tag"></xsd:element></SPAN>
+ <SPAN class="code-tag"></xsd:schema></SPAN>
+ <SPAN class="code-tag"></wsdl:types></SPAN>
+ <SPAN class="code-tag"><wsdl:message name=<SPAN class="code-quote">"GetWeatherRequest"</SPAN>></SPAN>
+ <wsdl:part name=<SPAN class="code-quote">"GetWeatherRequest"</SPAN>
+ element=<SPAN class="code-quote">"tns:GetWeatherRequest"</SPAN>>
+ <SPAN class="code-tag"></wsdl:part></SPAN>
+ <SPAN class="code-tag"></wsdl:message></SPAN>
+ <SPAN class="code-tag"><wsdl:message name=<SPAN class="code-quote">"GetWeatherResponse"</SPAN>></SPAN>
+ <wsdl:part name=<SPAN class="code-quote">"GetWeatherResponse"</SPAN>
+ element=<SPAN class="code-quote">"tns:GetWeatherResponse"</SPAN>>
+ <SPAN class="code-tag"></wsdl:part></SPAN>
+ <SPAN class="code-tag"></wsdl:message></SPAN>
+ <SPAN class="code-tag"><wsdl:portType name=<SPAN class="code-quote">"WeatherPortType"</SPAN>></SPAN>
+ <SPAN class="code-tag"><wsdl:operation name=<SPAN class="code-quote">"GetWeather"</SPAN>></SPAN>
+ <SPAN class="code-tag"><wsdl:input message=<SPAN class="code-quote">"tns:GetWeatherRequest"</SPAN>></SPAN><SPAN class="code-tag"></wsdl:input></SPAN>
+ <SPAN class="code-tag"><wsdl:output message=<SPAN class="code-quote">"tns:GetWeatherResponse"</SPAN>></SPAN><SPAN class="code-tag"></wsdl:output></SPAN>
+ <SPAN class="code-tag"></wsdl:operation></SPAN>
+ <SPAN class="code-tag"></wsdl:portType></SPAN>
+ <wsdl:binding name=<SPAN class="code-quote">"WeatherSoapBinding"</SPAN>
+ type=<SPAN class="code-quote">"tns:WeatherPortType"</SPAN>>
+ <soap:binding style=<SPAN class="code-quote">"document"</SPAN>
+ transport=<SPAN class="code-quote">"http://schemas.xmlsoap.org/soap/http"</SPAN> />
+ <SPAN class="code-tag"><wsdl:operation name=<SPAN class="code-quote">"GetWeather"</SPAN>></SPAN>
+ <soap:operation
+ soapAction=<SPAN class="code-quote">"http://servicemix.apache.org/samples/weather/GetWeather"</SPAN> />
+ <SPAN class="code-tag"><wsdl:input></SPAN>
+ <SPAN class="code-tag"><soap:body use=<SPAN class="code-quote">"literal"</SPAN> /></SPAN>
+ <SPAN class="code-tag"></wsdl:input></SPAN>
+ <SPAN class="code-tag"><wsdl:output></SPAN>
+ <SPAN class="code-tag"><soap:body use=<SPAN class="code-quote">"literal"</SPAN> /></SPAN>
+ <SPAN class="code-tag"></wsdl:output></SPAN>
+ <SPAN class="code-tag"></wsdl:operation></SPAN>
+ <SPAN class="code-tag"></wsdl:binding></SPAN>
+ <SPAN class="code-tag"><wsdl:service name=<SPAN class="code-quote">"WeatherService"</SPAN>></SPAN>
+ <SPAN class="code-tag"><wsdl:port name=<SPAN class="code-quote">"Soap"</SPAN> binding=<SPAN class="code-quote">"tns:WeatherSoapBinding"</SPAN>></SPAN>
+ <SPAN class="code-tag"><soap:address location=<SPAN class="code-quote">"http://www.example.org/"</SPAN> /></SPAN>
+ <SPAN class="code-tag"></wsdl:port></SPAN>
+ <SPAN class="code-tag"></wsdl:service></SPAN>
+<SPAN class="code-tag"></wsdl:definitions></SPAN></PRE>
+</DIV></DIV>
+
+<P>Then, grab the WSDL definitions for the two web services we will use. On Unix systems, you can use:</P>
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-java">cd weather/weather-jsr181-su/src/main/resources/
+wget http:<SPAN class="code-comment">//ws.strikeiron.com/InnerGears/ForecastByZip2?WSDL
+</SPAN>mv ForecastByZip2\@WSDL ForcastByZip2.wsdl
+wget http:<SPAN class="code-comment">//ws.strikeiron.com/InnerGears/ZipByCityState2?WSDL
+</SPAN>mv ZipByCityState2\@WSDL ZipByCityState2.wsdl</PRE>
+</DIV></DIV>
+
+<P>If you use Windows, just download from them your web browser and put them in the above directory.</P>
+
+<P>Then, we need to modify the <TT>pom.xml</TT> file to generate the classes for the web services. The archetype we used already has a definition for the main WSDL, we just need to copy it for the two new WSDLs:</P>
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-xml"><wsgen outputDirectory=<SPAN class="code-quote">"${basedir}/target/generated-sources"</SPAN>
+ explicitAnnotation=<SPAN class="code-quote">"true"</SPAN>
+ profile=<SPAN class="code-quote">"org.codehaus.xfire.jaxws.gen.JAXWSProfile"</SPAN>
+ wsdl=<SPAN class="code-quote">"${basedir}/src/main/resources/service.wsdl"</SPAN>><SPAN class="code-tag"></wsgen></SPAN>
+<wsgen outputDirectory=<SPAN class="code-quote">"${basedir}/target/generated-sources"</SPAN>
+ explicitAnnotation=<SPAN class="code-quote">"true"</SPAN>
+ profile=<SPAN class="code-quote">"org.codehaus.xfire.jaxws.gen.JAXWSProfile"</SPAN>
+ wsdl=<SPAN class="code-quote">"${basedir}/src/main/resources/ForecastByZip2.wsdl"</SPAN>><SPAN class="code-tag"></wsgen></SPAN>
+<wsgen outputDirectory=<SPAN class="code-quote">"${basedir}/target/generated-sources"</SPAN>
+ explicitAnnotation=<SPAN class="code-quote">"true"</SPAN>
+ profile=<SPAN class="code-quote">"org.codehaus.xfire.jaxws.gen.JAXWSProfile"</SPAN>
+ wsdl=<SPAN class="code-quote">"${basedir}/src/main/resources/ZipByCityState2.wsdl"</SPAN>><SPAN class="code-tag"></wsgen></SPAN></PRE>
+</DIV></DIV>
+
+<P>Now, generate all the classes from these three WSDLs by launching:</P>
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-java">cd weather/weather-jsr181-su
+mvn generate-sources</PRE>
+</DIV></DIV>
+</DIV>
</DIV>
</TD>
@@ -220,7 +341,7 @@
<DIV id="site-footer">
Added by <A href="http://goopen.org/confluence/users/viewuserprofile.action?username=gnodet">Guillaume Nodet</A>,
last edited by <A href="http://goopen.org/confluence/users/viewuserprofile.action?username=gnodet">Guillaume Nodet</A> on Nov 20, 2006
- (<A href="http://goopen.org/confluence/pages/diffpages.action?pageId=15116&originalId=15117">view change</A>)
+ (<A href="http://goopen.org/confluence/pages/diffpages.action?pageId=15116&originalId=15119">view change</A>)
(<A href="http://goopen.org/confluence/pages/editpage.action?pageId=15116">edit page</A>)
</DIV>