Question

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>
 * &lt;complexType>
 *   &lt;complexContent>
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       &lt;sequence>
 *         &lt;any/>
 *       &lt;/sequence>
 *     &lt;/restriction>
 *   &lt;/complexContent>
 * &lt;/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

Was it helpful?

Solution

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:

  • CXF 2.4.2 wsdl2java consuming ASMX ASP.NET will give s:schema error: FAIL
  • SOAPUI with CXF 2.4.2 will FAIL for same reason
  • Oracle Sun Metro Glassfish 3.1 wsimport consuming ASMX ASP.NET will need a local copies of schemas: PASS (but needs a local copy of WSDL, and still no business objects)

In future, the best scenario is:

  • Oracle Sun WSIT Tango consumes Microsoft WCF service with extra "secret handshake" to deliver some metainformation both during consume-time and run-time.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top