servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r475407 - /incubator/servicemix/site/main/orchestration-with-jsr181.html
Date Wed, 15 Nov 2006 20:31:19 GMT
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">&lt;?xml version=<SPAN class="code-quote">&quot;1.0&quot;</SPAN>
encoding=<SPAN class="code-quote">&quot;UTF-8&quot;</SPAN>?&gt;</SPAN>
+&lt;wsdl:definitions <SPAN class="code-keyword">xmlns:soap</SPAN>=<SPAN
class="code-quote">&quot;http://schemas.xmlsoap.org/wsdl/soap/&quot;</SPAN>
+	<SPAN class="code-keyword">xmlns:wsdl</SPAN>=<SPAN class="code-quote">&quot;http://schemas.xmlsoap.org/wsdl/&quot;</SPAN>
+	<SPAN class="code-keyword">xmlns:xsd</SPAN>=<SPAN class="code-quote">&quot;http://www.w3.org/2001/XMLSchema&quot;</SPAN>
name=<SPAN class="code-quote">&quot;Weather&quot;</SPAN>
+	targetNamespace=<SPAN class="code-quote">&quot;http://servicemix.apache.org/samples/weather&quot;</SPAN>
+	<SPAN class="code-keyword">xmlns:tns</SPAN>=<SPAN class="code-quote">&quot;http://servicemix.apache.org/samples/weather&quot;</SPAN>&gt;
+
+	<SPAN class="code-tag">&lt;wsdl:types&gt;</SPAN>
+		&lt;xsd:schema
+			targetNamespace=<SPAN class="code-quote">&quot;http://servicemix.apache.org/samples/weather&quot;</SPAN>
+			<SPAN class="code-keyword">xmlns:xsd</SPAN>=<SPAN class="code-quote">&quot;http://www.w3.org/2001/XMLSchema&quot;</SPAN>
+			<SPAN class="code-keyword">xmlns:tns</SPAN>=<SPAN class="code-quote">&quot;http://servicemix.apache.org/samples/weather&quot;</SPAN>&gt;
+			<SPAN class="code-tag">&lt;xsd:element name=<SPAN class="code-quote">&quot;GetWeatherRequest&quot;</SPAN>&gt;</SPAN>
+				<SPAN class="code-tag">&lt;xsd:complexType&gt;</SPAN>
+					<SPAN class="code-tag">&lt;xsd:sequence&gt;</SPAN>
+						<SPAN class="code-tag">&lt;xsd:element name=<SPAN class="code-quote">&quot;City&quot;</SPAN>
type=<SPAN class="code-quote">&quot;xsd:string&quot;</SPAN>&gt;</SPAN><SPAN
class="code-tag">&lt;/xsd:element&gt;</SPAN>
+						<SPAN class="code-tag">&lt;xsd:element name=<SPAN class="code-quote">&quot;State&quot;</SPAN>
type=<SPAN class="code-quote">&quot;xsd:string&quot;</SPAN>&gt;</SPAN><SPAN
class="code-tag">&lt;/xsd:element&gt;</SPAN>
+					<SPAN class="code-tag">&lt;/xsd:sequence&gt;</SPAN>
+				<SPAN class="code-tag">&lt;/xsd:complexType&gt;</SPAN>
+			<SPAN class="code-tag">&lt;/xsd:element&gt;</SPAN>
+			<SPAN class="code-tag">&lt;xsd:element name=<SPAN class="code-quote">&quot;GetWeatherResponse&quot;</SPAN>&gt;</SPAN>
+				<SPAN class="code-tag">&lt;xsd:complexType&gt;</SPAN>
+					<SPAN class="code-tag">&lt;xsd:sequence&gt;</SPAN>
+						&lt;xsd:element name=<SPAN class="code-quote">&quot;string&quot;</SPAN>
type=<SPAN class="code-quote">&quot;xsd:string&quot;</SPAN>
+							minOccurs=<SPAN class="code-quote">&quot;0&quot;</SPAN> maxOccurs=<SPAN
class="code-quote">&quot;unbounded&quot;</SPAN>&gt;
+						<SPAN class="code-tag">&lt;/xsd:element&gt;</SPAN>
+					<SPAN class="code-tag">&lt;/xsd:sequence&gt;</SPAN>
+				<SPAN class="code-tag">&lt;/xsd:complexType&gt;</SPAN>
+			<SPAN class="code-tag">&lt;/xsd:element&gt;</SPAN>
+		<SPAN class="code-tag">&lt;/xsd:schema&gt;</SPAN>
+	<SPAN class="code-tag">&lt;/wsdl:types&gt;</SPAN>
+	<SPAN class="code-tag">&lt;wsdl:message name=<SPAN class="code-quote">&quot;GetWeatherRequest&quot;</SPAN>&gt;</SPAN>
+		&lt;wsdl:part name=<SPAN class="code-quote">&quot;GetWeatherRequest&quot;</SPAN>
+			element=<SPAN class="code-quote">&quot;tns:GetWeatherRequest&quot;</SPAN>&gt;
+		<SPAN class="code-tag">&lt;/wsdl:part&gt;</SPAN>
+	<SPAN class="code-tag">&lt;/wsdl:message&gt;</SPAN>
+	<SPAN class="code-tag">&lt;wsdl:message name=<SPAN class="code-quote">&quot;GetWeatherResponse&quot;</SPAN>&gt;</SPAN>
+		&lt;wsdl:part name=<SPAN class="code-quote">&quot;GetWeatherResponse&quot;</SPAN>
+			element=<SPAN class="code-quote">&quot;tns:GetWeatherResponse&quot;</SPAN>&gt;
+		<SPAN class="code-tag">&lt;/wsdl:part&gt;</SPAN>
+	<SPAN class="code-tag">&lt;/wsdl:message&gt;</SPAN>
+	<SPAN class="code-tag">&lt;wsdl:portType name=<SPAN class="code-quote">&quot;WeatherPortType&quot;</SPAN>&gt;</SPAN>
+		<SPAN class="code-tag">&lt;wsdl:operation name=<SPAN class="code-quote">&quot;GetWeather&quot;</SPAN>&gt;</SPAN>
+			<SPAN class="code-tag">&lt;wsdl:input message=<SPAN class="code-quote">&quot;tns:GetWeatherRequest&quot;</SPAN>&gt;</SPAN><SPAN
class="code-tag">&lt;/wsdl:input&gt;</SPAN>
+			<SPAN class="code-tag">&lt;wsdl:output message=<SPAN class="code-quote">&quot;tns:GetWeatherResponse&quot;</SPAN>&gt;</SPAN><SPAN
class="code-tag">&lt;/wsdl:output&gt;</SPAN>
+		<SPAN class="code-tag">&lt;/wsdl:operation&gt;</SPAN>
+	<SPAN class="code-tag">&lt;/wsdl:portType&gt;</SPAN>
+	&lt;wsdl:binding name=<SPAN class="code-quote">&quot;WeatherSoapBinding&quot;</SPAN>
+		type=<SPAN class="code-quote">&quot;tns:WeatherPortType&quot;</SPAN>&gt;
+		&lt;soap:binding style=<SPAN class="code-quote">&quot;document&quot;</SPAN>
+			transport=<SPAN class="code-quote">&quot;http://schemas.xmlsoap.org/soap/http&quot;</SPAN>
/&gt;
+		<SPAN class="code-tag">&lt;wsdl:operation name=<SPAN class="code-quote">&quot;GetWeather&quot;</SPAN>&gt;</SPAN>
+			&lt;soap:operation
+				soapAction=<SPAN class="code-quote">&quot;http://servicemix.apache.org/samples/weather/GetWeather&quot;</SPAN>
/&gt;
+			<SPAN class="code-tag">&lt;wsdl:input&gt;</SPAN>
+				<SPAN class="code-tag">&lt;soap:body use=<SPAN class="code-quote">&quot;literal&quot;</SPAN>
/&gt;</SPAN>
+			<SPAN class="code-tag">&lt;/wsdl:input&gt;</SPAN>
+			<SPAN class="code-tag">&lt;wsdl:output&gt;</SPAN>
+				<SPAN class="code-tag">&lt;soap:body use=<SPAN class="code-quote">&quot;literal&quot;</SPAN>
/&gt;</SPAN>
+			<SPAN class="code-tag">&lt;/wsdl:output&gt;</SPAN>
+		<SPAN class="code-tag">&lt;/wsdl:operation&gt;</SPAN>
+	<SPAN class="code-tag">&lt;/wsdl:binding&gt;</SPAN>
+	<SPAN class="code-tag">&lt;wsdl:service name=<SPAN class="code-quote">&quot;WeatherService&quot;</SPAN>&gt;</SPAN>
+		<SPAN class="code-tag">&lt;wsdl:port name=<SPAN class="code-quote">&quot;Soap&quot;</SPAN>
binding=<SPAN class="code-quote">&quot;tns:WeatherSoapBinding&quot;</SPAN>&gt;</SPAN>
+			<SPAN class="code-tag">&lt;soap:address location=<SPAN class="code-quote">&quot;http://www.example.org/&quot;</SPAN>
/&gt;</SPAN>
+		<SPAN class="code-tag">&lt;/wsdl:port&gt;</SPAN>
+	<SPAN class="code-tag">&lt;/wsdl:service&gt;</SPAN>
+<SPAN class="code-tag">&lt;/wsdl:definitions&gt;</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">&lt;wsgen outputDirectory=<SPAN class="code-quote">&quot;${basedir}/target/generated-sources&quot;</SPAN>

