We have couple of MS based web-services, visible as .asmx?WSDL links in intranet. There is no problem when this webservices are consumed with latest Visual Studio. All business objects make sense. I suspect that Microsoft uses some secret handshake when ServiceReference is consumed and relies on some proprietary knowledge about what actual CSharp type is behind element typed as <s:schema>
But our department needs to use everything Java. My framework of choice is CXF (v.2.4.2) and it works well with Eclipse, SOAP-UI, Tomcat. And there are problems with interoperability. First, every wsdl have to be amended by hand. All <s:schema> <s:any> are replaced with single <s:any>
. After this CXF can finish generating client side Java. But the Java objects are not the business kind of POJOs. They are some kind of DOM Elements, like
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <any/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"any"
})
public static class GetDepartmentsResult {
@XmlAnyElement(lax = true)
protected Object any;
/**
* Gets the value of the any property.
*
* @return
* possible object is
* {@link Object }
*
*/
public Object getAny() {
return any;
}
/**
* Sets the value of the any property.
*
* @param value
* allowed object is
* {@link Object }
*
*/
public void setAny(Object value) {
this.any = value;
}
}
When the code is tested in runtime, everything works OK. But every object must be treated as DOM element. I am sure that I made a mistake somewhere by removing <s:schema>
or when used wsld2java, so it lost semantics. But what should I do exactly in CXF, to make Java classes to look as clean as CSharp ones ?
Thank you.
Edit: got some clues at http://msdn.microsoft.com/en-us/magazine/cc188755.aspx , I hope this link will be valid at later time, when someone search for the same answer. Other way to find article is:
MSDN Magazine > Issues > 2003 > April > The XML Files: Web Services and DataSets
Answer: impossible.
After exaustive research it is obvious that Business POJOs are impossible to reconstruct on client, when service side has no Business CSharp objects. That simple.
In my particular situation:
In future, the best scenario is: