soap xml 到 JS 变量

问题描述 投票:0回答:0

与邮递员一起,我从 wsdl url 得到响应,我得到的 soap 响应都很好,现在我需要使用网站上的数据,这样我就可以将用户输入的数据与我得到的响应进行比较,我设法得到使用 php-curl

在我的网页上的响应
 <?php
 $curl = curl_init();

curl_setopt_array($curl, array(
 CURLOPT_URL => "https://www.dataaccess.com/webservicesserver/numberconversion.wso?WSDL=",
CURLOPT_RETURNTRANSFER => true,
 CURLOPT_CUSTOMREQUEST => "POST",
 CURLOPT_POSTFIELDS =>   "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" 
      xmlns:web=\"http://www.dataaccess.com/webservicesserver/\">\n   
  <soapenv:Header/>\n   
  <soapenv:Body>\n      
        <web:NumberToWords>\n         
          <ubiNum>100</ubiNum>\n      
        </web:NumberToWords>\n   
  </soapenv:Body>\n
    </soapenv:Envelope>",
 CURLOPT_HTTPHEADER => array("content-type: text/xml"),
 ));

   $response = curl_exec($curl);
     $err = curl_error($curl);

    curl_close($curl);

   if ($err) {
     echo "cURL Error #:" . $err;
 } else {
  echo $response;
}

 ?>

输出

     <soap-env:envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<soap-env:header>
 <soap-env:body>
  <n0:zfi_mf_ws_consulta_clienteresponse xmlns:n0="urn:sap-com:document:sap:rfc:functions">
  <e_datos>
    <kunnrdf>123</kunnr>
    <name1>name</name1>
<land1>VE</land1>
   <stras>street</stras>
   <ort01>SAN FRANCISCO</ort01>
   <telf1>0261-215012</telf1>
   <stcd1>J-0701721725-7</stcd1>
     <stcd1_sg>J07017252252177</stcd1_sg>
 <smtp_addr>[email protected]</smtp_addr>
<tatyp_1>Flete</tatyp_1>
    <taxkd_1>0</taxkd_1>
   <tatyp_2> Producto</tatyp_2>
<taxkd_2>1</taxkd_2>
  </e_datos>
  <e_respuesta>
  <tipo>
  <clase>
   <nro>000</nro>
  <mensaje></mensaje>
</clase>
</tipo>
  </e_respuesta>
  </n0:zfi_mf_ws_consulta_clienteresponse></soap-env:body>
</soap-env:header>
</soap-env:envelope>

如何仅获取值,然后用它与另一个数据进行比较以查看它是否匹配,另外我需要所有其余的用于其他用途(用 js 放入输入字段)

谢谢

javascript jquery xml soap xml-parsing
© www.soinside.com 2019 - 2024. All rights reserved.