You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by srinivas thallapalli <sr...@gmail.com> on 2011/11/01 16:42:31 UTC

Re: CXF Client issue with upgrade from CXF 2.2.7 to 2.4.2

Hi Dan,

This problem is reproducible with service which takes list as as an
argument. The following is the testcase,

package com.xxxxx.webservice.cxf.service;
public interface IDataTypeTester {
	
	int helloUsers(List<String> users);
}

package com.xxxxx.webservice.cxf.service;
public class DataTypeTesterImpl implements IDataTypeTester {
	
	public int helloUsers(List<String> users) {
    	return users.size();
    }
}

package com.xxxxx.webservice.cxf.server;
public class CXFServer {
	
	public static Server getServer(String host, int port) {
		DataTypeTesterImpl helloworldImpl = new DataTypeTesterImpl();
        ServerFactoryBean svrFactory = new ServerFactoryBean();
        svrFactory.setServiceClass(IDataTypeTester.class);
        svrFactory.setAddress("http://localhost:9000/DataTypeTester");
        svrFactory.setServiceBean(helloworldImpl);        
        svrFactory.setStart(false);
             
        //add logging interceptor
        svrFactory.getInInterceptors().add(new LoggingInInterceptor());
        svrFactory.getOutInterceptors().add(new LoggingOutInterceptor());
                  
        Server server = svrFactory.create();
              return server;
	}
	
	
	public static void startServer(Server server) {
		server.start();
		System.out.println("Server Started...");
	}
	
	public static void stopServer(Server server) {
		server.stop();
		System.out.println("Server Stopped...");
	}

    public static void main(String args[]) throws Exception {
    	Server server = CXFServer.getServer();
    	CXFServer.startServer(server);
    	
        Thread.sleep(5 * 60 * 1000);
        CXFServer.stopServer(server);
    }
}

package com.xxxxx.webservice.cxf.client;
public class CXFClient {
		
	public static void cxf242ProblemTest(String host, int port) throws
Exception {
		JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
	    ClientImpl client =
(ClientImpl)dcf.createClient("http://locahost:9000/DataTypeTester?wsdl");
	    client.getOutInterceptors().add(new LoggingOutInterceptor());
		client.getInInterceptors().add(new LoggingInInterceptor());
			    
		QName opName = new QName("http://service.cxf.webservice.xxxxx.com/",
"helloUsers");
	    BindingOperationInfo boi = 
                               
client.getEndpoint().getEndpointInfo().getBinding().getOperation(opName);
	    BindingMessageInfo inputMessageInfo = boi.getInput();
	    List<MessagePartInfo> parts = inputMessageInfo.getMessageParts();
	    System.out.println(parts);
	    
	    MessagePartInfo partInfo = parts.get(0);
	    Class<?> partClass = partInfo.getTypeClass();
	    Object inputObject = partClass.newInstance();
          * // this inputObject contains attribute as 'arg0S' instead of
'arg0'*
	    
	    //To get properties
	    Field[] fields = partClass.getDeclaredFields();
	    System.out.println(fields[0].getName());
	    
	    
	    List<String> names = new ArrayList<String>();
	    names.add("user1");
	    names.add("user2");
	        
	    PropertyDescriptor namePropertyDescriptor = new
PropertyDescriptor("arg0", partClass);
	    namePropertyDescriptor.getWriteMethod().invoke(inputObject,names);
	       
	    System.out.println("Invoking alert...");
	    Object[] response = client.invoke(boi,inputObject); 
	  	System.out.println(response[0]);
	   	
	}
}




In the above client, at runtime the request object contains 'arg0S' instead
of 'arg0'.
Please let me know, if not clear.

Thanks
Srinivas


--
View this message in context: http://cxf.547215.n5.nabble.com/CXF-Client-issue-with-upgrade-from-CXF-2-2-7-to-2-4-2-tp4845738p4955555.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: CXF Client issue with upgrade from CXF 2.2.7 to 2.4.2

Posted by srinivas thallapalli <sr...@gmail.com>.
Thank you Dan.

--
View this message in context: http://cxf.547215.n5.nabble.com/CXF-Client-issue-with-upgrade-from-CXF-2-2-7-to-2-4-2-tp4845738p5054514.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: CXF Client issue with upgrade from CXF 2.2.7 to 2.4.2

Posted by Daniel Kulp <dk...@apache.org>.
On Monday, December 05, 2011 11:26:59 PM srinivas thallapalli wrote:
> Hi Dan,
> 
> Could you please let me know whether the attached project is sufficient to
> reproduce the problem or any other inputs needed from my side?.

