最简单的SOAP示例

编程入门 行业动态 更新时间:2024-10-09 01:17:56
本文介绍了最简单的SOAP示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

使用Javascript的最简单的SOAP示例是什么?

What is the simplest SOAP example using Javascript?

为了尽可能有用,答案应该是:

To be as useful as possible, the answer should:

  • 功能正常(换句话说实际工作)
  • 发送至少一个可在代码中其他位置设置的参数
  • 处理至少一个可在代码中其他位置读取的结果值
  • 使用大多数现代浏览器版本
  • 同样清楚尽可能短,不使用外部库
  • Be functional (in other words actually work)
  • Send at least one parameter that can be set elsewhere in the code
  • Process at least one result value that can be read elsewhere in the code
  • Work with most modern browser versions
  • Be as clear and as short as possible, without using an external library
推荐答案

这是最简单的JavaScript SOAP客户端我可以创造。

This is the simplest JavaScript SOAP Client I can create.

<html> <head> <title>SOAP JavaScript Client Test</title> <script type="text/javascript"> function soap() { var xmlhttp = new XMLHttpRequest(); xmlhttp.open('POST', 'somesoapurl/', true); // build SOAP request var sr = '<?xml version="1.0" encoding="utf-8"?>' + '<soapenv:Envelope ' + 'xmlns:xsi="www.w3/2001/XMLSchema-instance" ' + 'xmlns:api="127.0.0.1/Integrics/Enswitch/API" ' + 'xmlns:xsd="www.w3/2001/XMLSchema" ' + 'xmlns:soapenv="schemas.xmlsoap/soap/envelope/">' + '<soapenv:Body>' + '<api:some_api_call soapenv:encodingStyle="schemas.xmlsoap/soap/encoding/">' + '<username xsi:type="xsd:string">login_username</username>' + '<password xsi:type="xsd:string">password</password>' + '</api:some_api_call>' + '</soapenv:Body>' + '</soapenv:Envelope>'; xmlhttp.onreadystatechange = function () { if (xmlhttp.readyState == 4) { if (xmlhttp.status == 200) { alert('done. use firebug/console to see network response'); } } } // Send the POST request xmlhttp.setRequestHeader('Content-Type', 'text/xml'); xmlhttp.send(sr); // send request // ... } </script> </head> <body> <form name="Demo" action="" method="post"> <div> <input type="button" value="Soap" onclick="soap();" /> </div> </form> </body> </html> <!-- typo -->

更多推荐

最简单的SOAP示例

本文发布于:2023-11-28 08:02:53,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1641585.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:最简单   示例   SOAP

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!