You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Aurora82 <be...@hotmail.com> on 2007/07/23 19:49:46 UTC

(Newbie) Problem with annotated Pojos

Hi,
I'm new to ServiceMix and tried to get the following scenario working with
ServiceMix 3.1.1:

-I have an HTTP-SU
-I have a JSR181-SU for an annotated Pojo
-I have a SA, that has both SUs as its dependencies

Now, my problem is that under the url specified
(http://localhost:8192/test/main.wsdl) the annotated Pojo does not show its
WSDL. Also, I cannot contact the service. Did I miss anything anywhere that
prevents the WSDL from showing?

Here are my service units:

xbean.xml of test-http-SU:
<beans xmlns:http="http://servicemix.apache.org/http/1.0"
       xmlns:test="http://test.com/testService">

  <http:endpoint service="test:TestService"
                 endpoint="soap"
                 role="consumer" 
                 locationURI="http://localhost:8192/test/"
                 defaultMep="http://www.w3.org/2004/08/wsdl/in-out"
                 soap="true" />             

</beans>

xbean.xml of test-jsr181-SU:
<beans xmlns:jsr181="http://servicemix.apache.org/jsr181/1.0">

    <jsr181:endpoint pojoClass="group1.TestService" />

</beans>

annotated Pojo of test-jsr181-SU:
package group1;

import javax.jws.WebMethod;
import javax.jws.WebService;

@WebService(name = "TestService", targetNamespace =
"http://test.com/testService")
public class TestService {

	@WebMethod
	public String sayHello(String name) {
		return "Hello "+name;
	}
}


I also made sure I have both SUs mentioned as dependencies in the
corresponding SA:
.
.
.
            <dependency>
      <groupId>group1</groupId>
      <artifactId>test-http-SU</artifactId>
      <version>1.0-SNAPSHOT</version>
    </dependency>
    <dependency>
      <groupId>group1</groupId>
      <artifactId>test-jsr181-SU</artifactId>
      <version>1.0-SNAPSHOT</version>
    </dependency>
.
.
.

Any ideas are greatly appreciated =)
Cheers,
Aurora
-- 
View this message in context: http://www.nabble.com/%28Newbie%29-Problem-with-annotated-Pojos-tf4131288s12049.html#a11749032
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: (Newbie) Problem with annotated Pojos

Posted by sachin2008 <es...@gmail.com>.
It is not like that you have to specify the same service and endpoint of both
HTTP and JSR.
You can also use other attributes like targetService and targetEndpoint.


Aurora82 wrote:
> 
> Hi,
> I'm new to ServiceMix and tried to get the following scenario working with
> ServiceMix 3.1.1:
> 
> -I have an HTTP-SU
> -I have a JSR181-SU for an annotated Pojo
> -I have a SA, that has both SUs as its dependencies
> 
> Now, my problem is that under the url specified
> (http://localhost:8192/test/main.wsdl) the annotated Pojo does not show
> its WSDL. Also, I cannot contact the service. Did I miss anything anywhere
> that prevents the WSDL from showing?
> 
> Here are my service units:
> 
> xbean.xml of test-http-SU:
> <beans xmlns:http="http://servicemix.apache.org/http/1.0"
>        xmlns:test="http://test.com/testService">
> 
>   <http:endpoint service="test:TestService"
>                  endpoint="soap"
>                  role="consumer" 
>                  locationURI="http://localhost:8192/test/"
>                  defaultMep="http://www.w3.org/2004/08/wsdl/in-out"
>                  soap="true" />             
> 
> </beans>
> 
> xbean.xml of test-jsr181-SU:
> <beans xmlns:jsr181="http://servicemix.apache.org/jsr181/1.0">
> 
>     <jsr181:endpoint pojoClass="group1.TestService" />
> 
> </beans>
> 
> annotated Pojo of test-jsr181-SU:
> package group1;
> 
> import javax.jws.WebMethod;
> import javax.jws.WebService;
> 
> @WebService(name = "TestService", targetNamespace =
> "http://test.com/testService")
> public class TestService {
> 
> 	@WebMethod
> 	public String sayHello(String name) {
> 		return "Hello "+name;
> 	}
> }
> 
> 
> I also made sure I have both SUs mentioned as dependencies in the
> corresponding SA:
> .
> .
> .
>             <dependency>
>       <groupId>group1</groupId>
>       <artifactId>test-http-SU</artifactId>
>       <version>1.0-SNAPSHOT</version>
>     </dependency>
>     <dependency>
>       <groupId>group1</groupId>
>       <artifactId>test-jsr181-SU</artifactId>
>       <version>1.0-SNAPSHOT</version>
>     </dependency>
> .
> .
> .
> 
> Any ideas are greatly appreciated =)
> Cheers,
> Aurora
> 

-- 
View this message in context: http://www.nabble.com/%28Newbie%29-Problem-with-annotated-Pojos-tp11749032s12049p14749344.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: (Newbie) Problem with annotated Pojos

Posted by Aurora82 <be...@hotmail.com>.
Thanks a lot, that did it :-)


