短いチュートリアルhttp://www.javaranch.com/journal/200603/WSComplexTypes.html(axis 1.4、ただしafaik)に従って、特定のJavaクラスを返すWebサービスメソッドを作成したいと思います。Eclipse Juno、Axis2 1.6.2、Tomcat6サーバーを使用しています。
クラスは次のようになります。
public class Person implements Serializable{
/**
*
*/
private static final long serialVersionUID = 1L;
public int id;
public String name;
public String surname;
}
Webメソッドは次のようになります
public Person getPersonDetails(){
Person result = new Person();
result.id = 1;
result.name = "test";
result.surname = "test2";
return result;
}
次に、WSDLを生成してWebサービスをデプロイした後、WSDLファイルは次のようになります。
<xs:schema targetNamespace="http://mycrm/xsd" elementFormDefault="qualified" attributeFormDefault="qualified">
<xs:complexType name="Person">
<xs:sequence/>
</xs:complexType></xs:schema>
..。
<xs:element name="getPersonDetails">
<xs:complexType> <xs:sequence/> </xs:complexType> </xs:element>
<xs:element name="getPersonDetailsResponse"> -<xs:complexType> -<xs:sequence>
<xs:element name="return" type="ax21:Person" nillable="true" minOccurs="0"/>
</xs:sequence> </xs:complexType> </xs:element>
私が理解していることから、PersonクラスはWebサービスにマッピングされていません。呼び出しをテストすると、次のような石鹸の応答のみが返されます。
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ns:getPersonDetailsResponse xmlns:ns="http://mycrm">
<ns:return xmlns:ax21="http://mycrm/xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ax21:Person"/>
</ns:getPersonDetailsResponse>
</soapenv:Body>
</soapenv:Envelope>
だから私の質問は:-データを正しく返すことができるようにWSDLでクラスをマップすることを忘れている簡単なステップがあります-このようなデータを返すのは間違っています-それはXMLまたはJSONスタイルですか?(このWebサービスをAdobe Flexプロジェクトで使用したい)