This is due to the fixes put in place for:
https://issues.apache.org/jira/browse/CXF-2907

Basically, 2.4.2 is generating the correct code from what we're expecting it 
to generate for the defaults of the DynamicFactory.   However, due to the bug 
in CXF-2907, the older version of CXF was not enabling the simple binding.

You can turn off the use of the simple binding by doing:
        JaxWsDynamicClientFactory dcf = 
JaxWsDynamicClientFactory.newInstance();
        dcf.setSimpleBindingEnabled(false);


That should generate the old code.

Dan



> 
> Thanks
> 
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/CXF-Client-issue-with-upgrade-from-CXF-2-2-
> 7-to-2-4-2-tp4845738p5051272.html Sent from the cxf-user mailing list
> archive at Nabble.com.
-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com

Re: CXF Client issue with upgrade from CXF 2.2.7 to 2.4.2

Posted by srinivas thallapalli <sr...@gmail.com>.
Hi Dan,

Could you please let me know whether the attached project is sufficient to
reproduce the problem or any other inputs needed from my side?.

Thanks

--
View this message in context: http://cxf.547215.n5.nabble.com/CXF-Client-issue-with-upgrade-from-CXF-2-2-7-to-2-4-2-tp4845738p5051272.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: CXF Client issue with upgrade from CXF 2.2.7 to 2.4.2

Posted by srinivas thallapalli <sr...@gmail.com>.
Hi Dan,

I have created a test project attached the zip.
Please let me know, in case of any issues with project.

Thanks http://cxf.547215.n5.nabble.com/file/n5019554/CXF-Test.zip
CXF-Test.zip 

--
View this message in context: http://cxf.547215.n5.nabble.com/CXF-Client-issue-with-upgrade-from-CXF-2-2-7-to-2-4-2-tp4845738p5019554.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: CXF Client issue with upgrade from CXF 2.2.7 to 2.4.2

Posted by Daniel Kulp <dk...@apache.org>.
Can you create a small testcase as an easy to run zip file or something that 
we can look at?

Dan


On Wednesday, November 16, 2011 10:30:36 PM srinivas thallapalli wrote:
> Anybody faces this issue.
> 
> Thanks
> 
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/CXF-Client-issue-with-upgrade-from-CXF-2-2-
> 7-to-2-4-2-tp4845738p5000264.html Sent from the cxf-user mailing list
> archive at Nabble.com.
-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com

Re: Wrong transport type from SoapBindingInfo when using JMS transport

Posted by Christian Schneider <ch...@die-schneider.net>.
I guess not at all. No idea why Xilais message shows in your thread.

Christian

Am 18.11.2011 11:59, schrieb srinivas thallapalli:
> Hi Christian
>
> How this is related to my issue?.
>
> Thanks
>
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/CXF-Client-issue-with-upgrade-from-CXF-2-2-7-to-2-4-2-tp4845738p5003945.html
> Sent from the cxf-user mailing list archive at Nabble.com.


-- 

Christian Schneider
http://www.liquid-reality.de

Open Source Architect
Talend Application Integration Division http://www.talend.com


Re: Wrong transport type from SoapBindingInfo when using JMS transport

Posted by srinivas thallapalli <sr...@gmail.com>.
Hi Christian

How this is related to my issue?.

Thanks



--
View this message in context: http://cxf.547215.n5.nabble.com/CXF-Client-issue-with-upgrade-from-CXF-2-2-7-to-2-4-2-tp4845738p5003945.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Wrong transport type from SoapBindingInfo when using JMS transport

Posted by Christian Schneider <ch...@die-schneider.net>.
Yes .. I think there is a problem in CXF.

I added an issue for it:
https://issues.apache.org/jira/browse/CXF-3920

Christian

Am 17.11.2011 10:41, schrieb XiLai Dai:
> Hello,
>
> When I added a interceptor try to get something from Message based on the samples/jms_spring_config, I got wrong transport type from SoapBindingInfo.
>
> The implementation of the interceptor like this:
>
> public void handleMessage(Message message) throws Fault {
>
>          if (message.getExchange().getBinding() instanceof SoapBinding) {
>              SoapBinding soapBinding = (SoapBinding)message.getExchange().getBinding();
>              if (soapBinding.getBindingInfo() instanceof SoapBindingInfo) {
>                  SoapBindingInfo soapBindingInfo = (SoapBindingInfo)soapBinding.getBindingInfo();
>                  System.out.println("Transport Type is: " + soapBindingInfo.getTransportURI());
>              }
>          }
> }
>
> The expected string should be:  http://schemas.xmlsoap.org/soap/jms
> But the output is :  http://schemas.xmlsoap.org/soap/http
>
> Is there a problem or I missed something?  Thanks!    (CXF version used is 2.5.0)
>
> Regards
> Xilai


