You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by nvijayak <nv...@cs.indiana.edu> on 2008/01/09 08:21:04 UTC

Example for http provider su

Hi,

I am looking for an example for http provider su. I am writing a simple
example of http-provider using servicemix-http-provider maven archetype. I
am not sure if my xbean.wsdl is correct: 

<beans xmlns:http="http://servicemix.apache.org/http/1.0"
xmlns:ex="http://servicemix.apache.org/example">
  <http:endpoint service="ex:httpProvider" 
                        endpoint="soap" 
                         role="provider"
locationURI="http://localhost:8192/httpProvider/"  
defaultMep="http://www.w3.org/2004/08/wsdl/in-out" soap="true" /> 
  </beans>

Do I need to specify a targetService? Does service and targetService have to
be the same? Also do I need to specify an endpoint other than soap? If the
xbean.wsdl in src/main/resources will it automatically use the class from
src/main/java for the service?

Sorry for asking many simple questions. It will greatly help me as a first
time user.

Thanks,
Nithya

can the xbean.wsdl be


-- 
View this message in context: http://www.nabble.com/Example-for-http-provider-su-tp14706426s12049p14706426.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Example for http provider su

Posted by Jeff Yu <je...@gmail.com>.
Hmm... if you want to run those two system tests, it would be better to
download the servicemix source code, which you can see from this link[1].
The better way to get familiar with it is to see the
$SERVICEMIX_HOME/examples/wsdl-first, run this sample need to use maven,
detail instruction you can see from the README file.

1.http://servicemix.apache.org/source.html

On Jan 13, 2008 10:17 AM, nvijayak <nv...@cs.indiana.edu> wrote:

>
>
> Thanks. So these test cases copied at the end of your reply test the main
> wsdl-first service right? I know this will sound like a silly question. I
> am
> not quite sure where I need to place these test cases and how to execute
> them. Does servicemix provide any build script to compile them and to
> execute it? I tried importing into eclipse and launching from there but it
> seems to complain of launch errors. The other option is that I can create
> a
> seperate project completely set the classpath and execute from there. But
> probably there is someway of doing this from servicemix?
>
> Thanks,
> Nithya
>
>
> Jeff Yu wrote:
> >
> > Ok, take a step back, I am thinking you are a bit confused with jbi
> > binding
> > component & service engine.
> > The servicemix-http component is a binding component. Logically, binding
> > component doesn't provide any business logic, it essentially is a birdge
> > to
> > communicate with external service.
> > service-engine provides the business logic in the JBI container, such as
> > servicemix-jsr181 component.
> >
> > couple errors that you made in your example, firstly, it should be
> > xbean.xmlnot
> > xbean.wsdl. 2nd, your HttpProviderService class provides business logic,
> > it
> > should not in the binding component. You can also refer to [1],[2], or
> the
> > $servicemix/examples/wsdl-first and other examples to know better.
> >
> > [1]
> >
> http://svn.apache.org/repos/asf/servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/ProviderEndpointTest.java
> > [2]
> >
> http://svn.apache.org/repos/asf/servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpProviderTest.java
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Example-for-http-provider-su-tp14706426s12049p14781472.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>


-- 
Thanks
Jeff

Re: Example for http provider su

Posted by nvijayak <nv...@cs.indiana.edu>.

Thanks. So these test cases copied at the end of your reply test the main
wsdl-first service right? I know this will sound like a silly question. I am
not quite sure where I need to place these test cases and how to execute
them. Does servicemix provide any build script to compile them and to
execute it? I tried importing into eclipse and launching from there but it
seems to complain of launch errors. The other option is that I can create a
seperate project completely set the classpath and execute from there. But
probably there is someway of doing this from servicemix?

Thanks,
Nithya


Jeff Yu wrote:
> 
> Ok, take a step back, I am thinking you are a bit confused with jbi
> binding
> component & service engine.
> The servicemix-http component is a binding component. Logically, binding
> component doesn't provide any business logic, it essentially is a birdge
> to
> communicate with external service.
> service-engine provides the business logic in the JBI container, such as
> servicemix-jsr181 component.
> 
> couple errors that you made in your example, firstly, it should be
> xbean.xmlnot
> xbean.wsdl. 2nd, your HttpProviderService class provides business logic,
> it
> should not in the binding component. You can also refer to [1],[2], or the
> $servicemix/examples/wsdl-first and other examples to know better.
> 
> [1]
> http://svn.apache.org/repos/asf/servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/ProviderEndpointTest.java
> [2]
> http://svn.apache.org/repos/asf/servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpProviderTest.java
> 
> 

-- 
View this message in context: http://www.nabble.com/Example-for-http-provider-su-tp14706426s12049p14781472.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Example for http provider su

Posted by Jeff Yu <je...@gmail.com>.
Ok, take a step back, I am thinking you are a bit confused with jbi binding
component & service engine.
The servicemix-http component is a binding component. Logically, binding
component doesn't provide any business logic, it essentially is a birdge to
communicate with external service.
service-engine provides the business logic in the JBI container, such as
servicemix-jsr181 component.

couple errors that you made in your example, firstly, it should be xbean.xmlnot
xbean.wsdl. 2nd, your HttpProviderService class provides business logic, it
should not in the binding component. You can also refer to [1],[2], or the
$servicemix/examples/wsdl-first and other examples to know better.

