How do I access SourceGear Web services using SOAP::Lite?

Posted by user565793 on Stack Overflow See other posts from Stack Overflow or by user565793
Published on 2011-01-06T17:29:42Z Indexed on 2011/01/06 23:53 UTC
Read the original article Hit count: 352

For some reason SourceGear provide an undocumented Web service on their installations. They actually ask developers to use the API instead because the Web service is kinda messy, but this is a problem in my case because I cannot use this API on a Perl environment, so their solution for my specific case is to use the Web service.

This shouldn't be a problem. Using SOAP::Lite I have connected to several Web services in the past in the same way. But the lack of documentation is a major chaos if you don't know where the SOAP calls can be made. I only have an XML to decipher where to and how to make these calls. It would be great if a real SOAP genius could help me out in this.

This is an example of the login call and the expected response:

Request

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>

Response

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>

I'm looking for a way to be able to assemble this somehow. This is my Perl example:

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'),
    ]))
);

Any tip would be appreciated.

© Stack Overflow or respective owner

Related posts about web-services

Related posts about perl