Parse.com 与 WSDL 通信 [英] Parse.com to communicate with WSDL

查看:25
本文介绍了Parse.com 与 WSDL 通信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能在云代码中调用WSDL"方法?

Is there any possibility to call "WSDL" method in cloud code ?

例如,有一个WSDL"网络服务,我想检查其中是否有新数据,如果有,我想向用户发送推送通知.我明白了逻辑,但我在 parse.com 文档中找不到任何关于WSDL"的信息.

for example, there is a "WSDL" web service and i want to check if there is an new data in it and if there is i want to send push notification to user. I got the logic, but i could not find any information about "WSDL" in parse.com documentation.

这没有帮助:

Parse.Cloud.httpRequest({
  url: 'https://services.rs.ge/WayBillService/WayBillService.asmx',
  params: {
    su : 'test1'
  },
  success: function(httpResponse) {
    console.log(httpResponse.text);
  },
  error: function(httpResponse) {
    console.error('Request failed with response code ' + httpResponse.status);
  }
});

推荐答案

当然可以,现在,首先我们需要弄清楚一些事情.

Sure you can, now, first we need to get a few things straight.

WSDL 只是服务的定义Web 服务描述语言"

WSDL is just the definition of the services "Web Services Description Language"

您在这里谈论的是 SOAP简单对象访问协议"

You are talking SOAP here "Simple Object Access Protocol"

如果你去https://services.rs.ge/WayBillService/WayBillService.asmx 在您的浏览器中,您将看到可用的方法/SOAPAction 列表,如果单击它们,您将看到如何调用该方法的示例.

If you go to https://services.rs.ge/WayBillService/WayBillService.asmx in your browser, you will se a list of methods/SOAPActions that are available to you and if you click them, you will see an example of how to call the method.

例如,get_server_time、https://services.rs.ge/WayBillService/WayBillService.asmx?op=get_server_time

For example, get_server_time, https://services.rs.ge/WayBillService/WayBillService.asmx?op=get_server_time

示例如何调用 get_server_time:

Example how to call get_server_time:

Parse.Cloud.job('soap', function(request, status) {
    var Buffer = require('buffer').Buffer,
        buffer = new Buffer(
            '<?xml version="1.0" encoding="utf-8"?>' +
            '<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">' +
            '   <soap12:Body>' +
            '       <get_server_time xmlns="http://tempuri.org/" />' +
            '   </soap12:Body>' +
            '</soap12:Envelope>'
        );

    Parse.Cloud.httpRequest({
        method: 'POST',
        url: 'https://services.rs.ge/WayBillService/WayBillService.asmx',
        headers: {
            'Content-Type': 'text/xml; charset=utf-8'
        },
        body: buffer,
        success: function(httpResponse) {
            status.success(httpResponse.text);
        },
        error: function(httpResponse) {
            status.error('Request failed with response code ' + httpResponse.status);
        }
    });
});

这篇关于Parse.com 与 WSDL 通信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