1

SOAP サービスを呼び出し、それを XQuery を使用して JSON に変換したいのですが、常に結果にエラー トークンがあると表示されます。

これはSOAPです:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
 xmlns:NS1="http://www.inspirejo.com/soapwheather" <soapenv:Body>
  <NS1:wheatherResponse>
     <CountryName>United states</CountryName>
     <countryCode>USA</countryCode>
     <cityCode>NY</cityCode>
     <cityName>New york</cityName>
     <respCode>****************</respCode>
     <minDegree>12</minDegree>
     <maxDegree>21</maxDegree>
     <hummedity>21</hummedity>
     <windspeed>20</windspeed>
  </NS1:wheatherResponse>
</soapenv:Body>
</soapenv:Envelope>

XQuery コード:

    xquery version "1.0";
declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization";
declare namespace xsd = "http://www.w3.org/2001/XMLSchema";
declare namespace soapenv = "http://schemas.xmlsoap.org/soap/envelope/";
declare namespace NS1 = "http://www.inspirejo.com/soapwheather/";
declare option output:method "json";
declare option jsoniq-version "0.4.42";

let $soapresult := soapenv:Envelope/soapenv:Body/NS1:wheatherResponse
return{
    "countryCode" : $soapresult/countryCode,
    "cityCode"    : $soapresult/cityCode,
    "countryName" : $soapresult/countryName,
    "cityName"    : $soapresult/cityName,
    "minDegree"   : $soapresult/minDegree,
    "maxDegree"   : $soapresult/maxDegree,
    "hummedity"   : $soapresult/hummedity,
    "windSpeed"   : $soapresult/windSpeed
}

トークン エラーを修正しましたが、出力はまだで、出力変換は次のとおりです。 illegal character '{' at offset 1 of http://192.168.0.211:12019/inspire/wservice/wheatherRequest?countryCode=USA&cityCode=NY

.{.
    "countryCode" : null,
    "cityCode"    : null,
     "countryName"  : null,
     "cityName"     : null,
     "minDegree"    : null,
     "maxDegree"    :null,
      .. etc. all transformation result is null.
}
4

1 に答える 1