Hi all,
I am trying to POST an XML to php based Web Service via HTTP POST method. The php form of the target system is something like this :
[PHP]<?php
$xmlstring = '<?xml version="1.0" ?>';
$xmlstring .= '<data>';
$xmlstring .= '<ordernum>1234567890123</ordernum>';
$xmlstring .= '<custname>RUSDY AB. AZIZ</custname>';
$xmlstring .= '<mobilenum>0136130702</mobilenum>';
$xmlstring .= '<orderstatus>OnHold</orderstatus>';
$xmlstring .= '<prodtype>STX</prodtype>';
$xmlstring .= '</data>';
?>
<form name="icp2swans" method="POST" action="http://n9.intra.tm/swans/openapi/icpwaiters.php">
<!--- <form name="icp2swans" method="POST" action="icpwaiters.php"> --->
<!--- <input type="hidden" name="secretkey" value="ef6bf191c37ff1a78633dca0434ef147"> --->
<p>XML Text :</p> <!--- <input type="text" name="ordernum" value="123456789012345" size="15"><br> --->
<textarea name="xmldata" rows="10" cols="100"><?php echo $xmlstring; ?></textarea>
<p><input type="submit" value="Submit"></p>
</form>[/PHP]
My
java code is that doe the POST action is something like this:
The XML that is to be sent is :
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<data>
<ordernum>1-J0K0Y</ordernum>
<custname>Ashwaq</custname>
<mobilenum>0125598693</mobilenum>
<orderstatus>Submitted</orderstatus>
<prodtype>DEL</prodtype>
</data>
The problem is that the programme does send the XML to the target system, however the target is returning a result that is indicates an error;
<?xml version="1.0" ?>
<data>
<errorcode>1</errorcode>
<errormsg>XML text was Empty. Sorry, you have submitted an empty form</errormsg>
</data>
According to the administrator of the target system, the error is due to the fact that the something in my HTTP message(the envelope must I presume) must conform to the name attribute of the textarea element in his php form. He even gave me a fragment of his code:
Input name: “xmldata”
This is the first time I am working with a code that requires me to interface with a php based system. I don't even know what I assumed above is correct in fact I don't know PHP. Please help. If any of the info is not clear please let me know.I will feedback ASAP. Really urgent. Thank you all in advance.