【问题标题】:Processmaker Web Service in C#C# 中的 Processmaker Web 服务
【发布时间】:2018-03-19 16:35:47
【问题描述】:

我有网络服务

http://sandbox3.processmaker.com/sysworkflow/en/neoclassic/services/wsdl2

登录的php实现

<?PHP
    /*webservice connection NOTE: Replace this WebAddress with your instance*/
    $client = new SoapClient('http://sandbox3.processmaker.com/sysworkflow/en/neoclassic/services/wsdl2');
    $params = array(array('userid'=>'admin', 'password'=>'processmaker'));
    $result = $client->__SoapCall('login', $params);

    /*webservice validate connection: begin*/
    if($result->status_code == 0){
        p("Connection Successful!");
        p("Session ID: " . $result->message);
        $session = $result->message;
?>

我需要在 C# 中调用这个 Web 服务

我创建项目,点击项目名称并添加服务参考

命名为SR_Processmaker

我使用下面的代码来获取sessionId

using Processmaker_Webservice.SR_Processmaker;
string userId = "1234567892";
                string password = "123456789";
                loginRequest login = new loginRequest(userId,password);

登录时只需用户 ID 和密码。

XML 是

<xs:schema elementFormDefault="qualified" targetNamespace="http://www.processmaker.com">
<xs:element name="login">
<xs:complexType>
<xs:sequence>
<xs:element name="userid" type="xs:string"/>
<xs:element name="password" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="loginResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="status_code" type="xs:integer"/>
<xs:element name="message" type="xs:string"/>
<xs:element name="version" type="xs:string"/>
<xs:element name="timestamp" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>

任何使用 processmaker 网络服务的人请帮助我。我是新手,需要你的帮助。

提前谢谢。

【问题讨论】:

  • 不幸的是你没有提到实际的问题是什么;-)
  • 如何从 loginRequest 方法获得响应,我什么都得不到。

标签: c# wcf processmaker


【解决方案1】:

您实际上还没有调用该服务。所以缺少的是相当于那个 PHP 行:$result = $client-&gt;__SoapCall('login', $params);

所以你需要实例化一个服务客户端并交出loginRequest

string userId = "1234567892";
string password = "123456789";
var loginRequest = new loginRequest(userId, password);

var proxy = new ProcessMakerServiceSoapClient();
var loginResult = proxy.loginAsync(loginRequest);
var result = loginResult.Result;

proxy.Close();

【讨论】:

  • 感谢 Khlr,它的工作。要么它给我状态码3,登录失败,但至少我知道如何消费。非常感谢:)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2010-09-06
相关资源
最近更新 更多