cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From palos01 <vybi...@gmail.com>
Subject Re: CXF Data Binding
Date Mon, 01 Jun 2009 15:49:04 GMT

Hi Dan,

   I do not generate client code (via wsdl2java tool) - I use approach
described at http://cwiki.apache.org/CXF20DOC/jax-ws-configuration.html
chapter "Configuring a Spring Client (Option 1)". Please note that on the
server side I am not allowed to use CXF framework (there is default WebLogic
10 WS stack). The client code is very simple

ApplicationContext ctx = new ClassPathXmlApplicationContext("appCtx.xml");
Client cs = (Client) ctx.getBean("client");
		
ClientDOM cdm = new ClientDOM();
cdm.setName("Lenka");
cdm.setSurname("Leb");
String result = cs.addClient(cdm);

The server side is following

interface:

package cz.palos.test;
import javax.jws.*;
import java.util.*;
import cz.palos.test.dom.*;


@WebService(name="Client", targetNamespace="http://test.palos.cz/")
public interface Client {
	
	public String sayHello(String message);
	
	public ClientDOM createClient(String name, String surname, Date born);
	
	public String addClient(ClientDOM cDom);
}

implementation:

package cz.palos.test.impl;
import java.util.Date;
import javax.jws.*;
import weblogic.jws.WLHttpTransport;
import cz.palos.test.Client;
import cz.palos.test.dom.*;

@WebService(serviceName="ClientService", portName="ClientPort",
endpointInterface = "cz.palos.test.Client")
@WLHttpTransport(serviceUri="ClientService")
public class ClientImpl implements Client {
	
	public String sayHello(String message) {
		System.out.println("Got " + message);
		return "Returned echo ::: " + message; 
	}
	
	public ClientDOM createClient(String name, String surname, Date born) {
		ClientDOM c = new ClientDOM();
		System.out.println("Got name ::: " + name + " " + surname + " " + born);
		c.setName(name);
		c.setSurname(surname);
		c.setBorn(born);
		return c;
	}
	
	public String addClient(ClientDOM cDom) {
		System.out.println("Got add client ::: " + cDom.getName());
		return "done";
	}
}

ClientDOM object

package cz.palos.test.dom;

import java.io.Serializable;
import java.util.Date;

public class ClientDOM implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private String name;

	private String surname;

	private Date born;

	public Date getBorn() {
		return born;
	}

	public void setBorn(Date born) {
		this.born = born;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getSurname() {
		return surname;
	}

	public void setSurname(String surname) {
		this.surname = surname;
	}
}


Many thanks for your help & regards,

palos






dkulp wrote:
> 
> 
> How did you generate the code for the client?    It really looks "strange"
> as 
> the "cDom" doesn't even have "name" or "surname" elements.   They are
> "Name" 
> and "Surname".    Thus, I'm not sure how it's possible that CXF is
> generating 
> that when using the normal JAXB databinding.    Note: it's also missing a 
> "Born" element which is minOccurs=1.   Thus, it SHOULD be there, even if
> it's 
> null.
> 
> In anycase, could you include the code for the call to addClient from your 
> Client java code?   I'd like to see how you are setting up the object
> model 
> for the parameters.
> 
> Dan
> 
> 
> On Sat May 30 2009 5:46:13 am palos01 wrote:
>> Hi all,
>>
>>   I am new to CXF and I am facing following problem - I would like to
>> create CXF client for the WS running in the deafalt WS stack in WebLogic
>> 10
>> server. But I have a proble to transfer complex Java object - I suppose
>> this is problem with DataBinding. (Primitive data types are transfered
>> without problems.) Technically there is not needed namespace for the Java
>> complex types.
>>
>> The WSDL is following
>> http://www.nabble.com/file/p23791869/clientService.wsdl
>> clientService.wsdl
>>
>> My configuration of CXF is following (via Spring)
>> http://www.nabble.com/file/p23791869/appCtx.xml appCtx.xml
>>
>> Current request generated via CXF (method addClient in WSDL) is following
>> (please note missing namespace java:cz.palos.test.dom for the XML tags
>> name
>> and surname)
>> http://www.nabble.com/file/p23791869/addClientCall.xml addClientCall.xml
>>
>> Have you an idea how should I change the configuration to get the
>> namespace
>> on the right place.
>>
>> Many thanks in advance.
>>
>> Regars,
>> P.
> 
> -- 
> Daniel Kulp
> dkulp@apache.org
> http://www.dankulp.com/blog
> 
> 

-- 
View this message in context: http://www.nabble.com/CXF-Data-Binding-tp23791869p23817179.html
Sent from the cxf-user mailing list archive at Nabble.com.


Mime
View raw message