Hi,
I’ve recently completed a quote system for a client, using PHP and MySQL. The system works fine, but the client now wants to import the captured data into their in-house server which accepts XML data.
I’ve never worked with XML but thought that this would be a simple task of calling an XML template during the quote process, populating it with the data variables and using some sort of PHP script to send the file to the server.
However, they have provided me with the XML structure and now I’m more confused than ever! This is the first file:
<?xml version="1.0" encoding="UTF-8" ?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="www.shlquotes.co.uk"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
targetNamespace="www.xxx999.co.uk" name="EPAService">
<types>
<xsd:schema>
<xsd:import schemaLocation="http://1.1.1.1:80/EPAService/EPAService?xsd=1" namespace="www.xxx999.co.uk" />
</xsd:schema>
</types>
<message name="SendSpecific">
<part element="tns:SendSpecific" name="parameters" />
</message>
<message name="SendSpecificResponse">
<part element="tns:SendSpecificResponse" name="parameters" />
</message>
<portType name="EPAService">
<operation name="SendSpecific">
<input message="tns:SendSpecific" />
<output message="tns:SendSpecificResponse" />
</operation>
</portType>
<binding name="EPAServicePortBinding" type="tns:EPAService">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
<operation name="SendSpecific">
<soap:operation soapAction="" />
<input>
<soap:body use="literal" />
</input>
<output>
<soap:body use="literal" />
</output>
</operation>
</binding>
<service name="EPAService">
<port name="EPAServicePort" binding="tns:EPAServicePortBinding">
<soap:address location="http://1.1.1.1:80/EPAService/EPAService" />
</port>
</service>
</definitions>
this is the second:
<?xml version+"1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetnameSpace="www.xxx999.co.uk" version="1.0">
<xs:element xmlns:ns1="www.xxx999.co.uk" name="SendSpecific" type="ns1:SendSpecific" />
<xs:complexType name="SendSpecific">
<xs:sequence>
<xs:element name="triposIPAddressOrHost" type="xs:string" minOccurs="0" />
<xs:element name="portNumber" type="xs:short" />
<xs:element name="timeOutSetting" type="xs:short" />
<xs:element name="branchNumber" type="xs:short" />
<xs:element name="xmlInput" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
<xs:element xmlns:ns2="www.xxx999.co.uk" name="SendSpecificResponse" type="ns2:SendSpecificResponse" />
<xs:complexType name="SendSpecificResponse">
<xs:sequence>
<xs:element name="return" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:schema>
and this is the truncated ‘example xml’:
<APMIMPORT>
<APMCLIENT>
<P.CM>
<Refno>12345</Refno>
<Name>Mr J Bloggs</Name>
<Addr1>22 Acacia Avenue</Addr1>
<Addr2>Somewhere</Addr2>
<Addr3>Anytown</Addr3>
<Pcode>AB1 1BA</Pcode>
</P.CM>
</APMCLIENT>
</APMIMPORT>
I am assuming that the first file sends the data and the second receives the response using a PHP (or similar) script? I am also assuming that the schemaLocation needs to be amended to the IP address of the server the data is to sent to, and that the namespace should be the url of the page receiving the response.
Firstly, are my assumptions correct? Secondly, how do I insert the XML data? Is it appended to the first file or sent as a separate file altogether?
No doubt I’ll have many more questions but I would be eternally grateful for any help with this.
Thanks in advance.