+       explicitAnnotation=<SPAN class="code-quote">&quot;true&quot;</SPAN>

+       profile=<SPAN class="code-quote">&quot;org.codehaus.xfire.jaxws.gen.JAXWSProfile&quot;</SPAN>

+       wsdl=<SPAN class="code-quote">&quot;${basedir}/src/main/resources/service.wsdl&quot;</SPAN>&gt;<SPAN
class="code-tag">&lt;/wsgen&gt;</SPAN>
+&lt;wsgen outputDirectory=<SPAN class="code-quote">&quot;${basedir}/target/generated-sources&quot;</SPAN>

+       explicitAnnotation=<SPAN class="code-quote">&quot;true&quot;</SPAN>

+       profile=<SPAN class="code-quote">&quot;org.codehaus.xfire.jaxws.gen.JAXWSProfile&quot;</SPAN>

+       wsdl=<SPAN class="code-quote">&quot;${basedir}/src/main/resources/ForecastByZip2.wsdl&quot;</SPAN>&gt;<SPAN
class="code-tag">&lt;/wsgen&gt;</SPAN>
+&lt;wsgen outputDirectory=<SPAN class="code-quote">&quot;${basedir}/target/generated-sources&quot;</SPAN>

+       explicitAnnotation=<SPAN class="code-quote">&quot;true&quot;</SPAN>

+       profile=<SPAN class="code-quote">&quot;org.codehaus.xfire.jaxws.gen.JAXWSProfile&quot;</SPAN>

+       wsdl=<SPAN class="code-quote">&quot;${basedir}/src/main/resources/ZipByCityState2.wsdl&quot;</SPAN>&gt;<SPAN
class="code-tag">&lt;/wsgen&gt;</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
-                  &nbsp;(<A href="http://goopen.org/confluence/pages/diffpages.action?pageId=15116&originalId=15117">view
change</A>)
+                  &nbsp;(<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>



Mime
View raw message