Hi Larry,

Sorry, that <code> was my posting to a forum vs e-mail list brain snap...

I've since discovered that for my XML example (among others) to be included as 
the payload for a JSON object then all the "JSON illegal chars" (e.g. ", /, \) 
in the XML need to be escaped (e.g. \", \/,\\).

With this basic filter in place both ends I can do what I want and at least 
evaluate the results etc. without (yet) having to JSON-ize our code.

I'm also looking into direct socket comms as suggested by our VAR too as well 
as SOAP as suggested by Kurt.

Many thanks for the replies.

Cheers
Peter

________________________________________
From: u2-users-boun...@listserver.u2ug.org 
[u2-users-boun...@listserver.u2ug.org] on behalf of Larry Hiscock 
[lar...@wcs-corp.com]
Sent: Thursday, 22 August 2013 1:29 AM
To: 'U2 Users List'
Subject: Re: [U2] Exchanging XML data instead of JSON between hosts via RESTful 
Server

>> <code>
{"batchRequests": {"BatchRequest": {"referenceNumber":
"f549c4dd-01f4-4b9b-99e2-6dd6862cf364","serviceRequest": {"SERVICE":
{"-name":"VALID.POST.CODE","PORTAL_USER_ID": "testuser","POSTCODE":
"4300","SUBURB": "GOODNA"}}}}} </code>

Curious why you're mixing XML & JSON in your "converted" example?

Shouldn't that read:

{"code":
  {"batchRequests":
    {"BatchRequest":
      {"referenceNumber": "f549c4dd-01f4-4b9b-99e2-6dd6862cf364",
       "serviceRequest":
         {"SERVICE":
           {"-name":"VALID.POST.CODE",
            "PORTAL_USER_ID": "testuser",
            "POSTCODE": "4300",
            "SUBURB": "GOODNA"}
         }
       }
     }
   }
}


Larry Hiscock
Western Computer Services

-----Original Message-----
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Peter Cheney
Sent: Wednesday, August 21, 2013 12:30 AM
To: 'U2 Users List' ‎[u2-users@listserver.u2ug.org]‎
Subject: [U2] Exchanging XML data instead of JSON between hosts via RESTful
Server

Hi Everyone,

Is it possible to configure a RESTful service subroutine to accept XML as
the input to one of its defined parameters?

I keep getting the following error:
500:
Expected+a+','+or+'}'com.rs.u2.u2rest.marshaller.U2JSONTokenizer@13c33b7

The subroutine has 2 parameters XML.IN in Position 1 and XML.OUT in Position
2. Each type is set to string.

Normally this program is used elsewhere in our other services so it is
already XML ready.

I've converted my test xml to json and tried that. While the error
disappears the response while valid xml (output from the program) is
otherwise empty. (I changed the type from string to json too).

If I key in any random string I get the same valid yet empty program
response.

So how do I configure the server to pass this xml string straight to the
subroutine?
Perhaps I need to convert some of the characters (e.g. '/' in the xml below
as per uri requirements?
Is it possible or am I way off course here?

Sample xml:
<code>
<batchRequests><BatchRequest><referenceNumber>f549c4dd-01f4-4b9b-99e2-6dd686
2cf364</referenceNumber><serviceRequest><SERVICE
name="VALID.POST.CODE"><PORTAL_USER_ID>testuser</PORTAL_USER_ID><POSTCODE>43
00</POSTCODE><SUBURB>GOODNA</SUBURB></SERVICE></serviceRequest></BatchReques
t></batchRequests>
</code>

Converted to json:
<code>
{"batchRequests": {"BatchRequest": {"referenceNumber":
"f549c4dd-01f4-4b9b-99e2-6dd6862cf364","serviceRequest": {"SERVICE":
{"-name":"VALID.POST.CODE","PORTAL_USER_ID": "testuser","POSTCODE":
"4300","SUBURB": "GOODNA"}}}}} </code>

Many thanks in advance.
Cheers
Peter




[Description: Description:
https://www.firstmac.com.au]<http://www.firstmac.com.au/>

Peter Cheney

Universe Engineer

t 07 3017 8837 | f 07 3002 8400

e peter.che...@firstmac.com.au<mailto:peter.che...@firstmac.com.au> | w
www.firstmac.com.au<https://www.www.firstmac.com.au/>




----------------------------------------------------------------------------
---
Note:
This email (inc all attachments) is for the use of the intended recipient(s)
only.
Privileged or confidential information may be contained in this
communication. If you have received this email in error, please notify the
sender immediately and then delete all copies of this message from your
computer network. If you are not the intended recipient, you must not keep,
use, disclose, copy or distribute this email without the author's prior
permission. If you are the intended recipient and you do not wish to receive
similar electronic messages from us in future, then please respond to the
sender to this effect.
We have taken precautions to minimise the risk of transmitting software
viruses, but advise you to carry out your own virus checks on this email and
its attachments. We do not accept liability for any loss or damage caused by
software viruses and do not represent that this transmission is free from
viruses or other defects.
Firstmac Limited (ABN 59 094 145 963) (AFSL 290600)

----------------------------------------------------------------------------
---
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

 -------------------------------------------------------------------------------
Note: 
This email (inc all attachments) is for the use of the intended recipient(s) 
only.
Privileged or confidential information may be contained in this communication. 
If you have received this email in error, please notify the sender immediately 
and then delete all copies of this message from your computer network. If you 
are not the intended recipient, you must not keep, use, disclose, copy or 
distribute this email without the author's prior permission. If you are the 
intended recipient and you do not wish to receive similar electronic messages 
from us in future, then please respond to the sender to this effect. 
We have taken precautions to minimise the risk of transmitting software 
viruses, but advise you to carry out your own virus checks on this email and 
its attachments. We do not accept liability for any loss or damage caused by 
software viruses and do not represent that this transmission is free from 
viruses or other defects. 
Firstmac Limited (ABN 59 094 145 963) (AFSL 290600) 
 -------------------------------------------------------------------------------
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to