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?
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?
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.
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.
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)
if (rs == null)
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 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);
That should do the trick.