In your binding element, try going directly to the service endpoint, like this: 

           <binding.ws
                
wsdlElement="http://prova.netbureau.it/#wsdl.port(provaWSService/provaWSPort)"
                 uri="http://localhost:8080/ProvaWS/provaWS"/>

-----Original Message-----
From: ytrewq2...@libero.it [mailto:ytrewq2...@libero.it] 
Sent: Friday, October 23, 2009 04:26
To: user
Cc: user
Subject: problem: reference to jax-ws external web service (calling it)
Importance: High

ok,
 
 i have modified the client:
 
 ProvaWS provaws = ((Client)node).getService(ProvaWS.class, 
"ProvaWSExtService"); <- the component name not the name of the serviceClass

 but now i have a strange exception, a null pointer exception:

> Exception in thread "main" java.lang.reflect.InvocationTargetException
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:597)
>         at 
> org.apache.tuscany.sca.launcher.LauncherMain.invokeMainMethod(LauncherMain.java:114)
>         at 
> org.apache.tuscany.sca.launcher.LauncherMain.main(LauncherMain.java:55)
> Caused by: java.lang.NullPointerException
>         at 
> org.apache.tuscany.sca.binding.ws.axis2.Axis2BindingInvoker.createOperationClient(Axis2BindingInvoker.java:276)
>         at 
> org.apache.tuscany.sca.binding.ws.axis2.Axis2BindingInvoker.invokeTarget(Axis2BindingInvoker.java:138)
>         at 
> org.apache.tuscany.sca.binding.ws.axis2.Axis2BindingInvoker.invoke(Axis2BindingInvoker.java:119)
>         at 
> org.apache.tuscany.sca.core.databinding.wire.DataTransformationInterceptor.invoke(DataTransformationInterceptor.java:72)
>         at 
> org.apache.tuscany.sca.core.invocation.impl.JDKInvocationHandler.invoke(JDKInvocationHandler.java:302)
>         at 
> org.apache.tuscany.sca.core.invocation.impl.JDKInvocationHandler.invoke(JDKInvocationHandler.java:167)
>         at $Proxy16.addws(Unknown Source)
>         at it.netbureau.prova.ProvaWSImpl.addws(ProvaWSImpl.java:24)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:597)
>         at 
> org.apache.tuscany.sca.implementation.java.invocation.JavaImplementationInvoker.invoke(JavaImplementationInvoker.java:136)
>         at 
> org.apache.tuscany.sca.core.databinding.wire.PassByValueInterceptor.invoke(PassByValueInterceptor.java:61)
>         at 
> org.apache.tuscany.sca.binding.sca.provider.SCABindingInvoker.invoke(SCABindingInvoker.java:61)
>         at 
> org.apache.tuscany.sca.core.databinding.wire.PassByValueInterceptor.invoke(PassByValueInterceptor.java:61)
>         at 
> org.apache.tuscany.sca.core.invocation.impl.JDKInvocationHandler.invoke(JDKInvocationHandler.java:302)
>         at 
> org.apache.tuscany.sca.core.invocation.impl.JDKInvocationHandler.invoke(JDKInvocationHandler.java:167)
>         at $Proxy16.addws(Unknown Source)
>         at TuscanyClient.Tuscanyclient.main(Tuscanyclient.java:44)
 
 and so another reflection error...
 
 WHAT's wrong now?? :( :''(
 

this is my composite file:

<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903";
           targetNamespace="http://sample";
           xmlns:sample="http://sample";
           xmlns:wsdli="http://www.w3.org/2004/08/wsdl-instance";
           name="SCAExample">


    <!-- external web service JAX-WS -->
    <component name="ProvaWSExtService">
        <implementation.java class="it.netbureau.prova.ProvaWSImpl"/>
        <reference name="ProvaWSService">
           <binding.ws
                
wsdlElement="http://prova.netbureau.it/#wsdl.port(provaWSService/provaWSPort)"
                 
wsdli:wsdlLocation="http://localhost:8080/ProvaWS/provaWS?wsdl"/>
        </reference>  
    </component>
 thanks

and class that implemtent the interface of service  that esposes remoted 
services(ProvaWs):

@Service(ProvaWS.class)
public class ProvaWSImpl implements ProvaWS{

    @Reference
    public ProvaWS ProvaWSService;

    public Integer addws(int num1, int num2) {
        System.out.println("***ProvaWSService is " + ProvaWSService);
        return ProvaWSService.addws(num1, num2);
    }

}
If something miss, see my mails above:

> ---------- Initial Header -----------
> 
> From      : "ytrewq2...@libero.it" ytrewq2...@libero.it
> To          : "user" user@tuscany.apache.org
> Cc          : "user" user@tuscany.apache.org,"luckbr1975" 
> luckbr1...@gmail.com,"user" user@tuscany.apache.org
> Date      : Thu, 22 Oct 2009 11:01:35 +0200
> Subject : Re:problem: reference to jax-ws external web service (calling it)
> 
> 
> 
> 
> 
> 
> 
> > sorry
> >  the name of the service means:
> > 
> > 1) the name of tag components in composite file? 
> > or 
> > 2) the name of tag service in a composite file?
> >  or 
> > 3)the name of Service class generated with wsimport that give me the port 
> > to ws? 
> > 
> > i'm confused..
> > 
> > my code used the 3
> > 
> > Node node = Node.getInstance... 
> > 
> > provaws = ((Client)node).getService(ProvaWS.class, "ProvaWSService");
> > 
> > ProvaWS is the interface of jax-ws web service (generated by ws monitor) 
> > and ProvaWSService is right?
> > 
> > above the error give me by tuscany:
> > it's a reflection error..
> > 
> > > ok
> > > 
> > > i try as you suggest me (see the above response, here)
> > > but now i give me an error of service unavailable. The service is alive 
> > > and the wsdl url is correct. 
> > > The error is " java.lang.reflect.InvocationTargetException Caused by: 
> > > org.oasisopen.sca.ServiceUnavailableException: The service ProvaWSService 
> > > has not been contributed to the domain" as you can see above. but i can't 
> > > understand what mean..the web service try to call is an external web 
> > > service running in tomcat..
> > > anny suggest please? 
> > > 
> > > thank you
> > > 
> > > 22-ott-2009 10.01.43 org.apache.tuscany.sca.node.impl.NodeImpl start
> > > INFO: Starting node: http://tuscany.apache.org/sca/1.1/nodes/default
> > > 22-ott-2009 10.01.44 org.apache.tuscany.sca.node.impl.NodeFactoryImpl 
> > > configureNode
> > > INFO: Loading contribution: 
> > > file:/C:/Documents%20and%20Settings/portoni.NETBUREAU/Documenti/NetBeansProjects/SCAExternalWS2/ANT_TUSCANY_RUNNER/sample-invoking-Provaws.jar
> > > 22-ott-2009 10.01.46 
> > > org.apache.tuscany.sca.endpoint.impl.EndpointRegistryImpl addEndpoint
> > > INFO: EndpointRegistry: Add endpoint - Endpoint:  URI = 
> > > ProvaWSExtService#service-binding(ProvaWS/ProvaWS)
> > > 22-ott-2009 10.01.46 
> > > org.apache.tuscany.sca.endpoint.impl.EndpointRegistryImpl 
> > > addEndpointReference
> > > INFO: EndpointRegistry: Add endpoint reference - Endpoint Reference:  URI 
> > > = ProvaWSExtService#reference-binding(ProvaWSService/ProvaWSService) 
> > > Target = Endpoint: 
> > > Exception in thread "main" java.lang.reflect.InvocationTargetException
> > >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > >         at 
> > > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> > >         at 
> > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> > >         at java.lang.reflect.Method.invoke(Method.java:597)
> > >         at 
> > > org.apache.tuscany.sca.launcher.LauncherMain.invokeMainMethod(LauncherMain.java:114)
> > >         at 
> > > org.apache.tuscany.sca.launcher.LauncherMain.main(LauncherMain.java:55)
> > > Caused by: org.oasisopen.sca.ServiceUnavailableException: The service 
> > > ProvaWSService has not been contributed to the domain
> > >         at 
> > > org.apache.tuscany.sca.node.impl.NodeImpl.getServiceReference(NodeImpl.java:172)
> > >         at 
> > > org.apache.tuscany.sca.node.impl.NodeImpl.getService(NodeImpl.java:138)
> > >         at TuscanyClient.Tuscanyclient.main(Tuscanyclient.java:41)
> > >         ... 6 more
> > > 
> > > 
> > > 
> > > ---------- Initial Header -----------
> > > 
> > > From      : "Luciano Resende" luckbr1...@gmail.com
> > > To          : user@tuscany.apache.org
> > > Cc          : 
> > > Date      : Wed, 21 Oct 2009 08:07:30 -0700
> > > Subject : Re: reference to jax-ws external web service (calling it)
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > > On Wed, Oct 21, 2009 at 2:28 AM, ytrewq2...@libero.it
> > > > <ytrewq2...@libero.it> wrote:
> > > > > Now i have this kind of problem give me by tuscany:
> > > > >
> > > > > GRAVE: Reference not found for component reference: Component = 
> > > > > ProvaWSService Reference = ProvaWSService
> > > > > 21-ott-2009 11.15.35 
> > > > > org.apache.tuscany.sca.assembly.builder.impl.CompositeBindingURIBuilderImpl
> > > > > GRAVE: Reference not found for component reference: Component = 
> > > > > ProvaWSService Reference = ProvaWSService
> > > > > 21-ott-2009 11.15.35 
> > > > > org.apache.tuscany.sca.assembly.builder.impl.ComponentReferenceWireBuilderImpl
> > > > > AVVERTENZA: No targets for reference: Composite = 
> > > > > {http://sample}Calculator Reference = ProvaWS
> > > > > 21-ott-2009 11.15.35 
> > > > > org.apache.tuscany.sca.assembly.builder.impl.ComponentReferenceEndpointReferenceBuilderImpl
> > > > > AVVERTENZA: No targets for reference: Composite = 
> > > > > {http://sample}Calculator Reference = ProvaWS
> > > > > 21-ott-2009 11.15.35 
> > > > > org.apache.tuscany.sca.binding.ws.wsdlgen.BindingWSDLGenerator
> > > > > AVVERTENZA: Unable to generate WSDL for ProvaWSService/ProvaWSService
> > > > > 21-ott-2009 11.15.35 
> > > > > org.apache.tuscany.sca.binding.ws.wsdlgen.BindingWSDLGenerator
> > > > > GRAVE: No interface contract for ProvaWSService/ProvaWSService
> > > > > Exception in thread "main" java.lang.reflect.InvocationTargetException
> > > > >        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > > > > ...
> > > > >
> > > > > What's wrong
> > > > >
> > > > > i semplified my project.. I have an exteernal webservice running in 
> > > > > tomcat with class ProvaWs that contain a webmethod. Interface 
> > > > > generated by wsimport is ProvaWs and the Service is ProvaWsservice
> > > > >
> > > > > this mean that i have a client with jax-ws, i get service instance x 
> > > > > and x.getProvaWsPort() give me the stub class (remote class ProvaWs) 
> > > > > whose interface is ProvaWs. Calling then remote method add(@WebMethod 
> > > > > definition).
> > > > >
> > > > > I add this: A ProvaWsImpl class that implements ProvaWs interface 
> > > > > (linke in Wehater ws example: 
> > > > > https://svn.apache.org/repos/asf/tuscany/branches/sca-java-1.x/samples/zipcode-jaxws/).
> > > > > This is my composite:
> > > > >
> > > > > <composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903";
> > > > >           targetNamespace="http://sample";
> > > > >           xmlns:sample="http://sample";
> > > > >           xmlns:wsdli="http://www.w3.org/2004/08/wsdl-instance";
> > > > >           name="Calculator">
> > > > >
> > > > >
> > > > > <!-- external web service JAX-WS -->
> > > > > <component name="ProvaWSService">
> > > > >        <implementation.java
> > > > >          class="it.netbureau.prova.ProvaWSImpl"/>
> > > > >        <reference name="ProvaWSService">
> > > > >           <binding.ws
> > > > >                wsdlElement="http://prova.netbureau.it
> > > > >                 /#wsdl.port(provaWSService/provaWSPort)"
> > > > >                 wsdli:wsdlLocation="http://localhost:8080
> > > > >                 /ProvaWS/provaWS?wsdl"/>
> > > > >        </reference>
> > > > >    </component>
> > > > >
> > > > > </composite>
> > > > >
> > > > > I pass my reference in :
> > > > >
> > > > > @Service(ProvaWS.class)
> > > > > public class ProvaWSImpl implements ProvaWS{
> > > > >
> > > > >   �...@reference
> > > > >    public ProvaWS ProvaWS;
> > > > >
> > > > >    public Integer addws(int num1, int num2) {
> > > > >        return ProvaWS.addws(num1, num2);
> > > > >    }
> > > > >
> > > > > What's wrong? I should implement an interface also for 
> > > > > ProvaWsService??? :| :(
> > > > >
> > > > > thank you!
> > > > > Roby
> > > > >
> > > > >
> > > > 
> > > > You reference name
> > > > 
> > > > <reference name="ProvaWSService">
> > > > 
> > > > Should match you reference variable
> > > > 
> > > >    @Reference
> > > >    public ProvaWS ProvaWS;
> > > > 
> > > > so it should be
> > > > 
> > > >    @Reference
> > > >    public ProvaWS ProvaWSService;
> > > > 
> > > > 
> > > > -- 
> > > > Luciano Resende
> > > > http://people.apache.org/~lresende
> > > > http://lresende.blogspot.com/
> > > > 
> > > 
> > > 
> > 
> > 
> 
> 

Reply via email to