ok, time to change tangents!
I am now trying to add more intellegence to the basic form, now that we have ascertained the subscriptions and access aspects.
I am trying to consume the webservice found here:
https://www.carwebuk.com/CarweBVRRB2Bproxy/carwebvrrwebservice.asmx?op=strB2BGetVehicleByVRM - this is a commercial product that I am testing!
The aim is to provide a vehicle registration (vrm) lookup via post or get (I assume post as it effects the form?), to populate certain parameters in the form.
Options:
1) A single page form with a 'Lookup VRM' button, all of the fields we want the lookup to populate, and the form submit button. If I want to populate some of the fields of the form by using the lookup, I would assume ajax has to be involved. The rest of the fields would then be filled in and only on submit would I want the form committed to the database.
2) A multipage form, with the first page containing the vrm lookup or skip options, and the second page containing the fields - either prefilled or empty. The user would then add images and a description, and submit.
My assumption in both cases is that I need to somehow run the results through an xml parser, to serialise things so I can build an array, and output parts of the array with $vars, then populate the fields with the $vars ?
http://onlamp.com/pub/a/php/2004/01/15/simplexml.htmland
http://paulstamatiou.com/how-to-parse-xml-with-php5Look like good bets for further info!
My preference is for option one if that is possible!
Initial testing:I have this simple form code: (with some obscured values)
<input type="hidden" name="strUserName" value="*****">
<input type="hidden" name="strPassword" value="*****">
<input type="hidden" name="strClientRef" value="Mizpah">
<input type="hidden" name="strClientDescription" value="Initial Testing">
<input type="hidden" name="strKey1" value="*****">
<input type="hidden" name="strVersion" value="0.26.1">
<table>
<tr>
<td class="frmText">strVRM:</td>
<td><input class="frmInput" type="text" size="50" name="strVRM"></td>
</tr>
<tr>
<td></td>
<td align="right"> <input type="submit" value="Invoke" class="button"></td>
</tr>
</table>
The actionurl is set to 'https://www.carwebuk.com/CarweBVRRB2Bproxy/carwebvrrwebservice.asmx/strB2BGetVehicleByVRM'
When I use this in IE8, the following is returned:
<?xml version="1.0" encoding="utf-8" ?>
- <GetVehicles release="8.1" environment="Production" lang="en-US" xmlns="">
- <ApplicationArea>
- <Sender>
<LogicalId>0</LogicalId>
<Component>CarweBVRRWebService</Component>
<Task>strB2BGetVehicleByVRM</Task>
<ReferenceId>0</ReferenceId>
<AuthorizationId>0</AuthorizationId>
<CreatorNameCode>0</CreatorNameCode>
<SenderNameCode>0</SenderNameCode>
<SenderURI>http://www.carwebuk.uk.com</SenderURI>
<DealerNumber />
<StoreNumber />
<AreaNumber />
<DealerCountry />
<Language>en-GB</Language>
<DeliverPendingMailInd>0</DeliverPendingMailInd>
<Password />
<SystemVersion />
</Sender>
<CreationDateTime>2009-08-27T16.25.00Z</CreationDateTime>
<BODId />
- <Destination>
<DestinationNameCode>1</DestinationNameCode>
<DestinationURI>84.45.60.102</DestinationURI>
<DestinationSoftwareCode>1</DestinationSoftwareCode>
<DestinationSoftware>VRRB2B</DestinationSoftware>
<DealerNumber />
<StoreNumber />
<AreaNumber />
<DealerCountry>UK</DealerCountry>
</Destination>
</ApplicationArea>
- <DataArea>
- <Error>
- <Header>
<DocumentDateTime>2009-08-27T16.25.00Z</DocumentDateTime>
</Header>
</Error>
- <Vehicles>
- <Vehicle>
<BodyStyle>MOTOR CARAVAN</BodyStyle>
<CherishedTransferDate />
<CherishedTransferMarker>false</CherishedTransferMarker>
<ColourCurrent>WHITE</ColourCurrent>
<ColourCurrentCode>N</ColourCurrentCode>
<ColourOriginal />
<ColourOriginalCode />
<ColourLast />
<ColourLastCode />
<ColourLastDateOfChange />
<ColourPrevCount>0</ColourPrevCount>
<CO2>0</CO2>
<DateFirstRegistered>2006-10-04</DateFirstRegistered>
<DateOfFirstRegistrationUK />
<DVLAYearOfManufacture>2006</DVLAYearOfManufacture>
<DateOfPreviousKeeperAcquisition />
<DateOfPreviousKeeperDisposal />
<DVLA_Code>N1600</DVLA_Code>
<DVLA_MakeCode>N1</DVLA_MakeCode>
<DVLA_ModelCode>600</DVLA_ModelCode>
<DVLA_Make>FIAT</DVLA_Make>
<DVLA_Model>DUCATO 15 JTD SWB</DVLA_Model>
<DVLA_Vehicle_Description />
<DVLA_WheelPlanDesc>2-AXLE-RIGID BODY</DVLA_WheelPlanDesc>
<EngineNumber>4236212</EngineNumber>
<EngineCapacity>2800</EngineCapacity>
<ExportDate />
<ExportMarker>0</ExportMarker>
<FuelDescription>DERV, DIESEL, GAS OIL, HEAVY OIL, KEROSENE, PARAFFIN, TVO (tractor vaporising oil)</FuelDescription>
<FuelType>DIESEL</FuelType>
<GrossWeightKG>3500</GrossWeightKG>
<ImportDate />
<ImportMarker>false</ImportMarker>
<ImportMarkerFromNorthernIreland>false</ImportMarkerFromNorthernIreland>
<IssueDateOfLatestV5>2006-10-04</IssueDateOfLatestV5>
<NumberOfPreviousKeepers>0</NumberOfPreviousKeepers>
<ScrappingDate />
<ScrappingMarker>0</ScrappingMarker>
<ScrappedRemovedMarker>false</ScrappedRemovedMarker>
<ScrapStatus>Not marked as scrapped</ScrapStatus>
<StartDateOfCurrentKeeper />
<UsedBeforeFirstRegistrationMarker>false</UsedBeforeFirstRegistrationMarker>
<VIC_TestDate />
<VIC_TestResult />
<VIN_Original_DVLA>ZFA24400007814176</VIN_Original_DVLA>
<VRM_Curr>RX56EZZ</VRM_Curr>
<VRM_NorthernIreland />
<WheelPlan>C</WheelPlan>
<AbbreviatedTransmission>M</AbbreviatedTransmission>
<AccelerationTo100KPHSecs />
<ArrangementOfCylinders>IN LINE</ArrangementOfCylinders>
<Aspiration>TURBO CHARGED</Aspiration>
<BodyStyleDescription>CHASSIS CAB</BodyStyleDescription>
<Bore />
<BusSeatingCapacity>1</BusSeatingCapacity>
<CO_GtoKm />
<Combined_EngineCapacity>2800</Combined_EngineCapacity>
<Combined_ForwardGears>5</Combined_ForwardGears>
<Combined_FuelType>DIESEL</Combined_FuelType>
<Combined_Make>FIAT</Combined_Make>
<Combined_Model>DUCATO 15 SWB JTD C/C</Combined_Model>
<Combined_Transmission>MANUAL</Combined_Transmission>
<Combined_VIN>ZFA24400007814176</Combined_VIN>
<Combined_VINLast8>07814176</Combined_VINLast8>
<CountryOfOrigin>ITALY</CountryOfOrigin>
<DateOfThirdPrevKeeperAcquisition />
<DateOfThirdPrevKeeperDisposal />
<DateOfFourthPrevKeeperAcquisition />
<DateOfFourthPrevKeeperDisposal />
<DateOfFifthPrevKeeperAcquisition />
<DateOfFifthPrevKeeperDisposal />
<Delivery>FUEL INJECTION</Delivery>
<DriveAxle>FRONT</DriveAxle>
<DriveType>4X2</DriveType>
<DVLAForwardGears />
<DVLATransmission />
<EngineLocation>FRONT</EngineLocation>
<EngineManufacturer>FIAT</EngineManufacturer>
<EngineModelCode>8140.43S</EngineModelCode>
<EuroStatus />
<FrontSteerHGV>0</FrontSteerHGV>
<FuelConsumptionCombined_Ltr100km />
<FuelConsumptionExtraUrban_Ltr100km />
<FuelConsumptionUrbanCold_Ltr100km />
<FuelConsumptionCombinedMPG />
<FuelConsumptionExtraUrbanMPG />
<FuelConsumptionUrbanColdMPG />
<FuelTypeAbbreviated>D</FuelTypeAbbreviated>
<ForwardGears>5</ForwardGears>
<HC>0</HC>
<HeightMM />
<IntroductionDateToUK>2002-09-01</IntroductionDateToUK>
<KerbWeightMin />
<KerbWeightMax />
<LengthMM />
<LoadLengthForVans>0</LoadLengthForVans>
<lrHandDrive />
<ManufacturerBuildDate />
<MarketSegment>LCVs (Heavy Vans 2601-3500 Kgs)</MarketSegment>
<MarqueDescription>FIAT</MarqueDescription>
<MassInService>0</MassInService>
<MaximumNettPower>45</MaximumNettPower>
<MaximumPowerAtRPM />
<MaximumPowerBHP />
<MaximumPowerInKW />
<MaximumSpeedKPH />
<MaximumSpeedMPH />
<MaximumTechnicallyPermissableMass>990</MaximumTechnicallyPermissableMass>
<MaximumTorqueAtRPM />
<MaximumTorqueLbFt />
<MaximumTorqueNM />
<ModelRangeDescription>DUCATO</ModelRangeDescription>
<ModelSeries>244</ModelSeries>
<ModelVariantDescription>15 SWB JTD C/C</ModelVariantDescription>
<ModelYear />
<NOX>0</NOX>
<NumberOfCylinders>4</NumberOfCylinders>
<NumberOfDoors />
<NumberOfValvesPerCylinder />
<OriginalSalesType>P</OriginalSalesType>
<ParticulatesGtoKm>0</ParticulatesGtoKm>
<PayloadForVans>1605</PayloadForVans>
<PowerWeightRatio_MotorcyclesOnly>0</PowerWeightRatio_MotorcyclesOnly>
<RoofHeightForVans>0</RoofHeightForVans>
<SeatingCapacityInclDriver>2</SeatingCapacityInclDriver>
<Seats />
<SoundLevelEngineSpeed>3940</SoundLevelEngineSpeed>
<SoundLevelDriveBy>74</SoundLevelDriveBy>
<SoundLevelStationary>86</SoundLevelStationary>
<CW_EngineCapacity>2800</CW_EngineCapacity>
<Stroke />
<TechPermMaxTowableMassOfTrailer_Braked>0</TechPermMaxTowableMassOfTrailer_Braked>
<TechPermMaxTowableMassOfTrailer_Unbraked>0</TechPermMaxTowableMassOfTrailer_Unbraked>
<Transmission>MANUAL</Transmission>
<UnladenWeightForVans>1695</UnladenWeightForVans>
<ValveGear />
<VehicleCategoryCode>DC</VehicleCategoryCode>
<VehicleCategoryDescription>LCVs (Heavy Vans 2601-3500 Kgs)</VehicleCategoryDescription>
<VIN_MVRIS>ZFA24400007814176</VIN_MVRIS>
<VIN_Verified />
<VRM_MVRIS>RX56EZZ</VRM_MVRIS>
<WheelbaseForVans />
<WidthMM>2024</WidthMM>
<VRM_Change1 />
<VRM_Change2 />
<VRM_Change3 />
<datPNCRecordDate />
<strForceCode />
<strMessageType />
</Vehicle>
</Vehicles>
</DataArea>
</GetVehicles>
However in Chrome and it returns an otherwise blank page something akin to this:
'0 CarweBVRRWebService strB2BGetVehicleByVRM 0 0 0 0
http://www.carwebuk.uk.com en-GB 0 2009-08-27T15.50.17Z 1 84.45.60.102 1 VRRB2B UK 2009-08-27T15.50.17Z MOTOR CARAVAN false WHITE N 0 0 2006-10-04 2006 N1600 N1 600 FIAT DUCATO 15 JTD SWB 2-AXLE-RIGID BODY 4236212 2800 0 DERV, DIESEL, GAS OIL, HEAVY OIL, KEROSENE, PARAFFIN, TVO (tractor vaporising oil) DIESEL 3500 false false 2006-10-04 0 0 false Not marked as scrapped false ZFA24400007814176 RX56EZZ C M IN LINE TURBO CHARGED CHASSIS CAB 1 2800 5 DIESEL FIAT DUCATO 15 SWB JTD C/C MANUAL ZFA24400007814176 07814176 ITALY FUEL INJECTION FRONT 4X2 FRONT FIAT 8140.43S 0 D 5 0 2002-09-01 0 LCVs (Heavy Vans 2601-3500 Kgs) FIAT 0 45 990 DUCATO 244 15 SWB JTD C/C 0 4 P 0 1605 0 0 2 3940 74 86 2800 0 0 MANUAL 1695 DC LCVs (Heavy Vans 2601-3500 Kgs) ZFA24400007814176 RX56EZZ 2024'
when I select view source it does not seem to be aware of the xml structure!
So - Questions!
1) Trying to find any code examples of anything akin to option 1 or 2 above.
2) Am still a little in the dark as to how I should be obtaining the XML to interrogate for each submission - all examples that I can find either obtain the XML via http post (as I have done above), and then output raw XML to a new page, or read it directly from a file (in the example of XML parsers i.e. php 5's simplexml). As per my simple test above, I guess I need to load the results into a $var somehow, and not generate a new page with output - then load that $var into an XML parser - take the output (an array) and set the default value of the fields in the form to those $vars ??
3) Am I correct in thinking that my largest aim atm, is to get the result of a query into an array - work out how to update it - then I can start to do things with it!
4) Do we have any examples in the chronoforms community of populating form fields with $vars that are dynamically looked up ?
Anybody care to correct my thinking or give me a poke in the correct direction ? First time ive tried to use a web service - I thought I had already managed the hardest part with the subscriptions side of things 🤣
For reference, the suppliers of the webservice, can only help with .net code examples of how to use it!
Cheers in advance!
/Miz