by cdmmaui » Thu Feb 14, 2013 4:49 pm
Hello,
I was able to transmit the XML to the host server, however I am receiving the following error back from host server. Upon discussing with host server company, they are indicating the XML transmission is corrupt even though the XML message is well-formed and validated against a third party XML validation tool.
I am attaching the source code code, the original message and the host server response in hopes for a resolution today.
*** SOURCE CODE ***
Function _XmlPost2( cXml, oSay2 )
local loHyperlink
local cURL
TRY
// loHyperlink := TOLEAuto():New( "Microsoft.XmlHttp" )
loHyperlink := TOLEAuto():New( "MSXML2.XmlHttp" )
CATCH
MsgInfo( "unable to load TOLEAuto()" )
RETURN (.F.)
END
// cXML := memoread("teste.xml")
TRY
cURL := "http://1.2.3.4:9180/Web.EDI.Dispatcher.WebService/Web.EDI.Framework.asmx"
loHyperlink:Open( "POST", cURL, .f. )
CATCH
MsgInfo( "unable to connect to " + cUrl )
RETURN (.F.)
END
TRY
//loHyperlink:setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
loHyperlink:setRequestHeader("Content-Type", "text/xml")
CATCH
MsgInfo( "unable to set request header" )
RETURN (.F.)
END
TRY
//cxml := "xmlstring=" + cxml
loHyperlink:send( cXML )
CATCH
MsgInfo( "unable to send XML to " + cUrl )
RETURN (.F.)
END
if (At( "SUCCESS", upper(loHyperlink:responseText )) < 5)
msginfo("responseText" + CRLF + loHyperlink:responseText)
f_protokoll(loHyperlink:responseText)
else
msginfo("Senden war erfolgreich")
f_protokoll("Senden war erfolgreich")
endif
return nil
*** ORIGINAL XML MESSAGE ***
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<ServiceSchedules>
<Header>
<SenderId>CDMSOFTWARE</SenderId>
<ReceiverId>PASHAGROUP</ReceiverId>
<DateTimeStamp>2013-02-12T11:39:14</DateTimeStamp>
<ID>2013000031</ID>
<SchemaVersion>1.0</SchemaVersion>
</Header>
<Transactions>
<Transaction>
<MessageDate>2013-02-12T11:39:19</MessageDate>
<MessageFunction>REISSUE</MessageFunction>
<Carrier>HPG</Carrier>
<Schs Vsl="ALTAMIRA EXPRESS" Lloyds="8501426" Valid="Y" Voy="08W12" Service="MGX" >
<Sch Id="5E4E13FEECB819DB147C0B55B5528642" Act="C">
<Orig Type="POL" Code="GEN" Departs="2013-03-22T18:00:00" PortCutoff="2013-03-18T18:00:00" ></Orig>
<Dest Type="POD" Code="HOU" Arrives="2013-04-17T07:00:00" ></Dest>
</Sch>
<Sch Id="93950283D747605297CA07157CA2B56A" Act="C">
<Orig Type="POL" Code="GEN" Departs="2013-03-22T18:00:00" PortCutoff="2013-03-18T18:00:00" ></Orig>
<Dest Type="POD" Code="NOL" Arrives="2013-04-19T13:00:00" ></Dest>
</Sch>
</Schs>
</Transaction>
</Transactions>
</ServiceSchedules>
*** HOST SERVER RESPONSE ***
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<soap:Fault>
<soap:Code>
<soap:Value>soap:Receiver
</soap:Value>
</soap:Code>
<soap:Reason>
<soap:Text xml:lang="en">
Server was unable to process request. ---> Root element is missing.
</soap:Text>
</soap:Reason>
<soap:Detail />
</soap:Fault>
</soap:Body>
</soap:Envelope>