Gert Vanthienen wrote:
> 
> Aurora,
> 
> 
> The service and endpoint name on the HTTP consumer endpoint should match
> the service and endpoint name on the JSR-181 endpoint.  If you would
> connect to ServiceMix using JMX, you would notice that the default
> endpoint name on an annotated JSR-181 webservice isn't "soap", but
> "JBIServicePort" (or something like it, you'll have to check it).
> 
> You either have to specify this name as the endpoint attribute on your
> http consumer configuration or add a portName to the @WebService
> annotation:
>    @WebService(name="TestService",
> targetNamespace="http://test.com/testService", portName="soap") 
> 
>    public class TestService {
> 
> 
> Cheers,
> 
> Gert
> 
> 
> 
> 
> Aurora82 wrote:
>> 
>> Hi,
>> I'm new to ServiceMix and tried to get the following scenario working
>> with ServiceMix 3.1.1:
>> 
>> -I have an HTTP-SU
>> -I have a JSR181-SU for an annotated Pojo
>> -I have a SA, that has both SUs as its dependencies
>> 
>> Now, my problem is that under the url specified
>> (http://localhost:8192/test/main.wsdl) the annotated Pojo does not show
>> its WSDL. Also, I cannot contact the service. Did I miss anything
>> anywhere that prevents the WSDL from showing?
>> 
>> Here are my service units:
>> 
>> xbean.xml of test-http-SU:
>> <beans xmlns:http="http://servicemix.apache.org/http/1.0"
>>        xmlns:test="http://test.com/testService">
>> 
>>   <http:endpoint service="test:TestService"
>>                  endpoint="soap"
>>                  role="consumer" 
>>                  locationURI="http://localhost:8192/test/"
>>                  defaultMep="http://www.w3.org/2004/08/wsdl/in-out"
>>                  soap="true" />             
>> 
>> </beans>
>> 
>> xbean.xml of test-jsr181-SU:
>> <beans xmlns:jsr181="http://servicemix.apache.org/jsr181/1.0">
>> 
>>     <jsr181:endpoint pojoClass="group1.TestService" />
>> 
>> </beans>
>> 
>> annotated Pojo of test-jsr181-SU:
>> package group1;
>> 
>> import javax.jws.WebMethod;
>> import javax.jws.WebService;
>> 
>> @WebService(name = "TestService", targetNamespace =
>> "http://test.com/testService")
>> public class TestService {
>> 
>> 	@WebMethod
>> 	public String sayHello(String name) {
>> 		return "Hello "+name;
>> 	}
>> }
>> 
>> 
>> I also made sure I have both SUs mentioned as dependencies in the
>> corresponding SA:
>> .
>> .
>> .
>>             <dependency>
>>       <groupId>group1</groupId>
>>       <artifactId>test-http-SU</artifactId>
>>       <version>1.0-SNAPSHOT</version>
>>     </dependency>
>>     <dependency>
>>       <groupId>group1</groupId>
>>       <artifactId>test-jsr181-SU</artifactId>
>>       <version>1.0-SNAPSHOT</version>
>>     </dependency>
>> .
>> .
>> .
>> 
>> Any ideas are greatly appreciated =)
>> Cheers,
>> Aurora
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/%28Newbie%29-Problem-with-annotated-Pojos-tf4131288s12049.html#a11752362
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: (Newbie) Problem with annotated Pojos

Posted by Gert Vanthienen <ge...@skynet.be>.
Aurora,


The service and endpoint name on the HTTP consumer endpoint should match the
service and endpoint name on the JSR-181 endpoint.  If you would connect to
ServiceMix using JMX, you would notice that the default endpoint name on an
annotated JSR-181 webservice isn't "soap", but "JBIServicePort" (or
something like it, you'll have to check it).

You either have to specify this name as the endpoint attribute on your http
consumer configuration or add a portName to the @WebService annotation:
   @WebService(name="TestService",
targetNamespace="http://test.com/testService", portName="soap") 

   public class TestService {


Cheers,

Gert




Aurora82 wrote:
> 
> Hi,
> I'm new to ServiceMix and tried to get the following scenario working with
> ServiceMix 3.1.1:
> 
> -I have an HTTP-SU
> -I have a JSR181-SU for an annotated Pojo
> -I have a SA, that has both SUs as its dependencies
> 
> Now, my problem is that under the url specified
> (http://localhost:8192/test/main.wsdl) the annotated Pojo does not show
> its WSDL. Also, I cannot contact the service. Did I miss anything anywhere
> that prevents the WSDL from showing?
> 
> Here are my service units:
> 
> xbean.xml of test-http-SU:
> <beans xmlns:http="http://servicemix.apache.org/http/1.0"
>        xmlns:test="http://test.com/testService">
> 
>   <http:endpoint service="test:TestService"
>                  endpoint="soap"
>                  role="consumer" 
>                  locationURI="http://localhost:8192/test/"
>                  defaultMep="http://www.w3.org/2004/08/wsdl/in-out"
>                  soap="true" />             
> 
> </beans>
> 
> xbean.xml of test-jsr181-SU:
> <beans xmlns:jsr181="http://servicemix.apache.org/jsr181/1.0">
> 
>     <jsr181:endpoint pojoClass="group1.TestService" />
> 
> </beans>
> 
> annotated Pojo of test-jsr181-SU:
> package group1;
> 
> import javax.jws.WebMethod;
> import javax.jws.WebService;
> 
> @WebService(name = "TestService", targetNamespace =
> "http://test.com/testService")
> public class TestService {
> 
> 	@WebMethod
> 	public String sayHello(String name) {
> 		return "Hello "+name;
> 	}
> }
> 
> 
> I also made sure I have both SUs mentioned as dependencies in the
> corresponding SA:
> .
> .
> .
>             <dependency>
>       <groupId>group1</groupId>
>       <artifactId>test-http-SU</artifactId>
>       <version>1.0-SNAPSHOT</version>
>     </dependency>
>     <dependency>
>       <groupId>group1</groupId>
>       <artifactId>test-jsr181-SU</artifactId>
>       <version>1.0-SNAPSHOT</version>
>     </dependency>
> .
> .
> .
> 
> Any ideas are greatly appreciated =)
> Cheers,
> Aurora
> 

-- 
View this message in context: http://www.nabble.com/%28Newbie%29-Problem-with-annotated-Pojos-tf4131288s12049.html#a11751731
Sent from the ServiceMix - User mailing list archive at Nabble.com.