-- 
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
Talend Application Integration Division http://www.talend.com


Wrong transport type from SoapBindingInfo when using JMS transport

Posted by XiLai Dai <xl...@talend.com>.
Hello, 

When I added a interceptor try to get something from Message based on the samples/jms_spring_config, I got wrong transport type from SoapBindingInfo.

The implementation of the interceptor like this: 

public void handleMessage(Message message) throws Fault {

        if (message.getExchange().getBinding() instanceof SoapBinding) {
            SoapBinding soapBinding = (SoapBinding)message.getExchange().getBinding();
            if (soapBinding.getBindingInfo() instanceof SoapBindingInfo) {
                SoapBindingInfo soapBindingInfo = (SoapBindingInfo)soapBinding.getBindingInfo();
                System.out.println("Transport Type is: " + soapBindingInfo.getTransportURI());
            }
        }
}

The expected string should be:  http://schemas.xmlsoap.org/soap/jms
But the output is :  http://schemas.xmlsoap.org/soap/http 

Is there a problem or I missed something?  Thanks!    (CXF version used is 2.5.0)

Regards
Xilai

Re: CXF Client issue with upgrade from CXF 2.2.7 to 2.4.2

Posted by srinivas thallapalli <sr...@gmail.com>.
Anybody faces this issue.

Thanks

--
View this message in context: http://cxf.547215.n5.nabble.com/CXF-Client-issue-with-upgrade-from-CXF-2-2-7-to-2-4-2-tp4845738p5000264.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: CXF Client issue with upgrade from CXF 2.2.7 to 2.4.2

Posted by srinivas thallapalli <sr...@gmail.com>.
Dan, 

Please let me know, if my explanation is not sufficient.

Thanks

--
View this message in context: http://cxf.547215.n5.nabble.com/CXF-Client-issue-with-upgrade-from-CXF-2-2-7-to-2-4-2-tp4845738p4962897.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: CXF Client issue with upgrade from CXF 2.2.7 to 2.4.2

Posted by srinivas thallapalli <sr...@gmail.com>.
I tried with following changes but still the problem reproducible


public interface IDataTypeTester {
	
	String helloWorld(String text);
	@WebResult(name="integer")
	int helloUsers(@WebParam(name="user")List<String> users);

}

package com.savvion.webservice.cxf.service;

@WebService
public class DataTypeTesterImpl implements IDataTypeTester {
	    
    @WebResult(name="integer")
    public int helloUsers(@WebParam(name="user")List<String> users) {
    	return users.size();
    }
}


In Server class 


public static Server getServer() {
           DataTypeTesterImpl helloworldImpl = new DataTypeTesterImpl();
          JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
           svrFactory.setServiceClass(IDataTypeTester.class);
           svrFactory.setAddress("http://localhost:9000/DataTypeTester");
           svrFactory.setServiceBean(helloworldImpl);
           svrFactory.setStart(false);
           //add logging interceptor
          svrFactory.getInInterceptors().add(new LoggingInInterceptor());
          svrFactory.getOutInterceptors().add(new LoggingOutInterceptor());

         Server server = svrFactory.create();
          return server;
 } 

So I am able to see the following

<xs:complexType name="helloUsers">
        <xs:sequence>
                <xs:element maxOccurs="unbounded" minOccurs="0" name="user"
type="xs:string"/>          
       </xs:sequence>
</xs:complexType>


But in the client request class object still having 'users' attribute
instead of 'user'.

Thanks



 

--
View this message in context: http://cxf.547215.n5.nabble.com/CXF-Client-issue-with-upgrade-from-CXF-2-2-7-to-2-4-2-tp4845738p4957653.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: CXF Client issue with upgrade from CXF 2.2.7 to 2.4.2

Posted by Daniel Kulp <dk...@apache.org>.
It looks like you are using the simple frontend on the server and the jaxws 
frontend on the client.   That would be problematic as they have different 
"rules" for mapping from java to wsdl.

I would suggest changing:

ServerFactoryBean svrFactory = new ServerFactoryBean();

to 
JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();