[1]
http://svn.apache.org/repos/asf/servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/ProviderEndpointTest.java
[2]
http://svn.apache.org/repos/asf/servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpProviderTest.java

Re: Example for http provider su

Posted by nvijayak <nv...@cs.indiana.edu>.
Thanks for the link. Some of the wsdl links in that page seem to be missing.
But nevertheless it was quite useful. 

I created a HttpProviderService.java which when invoked will print "Hello
World" in a file. I created the su and the sa and deployed it without any
error. But it doesn't show up on the list of services on
http://localhost:8192. Even when I deploy the example application bridge, it
shows up as a service but doesn't get the wsdl when clicked on. Is this an
installation issue?

Can you please tell me if the following steps are correct (especially the
location of files and dependencies)?

Step 1: Created a http-provider-su using mvn archetype
servicemix-http-provider-endpoint and update pom.xml with dependencies and
xbean.wsdl

My xbean.wsdl:

<beans xmlns:http="http://servicemix.apache.org/http/1.0"
xmlns:ex="http://servicemix.apache.org/example">
  <http:endpoint service="ex:HttpProviderService" endpoint="httpProvider"
role="provider" locationURI="http://localhost:8192/Service/"
defaultMep="http://www.w3.org/2004/08/wsdl/in-out" /> 
  </beans>

Step 2: Implementation of the Service:
http-provider-su/src/main/java/org/apache/servicemix/examples/HttpProviderService.java:

package org.apache.servicemix.examples;

import java.io.File;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.servicemix.http.endpoints.HttpProviderEndpoint;

public class HttpProviderService extends HttpProviderEndpoint{
	
	public void sayHelloWorld() throws Exception{
		File output = new File("C:output.txt");
		FileWriter writer = new FileWriter(output);
		writer.write("Hello World\n");
		writer.close();
	}
}

Step 3:
Created a http-service-sa and added the following dependency:

<dependency> <groupId>org.apache.servicemix.examples</groupId> 
<artifactId>http-provider-su</artifactId> 
<version>1.0-SNAPSHOT</version> </dependency>

Step 4: mvn clean install


Thanks a lot,
Nithya



Jeff Yu wrote:
> 
> Please see http://servicemix.apache.org/servicemix-http.html, it provides
> the answers to your question, I believe.
> 
> 
> On Jan 9, 2008 3:21 PM, nvijayak <nv...@cs.indiana.edu> wrote:
> 
>>
>> Hi,
>>
>> I am looking for an example for http provider su. I am writing a simple
>> example of http-provider using servicemix-http-provider maven archetype.
>> I
>> am not sure if my xbean.wsdl is correct:
>>
>> <beans xmlns:http="http://servicemix.apache.org/http/1.0"
>> xmlns:ex="http://servicemix.apache.org/example">
>>  <http:endpoint service="ex:httpProvider"
>>                        endpoint="soap"
>>                         role="provider"
>> locationURI="http://localhost:8192/httpProvider/"
>> defaultMep="http://www.w3.org/2004/08/wsdl/in-out" soap="true" />
>>  </beans>
>>
>> Do I need to specify a targetService? Does service and targetService have
>> to
>> be the same? Also do I need to specify an endpoint other than soap? If
>> the
>> xbean.wsdl in src/main/resources will it automatically use the class from
>> src/main/java for the service?
>>
>> Sorry for asking many simple questions. It will greatly help me as a
>> first
>> time user.
>>
>> Thanks,
>> Nithya
>>
>> can the xbean.wsdl be
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Example-for-http-provider-su-tp14706426s12049p14706426.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> Thanks
> Jeff
> 
> 

-- 
View this message in context: http://www.nabble.com/Example-for-http-provider-su-tp14706426s12049p14720401.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Example for http provider su

Posted by Jeff Yu <je...@gmail.com>.
Please see http://servicemix.apache.org/servicemix-http.html, it provides
the answers to your question, I believe.


On Jan 9, 2008 3:21 PM, nvijayak <nv...@cs.indiana.edu> wrote:

>
> Hi,
>
> I am looking for an example for http provider su. I am writing a simple
> example of http-provider using servicemix-http-provider maven archetype. I
> am not sure if my xbean.wsdl is correct:
>
> <beans xmlns:http="http://servicemix.apache.org/http/1.0"
> xmlns:ex="http://servicemix.apache.org/example">
>  <http:endpoint service="ex:httpProvider"
>                        endpoint="soap"
>                         role="provider"
> locationURI="http://localhost:8192/httpProvider/"
> defaultMep="http://www.w3.org/2004/08/wsdl/in-out" soap="true" />
>  </beans>
>
> Do I need to specify a targetService? Does service and targetService have
> to
> be the same? Also do I need to specify an endpoint other than soap? If the
> xbean.wsdl in src/main/resources will it automatically use the class from
> src/main/java for the service?
>
> Sorry for asking many simple questions. It will greatly help me as a first
> time user.
>
> Thanks,
> Nithya
>
> can the xbean.wsdl be
>
>
> --
> View this message in context:
> http://www.nabble.com/Example-for-http-provider-su-tp14706426s12049p14706426.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>


-- 
Thanks
Jeff