SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Member
    Join Date
    Jan 2012
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    compamyhouse xml gatway service

    Hi ,

    I am a web developer using php and myadmin.
    I am creating a web site to register a company by using compamyhouse xml gatway service.

    My problem is that i don't know how to sumbit user detail to companyhouse so we can get the response back .

    I am trying this but did not get any response plz help

    This is my code
    <?php
    $xml = <<<EOF
    <GovTalkMessage xsi:schemaLocation="http://www.govtalk.gov.uk/schemas/govtalk/govtalkheader http://xmlgw.companieshouse.gov.uk/v1-0/schema/Egov_ch.xsd" xmlns="http://www.govtalk.gov.uk/schemas/govtalk/govtalkheader" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:gt="http://www.govtalk.gov.uk/schemas/govtalk/core" xmlnssi="http://www.w3.org/2001/XMLSchema-instance" >
    <EnvelopeVersion>1.0</EnvelopeVersion>
    <Header>
    <MessageDetails>
    <Class></Class>
    <Qualifier>error</Qualifier>
    <TransactionID></TransactionID>
    <GatewayTimestamp>2012-01-23T17:52:11-00:00</GatewayTimestamp>
    </MessageDetails>
    <SenderDetails>
    <IDAuthentication>
    <SenderID></SenderID>
    <Authentication>
    <Method>CHMD5</Method>
    <Value></Value>
    </Authentication>
    </IDAuthentication>
    </SenderDetails>
    </Header>
    <GovTalkDetails>
    <Keys/>
    <GovTalkErrors>
    <Error>
    <RaisedBy>CH_XML_Gateway</RaisedBy>
    <Number>9999</Number>
    <Type>fatal</Type>
    <Text>No request XML</Text>
    <Location></Location>
    </Error>
    </GovTalkErrors>
    </GovTalkDetails>
    <Body><FormSubmission xmlns="http://xmlgw.companieshouse.gov.uk/Header" xmlns:bs="http://xmlgw.companieshouse.gov.uk" xmlnssi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlgw.companieshouse.gov.uk/Header http://xmlgw.companieshouse.gov.uk/v2-1/schema/forms/FormSubmission-v2-5.xsd">
    <FormHeader>
    <CompanyName>BETA TEST 1 LLP</CompanyName>
    <PackageReference>1828</PackageReference>
    <FormIdentifier>CompanyIncorporation</FormIdentifier>
    <SubmissionNumber>LLP111</SubmissionNumber>
    </FormHeader>
    <DateSigned>2010-07-20</DateSigned>
    <Form>
    <CompanyIncorporation xmlns="http://xmlgw.companieshouse.gov.uk" xmlnssi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlgw.companieshouse.gov.uk http://xmlgw.companieshouse.gov.uk/v2-1/schema/forms/CompanyIncorporation-v2-6.xsd">
    <CompanyType>LLP</CompanyType>
    <CountryOfIncorporation>EW</CountryOfIncorporation>
    <RegisteredOfficeAddress>
    <Premise>1</Premise>
    <Street>LEYSHON POOLE STREET</Street>
    <PostTown>PONTYPRIDD</PostTown>
    <Country>GB-WLS</Country>
    <Postcode>CF37 1ND</Postcode>
    </RegisteredOfficeAddress>

    <Appointment>
    <Authentication>
    <PersonalAttribute>BIRTOWN</PersonalAttribute>
    <PersonalData>HAV</PersonalData>
    </Authentication>
    <Authentication>
    <PersonalAttribute>DAD</PersonalAttribute>
    <PersonalData>FRE</PersonalData>
    </Authentication>
    <Authentication>
    <PersonalAttribute>EYE</PersonalAttribute>
    <PersonalData>BLU</PersonalData>
    </Authentication>
    <Member>
    <DesignatedInd>true</DesignatedInd>
    <Corporate>
    <Forename>WILLIAM</Forename>
    <Surname>DAVIES</Surname>
    <CorporateName>TEST NAME</CorporateName>
    <Address>
    <Premise>6</Premise>
    <Street>WOOD VIEW</Street>
    <PostTown>CHURCH VILLAGE</PostTown>
    <Country>GB-WLS</Country>
    <Postcode>CF21 1RW</Postcode>
    </Address>
    <CompanyIdentification>
    <NonEEA>
    <LawGoverned>AUSTRIAN</LawGoverned>
    <LegalForm>TEST</LegalForm>
    </NonEEA>
    </CompanyIdentification>
    </Corporate>
    </Member>
    </Appointment>

    <Appointment>
    <Authentication>
    <PersonalAttribute>BIRTOWN</PersonalAttribute>
    <PersonalData>HAV</PersonalData>
    </Authentication>
    <Authentication>
    <PersonalAttribute>DAD</PersonalAttribute>
    <PersonalData>FRE</PersonalData>
    </Authentication>
    <Authentication>
    <PersonalAttribute>EYE</PersonalAttribute>
    <PersonalData>BLU</PersonalData>
    </Authentication>
    <Member>
    <DesignatedInd>false</DesignatedInd>
    <Person>
    <Title>Mr</Title>
    <Forename>LEIGH ERIC</Forename>
    <Surname>DAVIES</Surname>
    <ServiceAddress>
    <Address>
    <Premise>1</Premise>
    <Street>LEYSHON POOLE STREET</Street>
    <PostTown>PONTYPRIDD</PostTown>
    <Country>GB-WLS</Country>
    </Address>
    </ServiceAddress>
    <DOB>1975-02-01</DOB>
    <CountryOfResidence>United Kingdom</CountryOfResidence>
    <PreviousNames>
    <Surname>HUGHES</Surname>
    </PreviousNames>
    <ResidentialAddress>
    <SameAsServiceAddress>true</SameAsServiceAddress>
    </ResidentialAddress>
    </Person>
    </Member>
    </Appointment>

    <Appointment>
    <Authentication>
    <PersonalAttribute>BIRTOWN</PersonalAttribute>
    <PersonalData>SWA</PersonalData>
    </Authentication>
    <Authentication>
    <PersonalAttribute>DAD</PersonalAttribute>
    <PersonalData>BIL</PersonalData>
    </Authentication>
    <Authentication>
    <PersonalAttribute>EYE</PersonalAttribute>
    <PersonalData>HAZ</PersonalData>
    </Authentication>
    <Member>
    <DesignatedInd>true</DesignatedInd>
    <Corporate>
    <Forename>HARRY</Forename>
    <Surname>DAVIES</Surname>
    <CorporateName>TEST CORPORATE</CorporateName>
    <Address>
    <Premise>6</Premise>
    <Street>TREETOPS VIEW</Street>
    <PostTown>CARDIFF</PostTown>
    <Country>GB-WLS</Country>
    <Postcode>CF58 1RW</Postcode>
    </Address>
    <CompanyIdentification>
    <EEA>
    <PlaceRegistered>ukraine</PlaceRegistered>
    <RegistrationNumber>568497</RegistrationNumber>
    </EEA>
    </CompanyIdentification>
    </Corporate>
    </Member>
    </Appointment>

    <Appointment>
    <Authentication>
    <PersonalAttribute>BIRTOWN</PersonalAttribute>
    <PersonalData>SWA</PersonalData>
    </Authentication>
    <Authentication>
    <PersonalAttribute>DAD</PersonalAttribute>
    <PersonalData>BIL</PersonalData>
    </Authentication>
    <Authentication>
    <PersonalAttribute>EYE</PersonalAttribute>
    <PersonalData>HAZ</PersonalData>
    </Authentication>
    <Member>
    <DesignatedInd>false</DesignatedInd>
    <Person>
    <Title>Mr</Title>
    <Forename>Peter</Forename>
    <OtherForenames>DAVID ELLIS</OtherForenames>
    <Surname>Evans</Surname>
    <ServiceAddress>
    <Address>
    <Premise>1</Premise>
    <Street>LEYSHON POOLE STREET</Street>
    <PostTown>PONTYPRIDD</PostTown>
    <Country>GB-WLS</Country>
    </Address>
    </ServiceAddress>
    <DOB>1959-09-29</DOB>
    <CountryOfResidence>UNITED KINGDOM</CountryOfResidence>
    <ResidentialAddress>
    <Address>
    <Premise>17</Premise>
    <Street>CORDEN DAL</Street>
    <PostTown>CARDIFF</PostTown>
    <Country>GB-WLS</Country>
    <Postcode>CF24 7DH</Postcode>
    </Address>
    </ResidentialAddress>
    </Person>
    </Member>
    </Appointment>

    <Appointment>
    <Authentication>
    <PersonalAttribute>BIRTOWN</PersonalAttribute>
    <PersonalData>SWA</PersonalData>
    </Authentication>
    <Authentication>
    <PersonalAttribute>DAD</PersonalAttribute>
    <PersonalData>BIL</PersonalData>
    </Authentication>
    <Authentication>
    <PersonalAttribute>EYE</PersonalAttribute>
    <PersonalData>HAZ</PersonalData>
    </Authentication>
    <Member>
    <DesignatedInd>true</DesignatedInd>
    <Person>
    <Title>SIR</Title>
    <Forename>james john david</Forename>
    <Surname>Evans</Surname>
    <ServiceAddress>
    <SameAsRegisteredOffice>true</SameAsRegisteredOffice>
    </ServiceAddress>
    <DOB>1958-09-29</DOB>
    <CountryOfResidence>UNITED KINGDOM</CountryOfResidence>
    <ResidentialAddress>
    <Address>
    <Premise>17</Premise>
    <Street>CORDEN DAL</Street>
    <PostTown>CARDIFF</PostTown>
    <Country>GB-WLS</Country>
    <Postcode>CF24 7DH</Postcode>
    </Address>
    </ResidentialAddress>
    </Person>
    </Member>
    </Appointment>

    <Appointment>
    <Authentication>
    <PersonalAttribute>BIRTOWN</PersonalAttribute>
    <PersonalData>SWA</PersonalData>
    </Authentication>
    <Authentication>
    <PersonalAttribute>DAD</PersonalAttribute>
    <PersonalData>BIL</PersonalData>
    </Authentication>
    <Authentication>
    <PersonalAttribute>EYE</PersonalAttribute>
    <PersonalData>HAZ</PersonalData>
    </Authentication>
    <Member>
    <DesignatedInd>true</DesignatedInd>
    <Person>
    <Title>Mr</Title>
    <Forename>JOE</Forename>
    <Surname>JONES</Surname>
    <ServiceAddress>
    <SameAsRegisteredOffice>true</SameAsRegisteredOffice>
    </ServiceAddress>
    <DOB>1959-09-29</DOB>
    <CountryOfResidence>UNITED KINGDOM</CountryOfResidence>
    <ResidentialAddress>
    <Address>
    <Premise>17</Premise>
    <Street>CORDEN DAL</Street>
    <PostTown>CARDIFF</PostTown>
    <Country>GB-WLS</Country>
    <Postcode>CF24 7DH</Postcode>
    </Address>
    </ResidentialAddress>
    </Person>
    </Member>
    </Appointment>

    <Authoriser>
    <Member>
    <Person>
    <Forename>JOE</Forename>
    <Surname>JONES</Surname>
    </Person>
    <Authentication>
    <PersonalAttribute>BIRTOWN</PersonalAttribute>
    <PersonalData>SWA</PersonalData>
    </Authentication>
    <Authentication>
    <PersonalAttribute>DAD</PersonalAttribute>
    <PersonalData>BIL</PersonalData>
    </Authentication>
    <Authentication>
    <PersonalAttribute>EYE</PersonalAttribute>
    <PersonalData>HAZ</PersonalData>
    </Authentication>
    </Member>
    </Authoriser>

    <SameDay>false</SameDay>
    </CompanyIncorporation>
    </Form>
    </FormSubmission>
    </Body>
    </GovTalkMessage>
    EOF;
    $ch = curl_init(); //initiate the curl session


    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // tell curl to return data in a variable
    curl_setopt($ch, CURLOPT_HEADER, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: text/xml"));
    curl_setopt($ch, CURLOPT_POST, true);

    curl_setopt($ch, CURLOPT_TIMEOUT, (int)30); // set timeout in seconds

    echo $xmlResponse = curl_exec($ch);
    curl_close ($ch);
    ?>

  2. #2
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Does the API have any documentation you can read and/or code examples? As it stands, you're doing an awful lot wrong I'm afraid.
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  3. #3
    SitePoint Member
    Join Date
    Jan 2012
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    this is the url where i have to submit my Requested data

    https://xmlgw.companieshouse.gov.uk/v1-0/xmlgw/Gateway

    This is the example(below) given by company house xml gateway to submit the requested data

    http://xmlgw.companieshouse.gov.uk/e...1_v2-6_LLP.xml


    will you please check these link and tell me how can i submit my post data

  4. #4
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    The sample XML you linked to references a XSD, you can view this (rather verbose) document to see what you need to send to the API.

    http://xmlgw.companieshouse.gov.uk/v...ation-v2-6.xsd

    You're going to need something similar to...

    Code:
    <?php
    function do_post($data, $uri){
    	$curl = curl_init($uri);
    	curl_setopt_array($curl, array(
    		CURLOPT_SSL_VERIFYHOST	=> false,
    		CURLOPT_SSL_VERIFYPEER	=> false,
    		CURLOPT_RETURNTRANSFER	=> true,
    		CURLOPT_POST						=> true,
    		CURLOPT_POSTFIELDS			=> $data,
    		CURLOPT_TIMEOUT					=> 10
    	));
    	return array(
    		'response'		=> curl_exec($curl),
    		'information'	=> curl_getinfo($curl)
    	);
    }
    
    
    var_dump(
    	do_post(file_get_contents('example.xml', 'https://xmlgw.companieshouse.gov.uk/v1-0/xmlgw/Gateway'))
    );
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  5. #5
    SitePoint Member
    Join Date
    Jan 2012
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    HI i still did not get success .the code which you suggest to me is also giving the error
    Fatal error: Call to undefined function curl_init() in C:\wamp\www\register_company_live\29th_jan\examplexml.php on line 8

    Please help

  6. #6
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    You need to install the curl library/extension, WAMP has a one-click option to enable it.
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  7. #7
    SitePoint Member
    Join Date
    Jan 2012
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, you are right. i did not enable the curl.
    But after enabling it,i got the following on browser

    array(2) { ["response"]=> string(1215) " 1.0
    error 2012-02-01T19:11:16-00:00 CHMD5
    CH_XML_Gateway 604 fatal Bad Request " ["information"]=> array(20) { ["url"]=> string(54) "https://xmlgw.companieshouse.gov.uk/v1-0/xmlgw/Gateway" ["content_type"]=> string(33) "application/x-www-form-urlencoded" ["http_code"]=> int(200) ["header_size"]=> int(302) ["request_size"]=> int(178) ["filetime"]=> int(-1) ["ssl_verify_result"]=> int(20) ["redirect_count"]=> int(0) ["total_time"]=> float(2.547) ["namelookup_time"]=> float(0.375) ["connect_time"]=> float(0.594) ["pretransfer_time"]=> float(1.422) ["size_upload"]=> float(6753) ["size_download"]=> float(1215) ["speed_download"]=> float(477) ["speed_upload"]=> float(2651) ["download_content_length"]=> float(-1) ["upload_content_length"]=> float(6753) ["starttransfer_time"]=> float(1.656) ["redirect_time"]=> float(0) } }


    this(below) is the view source

    array(2) {
    ["response"]=>
    string(1215) "<?xml version="1.0" encoding="UTF-8" ?>
    <GovTalkMessage xsi:schemaLocation="http://www.govtalk.gov.uk/schemas/govtalk/govtalkheader http://xmlgw.companieshouse.gov.uk/v1-0/schema/Egov_ch.xsd" xmlns="http://www.govtalk.gov.uk/schemas/govtalk/govtalkheader" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:gt="http://www.govtalk.gov.uk/schemas/govtalk/core" xmlnssi="http://www.w3.org/2001/XMLSchema-instance" >
    <EnvelopeVersion>1.0</EnvelopeVersion>
    <Header>
    <MessageDetails>
    <Class></Class>
    <Qualifier>error</Qualifier>
    <TransactionID></TransactionID>
    <GatewayTimestamp>2012-02-01T19:13:42-00:00</GatewayTimestamp>
    </MessageDetails>
    <SenderDetails>
    <IDAuthentication>
    <SenderID></SenderID>
    <Authentication>
    <Method>CHMD5</Method>
    <Value></Value>
    </Authentication>
    </IDAuthentication>
    </SenderDetails>
    </Header>
    <GovTalkDetails>
    <Keys/>
    <GovTalkErrors>
    <Error>
    <RaisedBy>CH_XML_Gateway</RaisedBy>
    <Number>604</Number>
    <Type>fatal</Type>
    <Text>Bad Request</Text>
    <Location></Location>
    </Error>
    </GovTalkErrors>
    </GovTalkDetails>
    <Body>
    </Body>
    </GovTalkMessage>
    "
    ["information"]=>
    array(20) {
    ["url"]=>
    string(54) "https://xmlgw.companieshouse.gov.uk/v1-0/xmlgw/Gateway"
    ["content_type"]=>
    string(33) "application/x-www-form-urlencoded"
    ["http_code"]=>
    int(200)
    ["header_size"]=>
    int(302)
    ["request_size"]=>
    int(178)
    ["filetime"]=>
    int(-1)
    ["ssl_verify_result"]=>
    int(20)
    ["redirect_count"]=>
    int(0)
    ["total_time"]=>
    float(2.422)
    ["namelookup_time"]=>
    float(0.437)
    ["connect_time"]=>
    float(0.672)
    ["pretransfer_time"]=>
    float(1.515)
    ["size_upload"]=>
    float(6753)
    ["size_download"]=>
    float(1215)
    ["speed_download"]=>
    float(501)
    ["speed_upload"]=>
    float(2788)
    ["download_content_length"]=>
    float(-1)
    ["upload_content_length"]=>
    float(6753)
    ["starttransfer_time"]=>
    float(1.75)
    ["redirect_time"]=>
    float(0)
    }
    }


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •