小编ste*_*fan的帖子

C#中的Soap请求

我有一个肥皂请求,我用http和javascript编写,但我似乎无法正确地将其转换为C#.

原件:(作品)

<button onclick="doStuff()" type="submit">Send</button>

<textarea name="REQUEST_DATA" cols=120 rows=17 >
<?xml version="1.0" encoding="UTF-8"?> 
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<createModifyRequest>
<username>josephs</username>
<lookupIds>
<lookupIds>4225</lookupIds><!--firepass-->
</lookupIds>
</createModifyRequest>
</soap:Body>
</soap:Envelope>
</textarea>

<script language="javascript"> 

function doStuff() {

var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP.3.0");

xmlhttp.open("POST", "http://tpdev-itreq.transpower.co.nz:7777/usr/services/CreateModifyRequest", false);
xmlhttp.setRequestHeader("SOAPAction", "createModifyRequest");

var userpass = "josephs" + ":" + "pass";
xmlhttp.setRequestHeader("Authorization", "Basic " + (userpass));

xmlhttp.setRequestHeader("Content-Type", "text/xml");
xmlhttp.send(REQUEST_DATA.value);

}
Run Code Online (Sandbox Code Playgroud)

用C#转换(不起作用)

private void button1_Click(object sender, EventArgs e)
{
    string soap =@"<?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>
    <createModifyRequest>
        <username>josephs</username>
        <lookupIds>
            <lookupIds>4225</lookupIds> …
Run Code Online (Sandbox Code Playgroud)

javascript c# xml soap visual-studio

9
推荐指数
1
解决办法
1373
查看次数

ie8中的getElementsByClassName

我正在尝试在Internet Explorer 8中为我的HTML创建一个可折叠列表:

<li>
 <a href="#" onclick="test('node1')">hello</a>
 <ul id="node1" class="node" style="display:none">
   <li>Sub-item 1</li>
   <li>Sub-item 2</li>
 </ul>
</li>
<li>
 <a href="#" onclick="test('node2')">test</a>
  <ul id="node2" class="node" style="display:none">
   <li>Sub-item 1</li>
   <li>Sub-item 2</li>
 </ul>
</li>
Run Code Online (Sandbox Code Playgroud)

在javascript我有

function test2(className, link) {
 var e = document.getElementsByClassName(className);

 for (var i = 0, len = e.length; i < len; i++) {
   e[i].style.display = "none";
  }

  link.innerHTML = "Expand";
 }
Run Code Online (Sandbox Code Playgroud)

我用它来称呼它:

      <a href="#" onclick="test2('node', this)">Collapse</a>
Run Code Online (Sandbox Code Playgroud)

不幸的是,这种方法在IE8中不起作用,也没有querySelectAll.有人可以提供一个例子来解决这个问题吗?

html javascript css internet-explorer-8

2
推荐指数
2
解决办法
2万
查看次数

标签 统计

javascript ×2

c# ×1

css ×1

html ×1

internet-explorer-8 ×1

soap ×1

visual-studio ×1

xml ×1