由于某种原因,SourceGear在其安装上提供了未公开的Web服务。他们实际上要求开发人员使用API,因为Web服务有点麻烦,但这对我来说是个问题,因为我不能在Perl环境中使用此API,所以他们针对我的特定情况的解决方案是使用Web服务。如何使用SOAP :: Lite访问SourceGear Web服务?
这应该不成问题。使用SOAP::Lite我曾经以同样的方式连接到多个Web服务。但是如果你不知道SOAP调用的位置,缺乏文档是一个主要的混乱。我只有一个XML来解释在哪里以及如何进行这些调用。如果一个真正的SOAP天才能够帮助我解决这个问题,那将是非常棒的。
这是登录调用的例子和预期的响应:
请求
POST /fortress/dragnetwebservice.asmx HTTP/1.1
Host: velecloudserver
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://www.sourcegear.com/schemas/dragnet/LoginPlainText"
<?xml version="1.0" encoding="utf-8"?>
<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>
<LoginPlainText xmlns="http://www.sourcegear.com/schemas/dragnet">
<strLogin>string</strLogin>
<strPassword>string</strPassword>
</LoginPlainText>
</soap:Body>
</soap:Envelope>
响应
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<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>
<LoginPlainTextResponse xmlns="http://www.sourcegear.com/schemas/dragnet">
<LoginPlainTextResult>int</LoginPlainTextResult>
<strAuthTicket>string</strAuthTicket>
</LoginPlainTextResponse>
</soap:Body>
</soap:Envelope>
我正在寻找一种方法能够组装这不知何故。这是我的Perl示例:
my $soap = SOAP::Lite -> uri ('http://velecloudserver/fortress/dragnetwebservice.asmx') -> proxy('http://velecloudserver/fortress/dragnetwebservice.asmx/LoginPlainText');
my $som = $soap->call('LoginPlainText', SOAP::Data->name('LoginPlainText')->value(
\SOAP::Data->value([
SOAP::Data->name('strLogin')->value('admin'),
SOAP::Data->name('strPassword')->value('Adm1234'),
]))
);
任何提示,将不胜感激。
感谢代理方式转变为正常工作我只有一些问题,因为服务返回1002作为LoginPlainTextResult和空值strAuthTicket我仍然不知道这意味着什么,但至少我得到了答复。 – user565793 2011-01-11 20:58:36