Newbe question, can't get a simple request to work.. help please!

Hi all,

I am trying to get a simple request to work in C# on .NET but can’t even get a simple request to work using postman. I’ve been given the test username and password which i’m trying but just get:

        <Error>
            <RaisedBy>CompanyDetails</RaisedBy>
            <Number>502</Number>
            <Type>fatal</Type>
            <Text>Authorisation Failure</Text>
            <Location></Location>
        </Error>

I’m using postman to test this initially to make sure I can get a simple company call working, here is my source XML:

<GovTalkMessage xsi:schemaLocation="http://www.govtalk.gov.uk/CM/envelope http://xmlgw.companieshouse.gov.uk/v1-0/schema/Egov_ch-v2-0.xsd" xmlns="http://www.govtalk.gov.uk/CM/envelope" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:gt="http://www.govtalk.gov.uk/schemas/govtalk/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
     <EnvelopeVersion>1.0</EnvelopeVersion>
     <Header>
          <MessageDetails>
               <Class>CompanyDetails</Class>
               <Qualifier>request</Qualifier>
               <TransactionID>5</TransactionID>
          </MessageDetails>
          <SenderDetails>
               <IDAuthentication>
                    <SenderID>??????</SenderID>
                    <Authentication>
                         <Method>CHMD5</Method>
                         <Value>?????</Value>
                    </Authentication>
               </IDAuthentication>
          </SenderDetails>
     </Header>
     <GovTalkDetails>
          <Keys/>
     </GovTalkDetails>
     <Body>
          <CompanyDetailsRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xmlgw.companieshouse.gov.uk/v1-0/schema/CompanyDetails.xsd">
               <CompanyNumber>99999999</CompanyNumber>
               <CompanyName>TEST COMPANY PLC</CompanyName>
               <GiveMortTotals>1</GiveMortTotals>
          </CompanyDetailsRequest>
      </Body>
</GovTalkMessage>

To the address:
http://xmlgw.companieshouse.gov.uk/v1-0/xmlgw/Gateway

I’m getting the hash for the password and sending the SenderId in clear text, can any one shed some light as to what I’m doing wrong?

Many thanks in advance
Mike

Its definitely your sender details ID / authentication values that are the problem Mike.

These are the rules for creating these details:

Authentication is performed through a SenderID and Password combination, transmitted to the gateway in an encoded form.

The encoding model used employs MD5 (Internet RFC/FYI/STD/BCP Archives or http://rfc.net/rfc1321.txt) hashing of the password with a one-time key. The algorithm is thus:

  1. The sender creates a unique Transaction ID (1…32 digits maximum, NUMERIC)
  2. The sender generates an MD5 digest of the concatenation of their senderID, password and transaction ID
  3. The sender submits the request and attaches
    a. Their SenderID
    b. Their Transaction ID
    c. The MD5 digest
  4. The Gateway retrieves the password associated with the SenderID from its database
  5. The Gateway calculates an MD5 digest of the retrieved password and the transaction ID sent in the request
  6. The senders MD5 digest is compared with the Gateway’s MD5 digest and if they match, the sender is authenticated

It is the action of the Transaction ID that makes this encoding one-time-only, therefore it is mandatory that this ID be incremental. You must use a higher number each time, do not use random strings it will cause the system to freeze and you will receive a 503 error message.

For example:
Given a SenderID of My_SenderID, a password of This_is_my_private_password and a transaction ID of 14456553, the MD5 digest of My_SenderIDThis_is_my_private_password14456553 would be generated - producing e999e113407884fa410fa2f53bc23952

The authentication information supplied by the sender to the Gateway would be:
• My_SenderID
• 14456553
• e999e113407884fa410fa2f53bc23952

Details of the XML elements used to transport these authentication details are described in the message envelope documentation.

Please note this MD5 hash process should not be used for XML Software Filing.

SDN

Thanks,

I’ll take a look at that and report back.

Mike

Just in case you do not have them, test details of the XML GATEWAY (Output) service are as follows:

Sender ID = XMLGatewayTestUserID
Password = XMLGatewayTestPassword

Please note whatever company information you request using these test credentials, we will return data relating to Millennium Stadium Plc only. Once you’ve confirm that you have successfully used the test account, and have provided us with examples of company/information data download, I will send you an application form for a live account, which you’ll need to complete.

SDN

Hi,

Yes I was given though thank you and got it working.
Thanks for your help with this.

Mike

Hi, I’m submitting the following request, but also having a 502 Authorisation Failure. My request is as follows - I’m using the md5 digest of the string SenderID + Password + TransactionID as my auth value, Have any of the requirements changed?

<GovTalkMessage>
	  <EnvelopeVersion>
	    1.0</EnvelopeVersion>
	  <Header>
	    <MessageDetails>
	      <Class>
	        CompanyDetails</Class>
	      <Qualifier>
	        request</Qualifier>
	      <TransactionID>
	        7</TransactionID>
	      <GatewayTest>
	        1</GatewayTest>
	      </MessageDetails>
	    <SenderDetails>
	      <IDAuthentication>
	        <SenderID>
	          ?????</SenderID>
	        <Authentication>
	          <Method>
	            CHMD5</Method>
	          <Value>
	            ?????</Value>
	          </Authentication>
	        </IDAuthentication>
	      <EmailAddress>
	        misrab@getground.co.uk</EmailAddress>
	      </SenderDetails>
	    </Header>
	  <GovTalkDetails>
	    </GovTalkDetails>
	  <Body>
	    <CompanyDetailsRequest>
	      <CompanyNumber>
	        99999999</CompanyNumber>
	      <CompanyName>
	        Millennium Stadium Plc</CompanyName>
	      <GiveMortTotals>
	        1</GiveMortTotals>
	      </CompanyDetailsRequest>
	    </Body>
	  </GovTalkMessage>

Hi Misrab,

I see that you have sent me an email as well - I shall respond as soon as I can today.

SDN

Hello again Misrab,

The test account details I gave you on the 20th August only refer to our XML filing platform.
These credentials cannot be used in conjunction with any other of our services.

The “CompanyDetails” service that you are trying to develop is a feature of our XML Gateway Output service – i have just sent you relevant details of this via email.

SDN