ws-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gulácsi Tamás" <gtho...@fw.hu>
Subject Re: WebServer request converting data issue
Date Wed, 26 Nov 2008 15:05:14 GMT
Hi Debbie,

As I see, you are getting that data in a Map; as I know the spec,
XML-RPC must ve a valid xml. So the sender must quote that xml string
or send it as base64.

Thomas

2008/11/25 DebbieH <dhamning@alpineinc.com>:
>
> I am a newbie to XML-RPC and am using version 3.1.  I am using the WebServer
> class to receive a request from an external partner.  His request consists
> of 2 parameters - an integer and a struct.  The struct has embedded XML
> within it that needs to remain.  All I want to do is get the struct
> parameter as is and dump it to a flat file that will be sent to the shipping
> department.  This parameter must retain the XML tags so they can read the
> file appropriately.  I am receiving the parameter and outputting it to a
> file just fine, except that the XML tags are getting stripped out
> automatically.  I've been trying different things to try to get the data as
> is, but nothing seems to work.  Does anyone have any suggestions?  Here is
> the code I was using:
>
> web server class:
> public class receiveOrdersServer
> {
>
>        private static final int PORT = 80;
>
>    public static void main(String[] args)
>       throws Exception
>    {
>                WebServer webServer = new WebServer(PORT);
>                XmlRpcServer xmlRpcServer = webServer.getXmlRpcServer();
>
>                PropertyHandlerMapping phm = new PropertyHandlerMapping();
>                phm.addHandler("orderDataReceive", orderDataReceive.class);
>
>                xmlRpcServer.setHandlerMapping(phm);
>
>                XmlRpcServerConfigImpl serverConfig =
>                     (XmlRpcServerConfigImpl) xmlRpcServer.getConfig();
>                serverConfig.setEnabledForExtensions(true);
>                serverConfig.setContentLengthOptional(false);
>
>                webServer.start();
>    }
>
> }
>
> -----------------
>
> handler class:
>
> public class orderDataReceive
> {
>   public static final String DATE_FORMAT = "yyyyMMddHHmss";
>
>   private int index;
>   private int pindex;
>   private Object ordDataObj;
>
>
>   public int getOrders(Integer numOrders, HashMap orderData)
>   {
>
>                index = 0;
>                pindex = 0;
>                String orderDataStr;
>
>                // output data to file - append timestamp to file name
>                String newTime = getNewTime();
>                String outFile = "/ShopXML850/inboundfile_" + newTime;
>
>                orderDataStr = orderData.toString();
>
>        try
>        {
>              // write file to the directory
>                FileWriter fileWriter = new FileWriter(outFile);
>                char buffer[] = new char[orderDataStr.length()];
>                // set buffer value here
>                orderDataStr.getChars(0, orderDataStr.length(), buffer, 0);
>                for (int i=0; i < buffer.length; i+=1)
>                {
>                        fileWriter.write(buffer[i]);
>                        }
>                fileWriter.close();
>                return 0;
>            }
> ...
>
> Thanks much for your help.
> --
> View this message in context: http://www.nabble.com/WebServer-request-converting-data-issue-tp20688086p20688086.html
> Sent from the Apache Xml-RPC - User mailing list archive at Nabble.com.
>
>

Mime
View raw message