在使用Worklight Application Framework编辑器测试由“从服务创建数据对象”生成的HTTP适配器过程代码时,它会生成以下错误:
如果没有有效的操作参数,则无法处理请求。请 提供有效的肥皂行动。
这是网络服务网址:http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL
程序的调用结果:
{
"Envelope": {
"Body": {
"Fault": {
"Code": {
"Value": "soap:Sender"
},
"Detail": "",
"Reason": {
"Text": {
"CDATA": "Unable to handle request without a valid action parameter. Please supply a valid soap action.",
"lang": "en"
}
}
}
},
"soap": "http:\/\/www.w3.org\/2003\/05\/soap-envelope",
"xsd": "http:\/\/www.w3.org\/2001\/XMLSchema",
"xsi": "http:\/\/www.w3.org\/2001\/XMLSchema-instance"
},
"errors": [
],
"info": [
],
"isSuccessful": true,
"responseHeaders": {
"Cache-Control": "private",
"Content-Length": "500",
"Content-Type": "application\/soap+xml; charset=utf-8",
"Date": "Mon, 28 Apr 2014 07:56:34 GMT",
"Server": "Microsoft-IIS\/7.5",
"X-AspNet-Version": "2.0.50727",
"X-Powered-By": "ASP.NET"
},
"responseTime": 1476,
"statusCode": 500,
"statusReason": "Internal Server Error",
"totalTime": 1477,
"warnings": [
]
}
答案 0 :(得分:1)
对于Worklight的未来版本,正在考虑支持HTTP标头中的SOAP操作。
如果您希望在Worklight Studio v6.1中调用生成的适配器,则必须修改生成的SOAP适配器并手动添加操作头。
例如,要调用 GetWeatherInformation 操作,您可以打开生成的适配器JS文件并添加以下行:
headers = headers || {};
headers.SOAPAction = 'http://ws.cdyne.com/WeatherWS/GetWeatherInformation';
在此函数结束时调用 invokeWebService 之前的 Weather_GetWeatherInformation 函数。