Hallo,
ich habe in NetBeans folgenden Webservice erstellt:
Wie man sieht ist der Rückgabewert eine Ableitung von ReturnMeParent. Beim Client kommt jedoch nur
an, ich benötige jedoch die komplette Hirachie. Appserver ist Glassfish v2.1, IDE NetBeans. Wie bekomme ich das dem Server/Client/WSDL (oder wer auch immer dafür verantwortlich ist) beigebracht?
Gruß
Christian
Edith sagt:
Die WSDL scheint korrekt zu sein (die extension Base ist eingetragen), das Problem liegt wohl in der Clientgenerierung.
ich habe in NetBeans folgenden Webservice erstellt:
Code:
package helloservice.endpoint;
import javax.jws.WebMethod;
import javax.jws.WebService;
import values.ReturnMe;
@WebService
public class Hello {
@WebMethod
public ReturnMe getReturnValue() {
return new ReturnMe(1);
}
}
Code:
package values;
public class ReturnMe extends ReturnMeParent {
private int x;
public ReturnMe() {
super.setA(5);
}
public ReturnMe(int x) {
this();
this.x = x;
}
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
}
Code:
package values;
public class ReturnMeParent {
private int a;
public int getA() {
return a;
}
public void setA(int a) {
this.a = a;
}
}
Code:
package helloservice.endpoint;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for returnMe complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="returnMe">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="x" type="{http://www.w3.org/2001/XMLSchema}int"/>
* <element name="y" type="{http://www.w3.org/2001/XMLSchema}int"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "returnMe", propOrder = {
"x",
"y"
})
public class ReturnMe {
protected int x;
protected int y;
/**
* Gets the value of the x property.
*
*/
public int getX() {
return x;
}
/**
* Sets the value of the x property.
*
*/
public void setX(int value) {
this.x = value;
}
/**
* Gets the value of the y property.
*
*/
public int getY() {
return y;
}
/**
* Sets the value of the y property.
*
*/
public void setY(int value) {
this.y = value;
}
}
Gruß
Christian
Edith sagt:
Die WSDL scheint korrekt zu sein (die extension Base ist eingetragen), das Problem liegt wohl in der Clientgenerierung.
Code:
<!--
Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.3.1-hudson-749-SNAPSHOT.
-->
−
<xs:schema version="1.0" targetNamespace="http://endpoint.helloservice/">
<xs:element name="getReturnValue" type="tns:getReturnValue"/>
<xs:element name="getReturnValueResponse" type="tns:getReturnValueResponse"/>
−
<xs:complexType name="getReturnValue">
<xs:sequence/>
</xs:complexType>
−
<xs:complexType name="getReturnValueResponse">
−
<xs:sequence>
<xs:element name="return" type="tns:returnMe" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
−
<xs:complexType name="returnMe">
−
<xs:complexContent>
−
<xs:extension base="tns:returnMeParent">
−
<xs:sequence>
<xs:element name="x" type="xs:int"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
−
<xs:complexType name="returnMeParent">
−
<xs:sequence>
<xs:element name="a" type="xs:int"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
Zuletzt bearbeitet: