"Remote procedure call" by couple JaxWsProxyFactoryBean and 
JaxWsServerFactoryBean doesnt work.
-----------------------------------------------------------------------------------------------

                 Key: CXF-2665
                 URL: https://issues.apache.org/jira/browse/CXF-2665
             Project: CXF
          Issue Type: Bug
          Components: JAX-WS Runtime
    Affects Versions: 2.2.6
            Reporter: Jara Cesnek
            Priority: Critical


Problem is that "remote procedure call" by couple JaxWsProxyFactoryBean and 
JaxWsServerFactoryBean doesnt work.
Methods from client (remote) interface return null values.

Reason: server leaks namespace from service implementation (not only interface) 
.. so client can read data and return null

Server code:
{code}
        JaxWsServerFactoryBean serverFactoryBean = new JaxWsServerFactoryBean();
        
serverFactoryBean.setServiceClass(AopUtils.getTargetClass(implementor)); 
//WSImpl.class
        serverFactoryBean.setServiceBean(implementor);                          
                        //WSImpl.class
        serverFactoryBean.setDataBinding(new AegisDatabinding());
        serverFactoryBean.setAddress(url);
        serverFactoryBean.setBus(cxfServlet.getBus());
        serverFactoryBean.create();
{code}

Client code:
{code}
            JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
            factory.setServiceClass(resultInterfaceClass);                      
           //WS.class
            factory.setAddress(asURL);
            factory.setDataBinding(new AegisDatabinding());
            Object remoteInterfaceImpl = factory.create();
{code}

Interface:
{code}
@WebService(name="datove_zdroje", 
targetNamespace="http://v1_0_0.ws.doc.daisy.marbes.cz";)
public interface WS {
           List<String> getCodes(@WebParam(name = "baseCode") String baseCode);
}
{code}

Implementation:
{code}
@WebService(serviceName = "datove_zdroje", endpointInterface = 
"cz.marbes.daisy.modules.doc.ws.v1_0_0.WS")
public class WSImpl implements WS {

    @Override
    public List<String> getCodes(final String baseCode) {
        return new ArrayList<String>();
    }
}
{code}

*In this configuration client always receive "NULL" from method call !*

Problem is that server include in WSDL(and XML communication) namespace from 
service implementation (WSImpl.java) - not only from (client) interface 
(WS.java).
In this particular case servers "targetNamespace" is empty. So server made it 
up from class and package name. But client has only information from interface.

Client anticipate that "ServiceNamespace" is equals with "targetNamespace" from 
interface (WS.java) WebService annotation.  

*Working WSImpl.java:*
{code}
@WebService(serviceName = "datove_zdroje", endpointInterface = 
"cz.marbes.daisy.modules.doc.ws.v1_0_0.WS", 
*targetNamespace="http://v1_0_0.ws.doc.daisy.marbes.cz"* //must be same as 
WS.java targetNamespace
)
public class WSImpl implements WS {
{code}

*NON-Working WSImpl.java:*
{code}
@WebService(serviceName = "datove_zdroje", endpointInterface = 
"cz.marbes.daisy.modules.doc.ws.v1_0_0.WS", 
*targetNamespace=""* //empty or other than WS.java targetNamespace
)
public class WSImpl implements WS {
{code}


We need clarify real meaning of @WebService(targetNamespace="") on service 
implementation.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to