Skip navigation
TariqRazzaq
Currently Being Moderated

Accessing ACS web services from .Net

May 30, 2012 3:07 AM

Tags: #.net #acs4 #packaging_web_service

Hi

 

I would like to accessing the ACS web services from .Net.  There was no wsdl in any of the web services so I had to manually generate the xml file similar to the test java code.  I am currently facing a few issues which I would like assistance on:

 

Password not working

I am hashing the password using SHA1 and then supplying the output of this to HMACSHA1 before base64 encoding it.  However I get an E_ADEPT_DISTRIBUTOR_AUTH error.  When I turn off authentication then it all works as expected.

 

I am using the hashing algorithms supplied in .Net 4.0 SDK.

 

Can you supply .Net code examples?

 

Web services

Is there a WSDL on each of the web services.  If so, how do I access it?

 

Distributor and ebooks

Once a book is uploaded using the packaging web service, how do you associate it to a particular distributor?

 

Thanks

 

Tariq

 
Replies
  • Currently Being Moderated
    May 30, 2012 7:48 AM   in reply to TariqRazzaq

    There is no WSDL for the web services (simple REST style APIs) but the XML schema is documented in the tech ref.  Your auth problem most likely comes from not correctly serializing the XML to feed into the HMAC.  There is an particular infoset serialization that is required to be used, and while lightly documented in the tech ref, the best reference is the comments to the implmetation in (iirc) XMLUtil.java in the sample code.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 12, 2012 8:32 AM   in reply to Jim_Lester

    Forget about using anything other than Java to communicate with the crap authenticated. If you spend several years deciphering the messy code, you might eventually succeed in reimplementing the singing designed for security-by-obscurity, but it's not worth the effort. Not because you'd rather go crazy than succeed, but because with all likelyhood before you finish your quest, this crap will be obsolete

     

    Either use the next-to-undocumented UploadTest-1_2.jar (hopefully you can force it to do all you need) or do what most others do. Turn off authentication.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 21, 2012 5:58 AM   in reply to TariqRazzaq

    In the XmlDigester class you would have to change the following 2 functions...

     

     

    public int Compare(Object x, Object y)

    {

    XmlAttribute lhs = (XmlAttribute)x;

    XmlAttribute rhs = (XmlAttribute)y;

    string ls = lhs.NamespaceURI;

    string rs = rhs.NamespaceURI;

    if ((ls == rs) || (ls.Equals(rs) && ls != null && rs != null))

    {

    ls = lhs.LocalName;

    rs = rhs.LocalName;

    }

    if (ls == null)

    return -1;

     

    if (rs == null)

    return 1;

     

    byte[] larr = Encoding.UTF8.GetBytes(ls);

    byte[] rarr = Encoding.UTF8.GetBytes(rs);

     

    int len = Math.Min(larr.Length, rarr.Length);

     

    for (int i = 0; i < len; i++)

    {

    int li = (int)(larr[i] & 0xFF);

    int ri = (int)(rarr[i] & 0xFF);

    int d = li - ri;

    if (d != 0)

    return d;

    }

     

    return larr.Length - rarr.Length;

    }

     

    private void Serialize(string s, Stream outStream)

    {

    byte[] bytes = Encoding.UTF8.GetBytes(s);

    int len = bytes.Length;

     

    Serialize((byte)(len >> 8), outStream);

    Serialize((byte)(len), outStream);

    Serialize(bytes, outStream);

     

    }

     

     

    That should do the trick.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points