You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by Janko Heilgeist <ja...@scai.fraunhofer.de> on 2008/11/12 13:53:28 UTC

Deploying a self-referencing web service

Hi,

I currently try to develop a web service that is supposed to contact
other web service instances of the same port type at remote locations. I
started with a WSDL and would like to have as much code generated by
Geronimo as possible. My problem is, that I can't specify the
<soap:address location=""/> value of a service. This value is
automatically patched into the WSDL during deployment of the web service
implementation by Geronimo. Unfortunately, the generated client stub
seems to read the WSDL from its own module file and therefore receives
the unpatched version. This leads to a failure of the deployment process.

Therefore, I played around with alternatives that might allow me to
deploy the client without a reference to the WSDL. E.g.

@Stateless
@WebService(
serviceName="MyService", portName="MyServicePort",
endpointInterface="com.heilgeist.tests.tst_ws_annotations.ws_ejb.MyServiceInterface",

targetNamespace="http://heilgeist.com/tests/tst-ws-annotations/service")
public class MyServiceEJBImpl implements MyServiceInterface {
    @WebServiceRef(name="service/AnotherMyWebService")
    private MyServiceInterface myService;

    public void doSomething(int counter) {
        if (counter > 0) {
            BindingProvider bp = (BindingProvider) myService;
            // the address will come from a DB in the real service
            bp.getRequestContext().put(
                BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
                "http://localhost:9090/MyWebService");
            myService.doSomething(--counter);
        }
    }

}

ejb-jar.xml:
<session>
    <ejb-name>MyWebService</ejb-name>
    <ejb-class>
        com.heilgeist.tests.tst_ws_annotations.ws_ejb.MyServiceEJBImpl
    </ejb-class>

    <service-ref>
        <service-ref-name>service/AnotherMyWebService</service-ref-name>
        <service-interface>javax.xml.ws.Service</service-interface>
    </service-ref>
</session>

This set-up works fine as long as only a single web service is packaged
in the EJB-JAR. As soon as I put a second (completely independent) web
service in the same module, the deployment process aborts with

com.heilgeist.tests.tst_ws_annotations.ws_ejb.MyServiceInterface does
not extend javax.xml.rpc.Service or javax.xml.ws.Service

So it looks like Geronimo is guessing some missing information, that it
can no longer guess with two services. Any ideas on how to solve this?

Regards, Janko


Re: Deploying a self-referencing web service

Posted by Janko Heilgeist <ja...@scai.fraunhofer.de>.
Hi again,

finally, I solved my problem. If I change the @WebServiceRef and add the
parameter "value=javax.xml.ws.Service.class", then everything works as
expected. But why doesn't Geronimo take this value from the deployment
descriptor's <service-interface/> tag? Isn't the container supposed to
join information from annotations and deployment descriptor files?

Regards, Janko

Janko Heilgeist wrote:
> Hi,
> 
> I currently try to develop a web service that is supposed to contact
> other web service instances of the same port type at remote locations. I
> started with a WSDL and would like to have as much code generated by
> Geronimo as possible. My problem is, that I can't specify the
> <soap:address location=""/> value of a service. This value is
> automatically patched into the WSDL during deployment of the web service
> implementation by Geronimo. Unfortunately, the generated client stub
> seems to read the WSDL from its own module file and therefore receives
> the unpatched version. This leads to a failure of the deployment process.
> 
> Therefore, I played around with alternatives that might allow me to
> deploy the client without a reference to the WSDL. E.g.
> 
> @Stateless
> @WebService(
> serviceName="MyService", portName="MyServicePort",
> endpointInterface="com.heilgeist.tests.tst_ws_annotations.ws_ejb.MyServiceInterface",
> 
> targetNamespace="http://heilgeist.com/tests/tst-ws-annotations/service")
> public class MyServiceEJBImpl implements MyServiceInterface {
>     @WebServiceRef(name="service/AnotherMyWebService")
>     private MyServiceInterface myService;
> 
>     public void doSomething(int counter) {
>         if (counter > 0) {
>             BindingProvider bp = (BindingProvider) myService;
>             // the address will come from a DB in the real service
>             bp.getRequestContext().put(
>                 BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
>                 "http://localhost:9090/MyWebService");
>             myService.doSomething(--counter);
>         }
>     }
> 
> }
> 
> ejb-jar.xml:
> <session>
>     <ejb-name>MyWebService</ejb-name>
>     <ejb-class>
>         com.heilgeist.tests.tst_ws_annotations.ws_ejb.MyServiceEJBImpl
>     </ejb-class>
> 
>     <service-ref>
>         <service-ref-name>service/AnotherMyWebService</service-ref-name>
>         <service-interface>javax.xml.ws.Service</service-interface>
>     </service-ref>
> </session>
> 
> This set-up works fine as long as only a single web service is packaged
> in the EJB-JAR. As soon as I put a second (completely independent) web
> service in the same module, the deployment process aborts with
> 
> com.heilgeist.tests.tst_ws_annotations.ws_ejb.MyServiceInterface does
> not extend javax.xml.rpc.Service or javax.xml.ws.Service
> 
> So it looks like Geronimo is guessing some missing information, that it
> can no longer guess with two services. Any ideas on how to solve this?
> 
> Regards, Janko
>