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 = "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
receivers. So 'use the source'  ;-) .


http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/RPCCallTest.java?revision=526324&view=markup

HTH,
Robert

On 6/13/07, Rick Reumann <[EMAIL PROTECTED]> wrote:
>
> 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/DataHandler.html
> DataHandler wants a DataSource or else Object, String mimetype. The
> DataSource objects don't seem to have a String implementation so that
> doesn't help and not sure what to set for object,  or the mimetype.
>
> Am I just being really stupid or has it always been this much of a
> pain to send some simple xml? (I'm still new to using web services so
> not sure how things were in the past.)  What seems odd is when I
> google on the issue not a lot comes about it which makes me think I'm
> just missing something fundamental.
>
> Thanks again for the help.
>
> On 6/13/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.  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:
> > >
> > > 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 help though - I'm a bit unsure how implement
> > > the client stub that gets generated based off the method:
> > > getResults(byte[] bytes)
> > >
> > > Where I'm running into trouble is that the client stub seems to want
> > > to use a DataHandler? Instead of dealing with a byte[] it's dealing
> > > with this DataHandler that I'm unsure how to set this up with my
> byte
> > > array?
> > >
> > > I have..
> > > GetResults params = new GetResults();
> > > params.localBytes = //wants an instance of DataHandler which I'm
> > > assuming needs my byte[]? but not sure how to set that up
> > >
> > > then I can call
> > > stub.getResults(params);
> > >
> > > Thanks for some help.
> > >
> > > Original message thread below for reference.
> > >
> > > ------------------------------------
> > >
> > > > On 6/13/07, Rick Reumann < [EMAIL PROTECTED]> wrote:
> > > > >
> > > > > 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
> > > > > plugin) and if I pass in a simple String like "Hello World,"
> > > > > everything is fine. However, when I try to send some XML as a
> String,
> > > > > I end up with the service never receiving the XML and get an
> error
> > > > > like:
> > > > >
> > > > > org.apache.axis2.AxisFault :
> > > > com.ctc.wstx.exc.WstxParsingException:
> > > > > Unexpected close tag </body>; expected </HR>.
> > > > > at [row,col {unknown-source}]: [11,187]
> > > > >         at
> > > >
> > org.apache.axis2.transport.TransportUtils.createSOAPMessage
> > (TransportUtils.java:81)
> > > > >         at
> > > >
> > org.apache.axis2.description.OutInAxisOperationClient.send(
> OutInAxisOperation.java:356)
> > > > >         at
> > > >
> > org.apache.axis2.description.OutInAxisOperationClient.execute
> > > > (OutInAxisOperation.java:294)
> > > > >         at
> > > >
> >
> 
com.nielsen.webservices.SampleWebServiceSampleWebServiceHttpportStub.getResults
> (SampleWebServiceSampleWebServiceHttpportStub.java :164)
> > > > >         at com.nielsen.webservices.Client.main
> > > > (Client.java:31)
> > > > >
> > > > >
> > > > > I even tried wrapping the String with <![CDATA[ ]]> but it
> didn't seem
> > > > > to help. What is the best way to send XML over the wire to an
> exposed
> > > > > service?
> > > > >
> > > > > --
> > > > > Rick
> > >
> > >
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> >
>
>
> --
> Rick
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to