1

axis2 と ajax で問題が発生しています。jQuery の ajax 関数を使用して Web サービスの 1 つから xml を取得し、このjquery プラグインを使用して結果の xml を html に変換しています。

サービスが返す関連する xml の例を次に示します。

<ns:getPatientsByDoctorResponse>
    <ns:return type="com.emolst.jdbc.PatientBean">
        <ax23:firstName>Bryce</ax23:firstName>
        <ax23:lastName>Thompson</ax23:lastName>
    </ns:return>
</ns:getPatientsByDoctorResponse>

jQuery ajax 呼び出しから取得した xml Document オブジェクトを調べたところ、タグから名前空間が取り除かれ、タグがすべて小文字になったようです。ただし、xsl テンプレートにタグを認識させることができないようです。

これが私が今xslに持っているものです。

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="html" indent="yes"/>

    <xsl:template match="/">
        <option>success1</option>
        <xsl:apply-templates/>
    </xsl:template>

    <xsl:template match="//return">
        <option>success2</option>
        <option>
            <xsl:value-of select="firstname"/> <xsl:value-of select="lastname"/>
        </option>
    </xsl:template>
</xsl:transform>

私が得ることができる最高のものは、success1 オプションです。axis2 を ajax でより適切にプレイする方法についての情報をここで見つけましたが、それは私が持っている Java サービス クライアントを台無しにする可能性があるようです。

これが問題のJavaScriptです。

$("select[name=patientlist]").transform({
    xml:{
        url:"/axis2/services/PatientService/getPatientsByDoctor",
        data {
            docKey: "6"
        },
        type:"GET",
        dataType:"xml"
    },
    xsl:"xsl/patients-option.xsl"
});

だから私は愚かなことをしていますか、それともこれを行うためのより良い方法はありますか? 助けてくれてありがとう。

4

1 に答える 1