and seeing if that helps.   With that, you can also add @WebParam/@WebResult 
annotations to put more descriptive names in there instead of "arg0".


Dan


On Tuesday, November 01, 2011 8:42:31 AM srinivas thallapalli wrote:
> Hi Dan,
> 
> This problem is reproducible with service which takes list as as an
> argument. The following is the testcase,
> 
> package com.xxxxx.webservice.cxf.service;
> public interface IDataTypeTester {
> 
> 	int helloUsers(List<String> users);
> }
> 
> package com.xxxxx.webservice.cxf.service;
> public class DataTypeTesterImpl implements IDataTypeTester {
> 
> 	public int helloUsers(List<String> users) {
>     	return users.size();
>     }
> }
> 
> package com.xxxxx.webservice.cxf.server;
> public class CXFServer {
> 
> 	public static Server getServer(String host, int port) {
> 		DataTypeTesterImpl helloworldImpl = new DataTypeTesterImpl();
>         ServerFactoryBean svrFactory = new ServerFactoryBean();
>         svrFactory.setServiceClass(IDataTypeTester.class);
>         svrFactory.setAddress("http://localhost:9000/DataTypeTester");
>         svrFactory.setServiceBean(helloworldImpl);
>         svrFactory.setStart(false);
> 
>         //add logging interceptor
>         svrFactory.getInInterceptors().add(new LoggingInInterceptor());
>         svrFactory.getOutInterceptors().add(new LoggingOutInterceptor());
> 
>         Server server = svrFactory.create();
>               return server;
> 	}
> 
> 
> 	public static void startServer(Server server) {
> 		server.start();
> 		System.out.println("Server Started...");
> 	}
> 
> 	public static void stopServer(Server server) {
> 		server.stop();
> 		System.out.println("Server Stopped...");
> 	}
> 
>     public static void main(String args[]) throws Exception {
>     	Server server = CXFServer.getServer();
>     	CXFServer.startServer(server);
> 
>         Thread.sleep(5 * 60 * 1000);
>         CXFServer.stopServer(server);
>     }
> }
> 
> package com.xxxxx.webservice.cxf.client;
> public class CXFClient {
> 
> 	public static void cxf242ProblemTest(String host, int port) throws
> Exception {
> 		JaxWsDynamicClientFactory dcf = 
JaxWsDynamicClientFactory.newInstance();
> 	    ClientImpl client =
> (ClientImpl)dcf.createClient("http://locahost:9000/DataTypeTester?wsdl");
> 	    client.getOutInterceptors().add(new LoggingOutInterceptor());
> 		client.getInInterceptors().add(new LoggingInInterceptor());
> 
> 		QName opName = new QName("http://service.cxf.webservice.xxxxx.com/",
> "helloUsers");
> 	    BindingOperationInfo boi =
> 
> client.getEndpoint().getEndpointInfo().getBinding().getOperation(opName);
> 	    BindingMessageInfo inputMessageInfo = boi.getInput();
> 	    List<MessagePartInfo> parts = inputMessageInfo.getMessageParts();
> 	    System.out.println(parts);
> 
> 	    MessagePartInfo partInfo = parts.get(0);
> 	    Class<?> partClass = partInfo.getTypeClass();
> 	    Object inputObject = partClass.newInstance();
>           * // this inputObject contains attribute as 'arg0S' instead of
> 'arg0'*
> 
> 	    //To get properties
> 	    Field[] fields = partClass.getDeclaredFields();
> 	    System.out.println(fields[0].getName());
> 
> 
> 	    List<String> names = new ArrayList<String>();
> 	    names.add("user1");
> 	    names.add("user2");
> 
> 	    PropertyDescriptor namePropertyDescriptor = new
> PropertyDescriptor("arg0", partClass);
> 	    namePropertyDescriptor.getWriteMethod().invoke(inputObject,names);
> 
> 	    System.out.println("Invoking alert...");
> 	    Object[] response = client.invoke(boi,inputObject);
> 	  	System.out.println(response[0]);
> 
> 	}
> }
> 
> 
> 
> 
> In the above client, at runtime the request object contains 'arg0S' instead
> of 'arg0'.
> Please let me know, if not clear.
> 
> Thanks
> Srinivas
> 
> 
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/CXF-Client-issue-with-upgrade-from-CXF-2-2-
> 7-to-2-4-2-tp4845738p4955555.html Sent from the cxf-user mailing list
> archive at Nabble.com.
-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog
Talend - http://www.talend.com