0

I am making a adapter for HTTP soap based invocation, code for invocation is given below while invoking the adapter i am getting error like :"Cannot read property "Body" from undefined" .

SOAPAdapter.xml is:

<wl:adapter xmlns:wl="http://www.worklight.com/integration" xmlns:http="http://www.worklight.com/integration/http" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="SOAPAdapter">

<displayName>SOAPAdapter</displayName>
<description>SOAPAdapter</description>
<connectivity>
    <connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
        <protocol>http</protocol>
        <domain>*.*.com</domain>
        <port>80</port>         
    </connectionPolicy>
    <loadConstraints maxConcurrentConnectionsPerNode="2"/>
</connectivity>

<procedure name="get_soap_req_list"/>

SOAPAdapter-impl.js is:

function get_soap_req_list() {

  var request = 
    '<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>'
            +'<AddList  xmlns="http://schemas.microsoft.com/sharepoint/soap/">'
                +'<listName>tiu</listName>'
                +'<description>uyt</description>'
                +'<templateID>6</templateID>'
            +'</AddList>'
        +'</soap:Body>'
    +'</soap:Envelope>';
WL.Logger.debug("@@@"+request);

            var input = {
                method : 'post',
                returnedContentType : 'xml',
                path : '/_vti_bin/Lists.asmx',
                body : {
                    content: request.toString(),                  
                    contentType: 'text/xml; charset=utf-8'                
                }               

            };
**27**            var result = WL.Server.invokeHttp(input);               
**28**            return result;
}

console error is:

E: An error occurred while invoking procedure SOAPAdapter/get_soap_req_listFWLSE0100E: parameters:{ "arr": [ 9 ] } TypeError: Cannot read property "Body" from undefined (D%3A%5CWorklightworkSpace%5Cmodule_05_2_HTTP_Adapter%5Cadapters%5CSOAPAdapter/SOAPAdapter- impl.js#42) FWLSE0101E: Caused by: null

result OutPut:

{ "errors": [ ], "info": [ ], "isSuccessful": true, "responseHeaders": { "Content-Length": "0", "Date": "Thu, 20 Jun 2013 11:08:03 GMT", "MicrosoftSharePointTeamServices": "14.0.0.6123", "SPRequestGuid": "7a89adce-9ede-4197-bfc4-aff18e85e763", "Server": "Microsoft-IIS/7.5", "WWW-Authenticate": "NTLM", "X-MS-InvokeApp": "1; RequireReadOnly", "X-Powered-By": "ASP.NET" }, "responseTime": 156, "statusCode": 401, "statusReason": "Unauthorized", "text": "", "totalTime": 172, "warnings": [ ] }

4

1 回答 1

0

改为“返回结果;”

输出是什么?

于 2013-06-18T18:08:06.703 回答