2015-07-13 34 views
-1

我有一个肥皂调用。当我打电话给我时,我得到了405错误。任何人都可以解决这个问题..这将是非常有益的,我很新的肥皂呼吁。 请你帮助我,不标记这个问题为重复的,我检查过..没有使用如何使用javascript或jquery进行soap调用。我在执行我的代码时遇到了405错误

POST /axis/services/G2A_PhoneMode HTTP/1.1 
Content-Length: 609 
User-Agent: Crosscheck Networks SOAPSonar 
Content-Type: text/xml; charset=utf-8 
SOAPAction: "" 


<?xml version="1.0" encoding="utf-8"?> 
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns0="G2A_Sessions"> 
    <soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> 
     <tns0:logon> 
      <loginId xsi:type="xsd:string">[email protected]</loginId> 
      <password xsi:type="xsd:string">somePassword</password> 
      <version xsi:type="xsd:long">1</version> 
     </tns0:logon> 
    </soap:Body> 
</soap:Envelope> 

function logOnAgent() { 
 
    var xmlhttp = new XMLHttpRequest(); 
 
    xmlhttp.open('POST', 'https://broker.gotoassist.com/axis/services/G2A_PhoneMode', true); 
 
    var xml_string = '<\?xml version="1.0" encoding="utf-8"?>' 
 
         + '<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns0="G2A_Sessions">' 
 
         + '<soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">' 
 
         + '<tns0:logon>' 
 
         + '<loginId xsi:type="xsd:string">[email protected]</loginId>' 
 
         + '<password xsi:type="xsd:string">myPassword</password>' 
 
         + '<version xsi:type="xsd:long">1</version>' 
 
         + '</tns0:logon>' 
 
         + '</soap:Body>' 
 
         + '</soap:Envelope>'; 
 
    
 
    xmlhttp.setRequestHeader("Content-Type","text/xml"); 
 
    xmlhttp.send(xml_string); 
 
    console.log(xmlhttp.responseText); 
 
} 
 

 
logOnAgent();

+0

你没有得到你的问题的任何适当的答案吗?然后让我们知道。或者如果您有解决方案,请批准答案。 – bharatpatel

回答

0

@Shubham,请试试这个: -

var aux = document.createElement("textarea"); 
    aux.setAttribute("style", "position:absolute;"); 
    aux.value = "this\nis\na\nstring"; 
    document.body.appendChild(aux);  

这将工作。其实“不透明度:0”这里是原因。只需将其从您的样式属性中删除,它将完美工作。

+0

是的,它是在多行内获取textarea标签,但是当我复制它时,它将进入单行。 – Shubham

+0

'document.execCommand(“copy”); document.body.removeChild(aux);' – Shubham

0

要在TextArea中多行显示文本,您需要使用\ r \ n,并将插入到textarea,检查示例。我使用Jquery,你也可以像我一样使用JavaScript。

$("#a").html("hello\r\ntest\r\nthis")
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
 
<textarea id="a"></textarea>

相关问题