RE: Problems trying to send XML as a String to a web service?

2007-06-14 Thread Rudolph, Troy
@ws.apache.org Subject: Problems trying to send XML as a String to a web service? I have an Axis2 service set up. It's super simple. I want the user to be able to send some XML to the service so I figured I'd set up my POJO service to just accept a String... public String getResults( Stri

Re: Problems trying to send XML as a String to a web service?

2007-06-14 Thread robert lazarski
On 6/14/07, Rick Reumann <[EMAIL PROTECTED]> wrote: On 6/14/07, robert lazarski <[EMAIL PROTECTED]> wrote: ? > > Sorry, I thought you were using POJO's . I guess I should be sorry, I must have confused you, I am using POJOS. Here is exactly how I started down this bunny trail... 1) Got require

Re: Problems trying to send XML as a String to a web service?

2007-06-14 Thread Rick Reumann
On 6/14/07, robert lazarski <[EMAIL PROTECTED]> wrote: ? Sorry, I thought you were using POJO's . I guess I should be sorry, I must have confused you, I am using POJOS. Here is exactly how I started down this bunny trail... 1) Got requirement for this small demo that we need to call a service

Re: Problems trying to send XML as a String to a web service?

2007-06-14 Thread robert lazarski
On 6/14/07, Rick Reumann <[EMAIL PROTECTED]> wrote: On 6/14/07, robert lazarski <[EMAIL PROTECTED]> wrote: > Rick, to send a byte array is easy. Try the following: > > ArrayList args = new ArrayList(); > String hello = "hello"; > args.add(hello.getBytes()); > OMElement response = sender.invokeBl

Re: Problems trying to send XML as a String to a web service?

2007-06-14 Thread Rick Reumann
On 6/14/07, robert lazarski <[EMAIL PROTECTED]> wrote: Rick, to send a byte array is easy. Try the following: ArrayList args = new ArrayList(); String hello = "hello"; args.add(hello.getBytes()); OMElement response = sender.invokeBlocking(operationName, args.toArray()); Hint: POJO's use the RPC

Re: Problems trying to send XML as a String to a web service?

2007-06-14 Thread Chad DeBauch
Rick...another way you can do this is, put the simple xml in the wsdl, the web service will then validate and parse the xml. Chad On 6/14/07, robert lazarski <[EMAIL PROTECTED]> wrote: Rick, to send a byte array is easy. Try the following: ArrayList args = new ArrayList(); String hello = "hel

Re: Problems trying to send XML as a String to a web service?

2007-06-14 Thread robert lazarski
Rick, to send a byte array is easy. Try the following: ArrayList args = new ArrayList(); String hello = "hello"; args.add(hello.getBytes()); OMElement response = sender.invokeBlocking(operationName, args.toArray()); Hint: POJO's use the RPCMessageReceiver. There are unit tests for all the receiv

Re: Problems trying to send XML as a String to a web service?

2007-06-13 Thread Rick Reumann
On 6/13/07, Xinjun Chen <[EMAIL PROTECTED]> wrote: The solution I adopted is to use CDATA instead of string. You don't need to do escaping by yourself. Your saying use the jdom CDATA object as the service method argument? I wouldn't think this would be a good idea since how would the client gen

Re: Problems trying to send XML as a String to a web service?

2007-06-13 Thread Rick Reumann
I might try that Chad since right now I'm pretty stuck. I wouldn't mind using they byte[] approach but I'm stumped on what to do with the Axis2 client generated stub that wants a DataHandler for the Request object. Looking at the docs http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/activation/

Re: Problems trying to send XML as a String to a web service?

2007-06-13 Thread Xinjun Chen
The solution I adopted is to use CDATA instead of string. You don't need to do escaping by yourself. Regards, Xinjun On 6/14/07, Chad DeBauch <[EMAIL PROTECTED]> wrote: Another approach I have taken is have the service accept a string like you originally did but encode it in UTF-8 encoding. T

Re: Problems trying to send XML as a String to a web service?

2007-06-13 Thread Chad DeBauch
Another approach I have taken is have the service accept a string like you originally did but encode it in UTF-8 encoding. The downside to this is that clients will need to know that you are expecting a string that is in UTF-8 encoding. Chad On 6/13/07, Rick Reumann <[EMAIL PROTECTED]> wrote:

Re: Problems trying to send XML as a String to a web service?

2007-06-13 Thread Rick Reumann
On 6/13/07, robert lazarski <[EMAIL PROTECTED]> wrote: I tend to tackle this in two ways: Convert / unconvert the string to base64 and send it that way. Or use mtom and send the string as an attachment. Thanks Robert. I figured I'd try just using a byte array to start with. Maybe someone can he

Re: Problems trying to send XML as a String to a web service?

2007-06-13 Thread robert lazarski
I tend to tackle this in two ways: Convert / unconvert the string to base64 and send it that way. Or use mtom and send the string as an attachment. Someone else may be able to comment on getting the actual string escaped correctly inside the soap body, but I tend not to bother. HTH, Robert On 6

Problems trying to send XML as a String to a web service?

2007-06-13 Thread Rick Reumann
I have an Axis2 service set up. It's super simple. I want the user to be able to send some XML to the service so I figured I'd set up my POJO service to just accept a String... public String getResults( String xmlSpec) { ... } I built my client stubs with java2wsdl (actually used Eclipse's plugi