1
여기에 무슨 일을하고 있는지 보는 사람이 있습니까? Im은 ASP 사이트에서이 스크립트를 사용하려고합니다. $ z : value [article.number]는 내 ASP에있는 내 art.number입니다. 내 기사를 클릭하면 사진이 보입니다.자바 스크립트에 SOAP 게시
안부 프랭크
<script type="text/javascript">
var symbol = "MSFT";
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("POST", "http://produktinfo.byggtjeneste.no/ProduktInfo.asmx?op=HentBildeLenkeTyped",true);
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState == 4) {
alert(xmlhttp.responseText);
var json = XMLObjectifier.xmlToJSON(xmlhttp.responseXML);
var result = json.Body[0].HentBildeLenkeTypedResponse[0].HentBildeLenkeTypedResult[0].Text;
json = XMLObjectifier.xmlToJSON(XMLObjectifier.textToXML(result));
alert(SModulNr + ' ProduktInfo: $' + json.Stock[0].Last[0].Text);
}
}
xmlhttp.setRequestHeader("SOAPAction", "http://produktinfo.byggtjeneste.no/HentBildeLenkeTyped");
xmlhttp.setRequestHeader("Content-Type", "text/xml");
var xml = '<?xml version="1.0" encoding="utf-8"?>' +
'<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' +
'xmlns:xsd="http://www.w3.org/2001/XMLSchema" ' +
'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">' +
'<soap:Body> ' +
'<HentBildeLenkeTyped xmlns="http://produktinfo.byggtjeneste.no/"> ' +
'<sModulNr> + $z:value[article.number] + </sModulNr> '+
'<iSize>xlarge</iSize> '+
'</HentBildeLenkeTyped> ' +
'</soap:Body> ' +
'</soap:Envelope>';
xmlhttp.send(xml);
</script>
이 내 업체에서 orginal 한 것입니다. 당신이 잘못 어디로 가는지
POST /ProduktInfo.asmx HTTP/1.1
Host: produktinfo.byggtjeneste.no
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<HentBildeLenkeTyped xmlns="http://produktinfo.byggtjeneste.no/">
<sModulNr>string</sModulNr>
<iSize>None or small or large or xlarge or original or largeThumbnail</iSize>
</HentBildeLenkeTyped>
</soap12:Body>
</soap12:Envelope>
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<HentBildeLenkeTypedResponse xmlns="http://produktinfo.byggtjeneste.no/">
<HentBildeLenkeTypedResult>string</HentBildeLenkeTypedResult>
</HentBildeLenkeTypedResponse>
</soap12:Body>
</soap12:Envelope>
감사의 라인을 따라하지만 같은 결과 더 많은 것을 원한다. 확인 버튼이있는 대화 상자가 나타나지만 "좋은"것은 아닙니다. 다른 JS에서 $ z : value [article.number]를 사용하면 매력처럼 작동합니다. – Frank
전송중인 정확한 데이터와 수신중인 데이터의 로깅을 시작하십시오. 이것은 당신이 문제의 바닥에 도달하는 데 도움이됩니다. Chrome/Firefox/Safari를 사용하고 있습니까? 그렇다면 코드를 다음과 같이 변경합니다. console.debug (xml); xmlhttp.send (xml); 그러면 보내는 실제 문자열을 검사 할 수 있습니다. 다음은 Chrome에 대한 도움말입니다. https://developers.google.com/chrome-developer-tools/docs/console. 마찬가지로, 결과를 기록하십시오 : (console.debug (xmlhttp.responseText); alert (xmlhttp.responseText);) 그래서 우리는 반환되는 것을 볼 수 있습니다 ... – Nik