You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 10, 2023. It is now read-only.
This is a simple jax-ws bottom-up WebService implementation that produces a bug in Metro 2.3.
The issue occurs when a WCF consumer class receives an object from the endpoint that contains a nested class instance whose name matches that of the class: it comes back null.
When sayHelloWorld method below sends the Hello object back to WCF consumer, its "world" member variable is null.
**MetroHelloImpl.java**package com.michaelt.ws;
import javax.jws.WebService;
@WebService(endpointInterface="com.michaelt.ws.MetroHello")
public class MetroHelloImpl implements MetroHello {
@Override
public Hello getNewHello() {
return new Hello();
}
@Override
public Hello sayHelloWorld(Hello pHello) {
pHello.world.message = "Hello World";
return pHello;
}
}
The problem arises when there is a nested class instance whose name matches the class like the example of "World world" below.
**Hello.java**package com.michaelt.ws;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class Hello {
// The endpoint will always return this as null public World world = new World();
}
When "world" is renamed to anything else, it does not return null.
**World.java**package com.michaelt.ws;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class World {
public String message;
}
Cause
Metro 2.3 vs. Metro 2.0.1
In this scenario, the cause of the problem can be found in the .xsd's generated by Metro. This issue doesn't exist in older Metro versions, and it has to do with the xml definition of the nested class being referenced in version 2.3. Notice the difference inside the body of the tag between the two versions.
Summary
MetroHello WebService
This is a simple jax-ws bottom-up WebService implementation that produces a bug in Metro 2.3.
The issue occurs when a WCF consumer class receives an object from the endpoint that contains a nested class instance whose name matches that of the class: it comes back null.
When sayHelloWorld method below sends the Hello object back to WCF consumer, its "world" member variable is null.
The problem arises when there is a nested class instance whose name matches the class like the example of "World world" below.
When "world" is renamed to anything else, it does not return null.
Cause
Metro 2.3 vs. Metro 2.0.1
In this scenario, the cause of the problem can be found in the .xsd's generated by Metro. This issue doesn't exist in older Metro versions, and it has to do with the xml definition of the nested class being referenced in version 2.3. Notice the difference inside the body of the tag between the two versions.
The ref attribute in 2.3 is possibly confused by member variable "world"?
Environment
Windows 8.1 Pro, Java 1.7.0, Metro 2.3
Affected Versions
[2.3]
The text was updated successfully, but these errors were encountered: