2014-11-03 96 views
-1

我正在尝试使用IBM Worklight创建SOAP适配器,但我无法获取Web服务方法来运行灯光项目Services文件夹。当我在部署适配器后运行我的项目时,它不会显示正确的输出。让我知道是否有人做过演示或与之相关的一些好的链接。如何使用IBM Worklight 6.2创建SOAPAdater?

+0

@伊丹。为什么你已经投下了这个问题? – 2014-11-03 05:09:31

+0

看到我的回答,我的推理downvote。 – 2014-11-03 05:13:13

回答

1

最后我已经成功消费天气肥皂服务。

下面给出的是连接成功后应该调用的主函数。

function loadContactSuccess(result){ 

    WL.Logger.debug("Device is connected to WL server"); 
    WL.Logger.info("Inside loadContactSuccess"); 

    var list = result.invocationResult.Envelope.Body.GetWeatherInformationResponse.GetWeatherInformationResult.WeatherDescription; 
    console.log("list detail ..." + list); 

    sessionStorage.setItem("WeatherDescription", JSON.stringify(result.invocationResult.Envelope.Body.GetWeatherInformationResponse.GetWeatherInformationResult.WeatherDescription)); 

    WL.Logger.debug("WeatherDescription list :: ", JSON.parse(sessionStorage.getItem("WeatherDescription"))); 

    var tempValue = JSON.parse(sessionStorage.getItem("WeatherDescription")); 

    console.log("Inside loadContactSuccess ..." + tempValue.length); 
    text = ""; 
    var i; 
    for (i = 0; i < tempValue.length; i++) { 
     text += tempValue[i].WeatherID +"  "+"<img src="+ tempValue[i].PictureURL +">" + "<br>"; 
    }  
    document.getElementById("demo").innerHTML = text ;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             

} 

您还可以从URL下载我创建的演示示例。 Click Here

1

你的解释并没有提供你所采取的步骤实际上,也没有预期的输出,你正在使用的服务,你得到的错误等......所以有点难以理解/重现问题...另外,请提及您正在使用的Worklight Studio 6.2安装的版本号码。


本身没有“SOAP适配器”这样的东西。您所指的是通过提供WSDL方案位置生成的“HTTP适配器”。

例如,WebServiceX.net提供global weather service
为了生成从上述适配器:

  1. 创建一个新项目
  2. 在项目结构,在Services文件夹中单击鼠标右键,选择“查询后端服务”
  3. 从“服务类型”下拉列表中,选择“Web服务定义语言(WSDL)”
  4. 在“URL”栏中粘贴“http://www.webservicex.net/globalweather.asmx?WSDL”,然后单击“转到”
  5. 从“选择服务”表中,选择一个服务并点击“完成”

最终结果是适配器文件夹中名为“SoapAdapter1”的新HTTP适配器,其中包含准备使用的自动生成的XML和-impl.js文件。

你可以阅读更多关于它,在这里:

我也建议使用最新的iFix适用于6.2.0.1版本,如它包含一些与WSDL相关的修补程序,因此最好是最新的。

它可以从IBM Fix Central或从Eclipse Marketplace(Eclipse> Help> Marketplace)下载。

+0

@ Idan..thnx for yr answer。我正在获取result.invocationResult.Envelope.Body.GetWeatherInformationResponse的undefined类型。GetWeatherInformationResult.WeatherDescription.WeatherID ...我正在使用http://wsf.cdyne.com/WeatherWS/Weather.asmx。 – 2014-11-03 10:13:31

+0

@nitishpatel你可以粘贴生成的适配器JS代码(例如SoapAdapter1-impl.js? – yossile 2014-11-03 11:25:06

+0

@ yossile..Thnx帮助..我已经解决了这个问题。 – 2014-11-03 11:27:01

相关问题