You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Shravan Mahankali <sh...@catalytic.com> on 2009/01/22 13:46:40 UTC

How to Return XML data from a webservice and how is it consumed?

Hi,

 

Can anyone advise me, how return XML data from a webservice?

 

Also, how a client consuming this service should interpret the output, I
mean what type of data can they expect?

 

Thanks in advance.

 

Thank You,

Shravan Kumar. M 

----------------------------- 

 


Re: How to Return XML data from a webservice and how is it consumed?

Posted by Guo Tianchong <gu...@nec-as.nec.com.cn>.
Please try AXIOM as your operation's return type.

Guo.
  ----- Original Message ----- 
  From: Shravan Mahankali 
  To: axis-user@ws.apache.org 
  Sent: Thursday, January 22, 2009 8:46 PM
  Subject: How to Return XML data from a webservice and how is it consumed?


  Hi,

   

  Can anyone advise me, how return XML data from a webservice?

   

  Also, how a client consuming this service should interpret the output, I mean what type of data can they expect?

   

  Thanks in advance.

   

  Thank You,

  Shravan Kumar. M 

  ----------------------------- 

   

Re: How to Return XML data from a webservice and how is it consumed?

Posted by Wishing Carebear <wi...@gmail.com>.
Hello:I also have a similar requirement. Don't want to use the java classes
but send raw SAOp XML and retrieve the RAW SOAP XML. How can I achieve this
using AXIS2.

Regards,
cabear

On Thu, Jan 22, 2009 at 9:59 AM, Asensio, Rodrigo <
rodrigo.asensio@gilbarco.com> wrote:

> The best way to return raw xml data is using AXIOM I think
>
> Here is a snippet.
>
> public OMElement doSomething() {
>        OMFactory factory = OMAbstractFactory.getOMFactory();
>        OMElement element = Factory.createElement(myNamespace,
> "topelement");
>        element.addAttribute("somekey", "somevalue");
>        return element;
> }
>
> Now, I think the services.xml should have as msg receivers these pair.
>
>
> #message.receiver.inout=org.apache.axis2.receivers.RawXMLINOutMessageReceiver
>
> #message.receiver.inonly=org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver
>
>
>
>
> From: Kamal Chandana Mettananda [mailto:lkamal@gmail.com]
> Sent: Thursday, January 22, 2009 3:52 PM
> To: axis-user@ws.apache.org
> Subject: Re: How to Return XML data from a webservice and how is it
> consumed?
>
> Hi,
>
> Web service will return a SOAP xml file. By generating the client side
> classes and using Axis you can map the resulting SOAP xml data into the
> required class objects.
>
>
> Kamal Mettananda
> http://lkamal.blogspot.com
>
> On Thu, Jan 22, 2009 at 6:16 PM, Shravan Mahankali <
> shravan.mahankali@catalytic.com> wrote:
> Hi,
>
> Can anyone advise me, how return XML data from a webservice?
>
> Also, how a client consuming this service should interpret the output, I
> mean what type of data can they expect?
>
> Thanks in advance.
>
> Thank You,
> Shravan Kumar. M
> -----------------------------
>
>
>
> Please be advised that this email may contain confidential information.
>  If you are not the intended recipient, please do not read, copy or
> re-transmit this email.  If you have received this email in error,
> please notify us by email by replying to the sender and by telephone
> (call us collect at +1 202-828-0850) and delete this message and any
> attachments.  Thank you in advance for your cooperation and assistance.
>
> In addition, Danaher and its subsidiaries disclaim that the content of
> this email constitutes an offer to enter into, or the acceptance of,
> any
> contract or agreement or any amendment thereto; provided that the
> foregoing disclaimer does not invalidate the binding effect of any
> digital or other electronic reproduction of a manual signature that is
> included in any attachment to this email.
>

RE: rpc vs jax-ws

Posted by "Asensio, Rodrigo" <ro...@gilbarco.com>.
All right, I did some jax-ws pure stuff without using axis.
I downloaded latest version of jax-ws lib at
https://jax-ws.dev.java.net/2.1.5/JAXWS2.1.5-20081030.jar and create a
new webapp at my tomcat
With a web.xml with this content:

<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
	<listener>
	
<listener-class>com.sun.xml.ws.transport.http.servlet.WSServletContextLi
stener</listener-class>
	</listener>
	<servlet>
		<servlet-name>myservice</servlet-name>
	
<servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-
class>
		<load-on-startup>0</load-on-startup>
	</servlet>
	<servlet-mapping>
		<servlet-name>myservice</servlet-name>
		<url-pattern>/dostuff</url-pattern>
	</servlet-mapping>
	<session-config>
		<session-timeout>30</session-timeout>
	</session-config>
</web-app>

And other file  sun-jaxws.xml (also in WEB-INF)

<endpoints xmlns="http://java.sun.com/xml/ns/jax-ws/ri/runtime"
version="2.0"> 
 
  <endpoint 
    name="Myservice"
    implementation="MyService"
    url-pattern="/dostuff"/> 
      
</endpoints>

Just started my tomcat and magic!! The jax-ws worked perfectly!

Now, how this thing is integrated with axis2 ????? I didn't see the libs
of jax-ws at axis2, is it a separated download? All the .aar file is
needed ???

Regards
R

-----Original Message-----
From: Asensio, Rodrigo [mailto:rodrigo.asensio@gilbarco.com] 
Sent: Thursday, January 22, 2009 4:21 PM
To: axis-user@ws.apache.org
Subject: rpc vs jax-ws

My customer uses as client generator Microsoft BizTalk and I'm testing a
generator with netbeans.
I'm using axis2 as server with these message inout at the service.xml

#message.receiver.inout=org.apache.axis2.rpc.receivers.RPCMessageReceive
r
#message.receiver.inonly=org.apache.axis2.rpc.receivers.RPCInOnlyMessage
Receiver

I'm returning POJO objects and arrays.

Everything works perfectly if I do in the client side something like
this

			String url =
"http://localhost/axis/services/myservice";
			ServiceClient client = new ServiceClient();
			Options opts = new Options();
			opts.setTimeOutInMilliSeconds(360000);
			opts.setTo(new EndpointReference(url));
			opts.setAction("dosomething");
			client.setOptions(opts);
			OMElement res = client.sendReceive(payload);

The returning element is what I want, everything worked perfectly.

Now, is this webservice RPC style, right ? not jax-ws ?
Netbeans and biztalk generates the client stub but when executed nothing
is filled (xml back seems OK), all objects are null.

Should I develop jax-ws ???
Now, to develop jax-ws, I have to use annotations, right, like
@WebService and @WebMethod....

I'm kind of lost. Thanks for your help.

Regards

Rodrigo Asensio
http://www.rodrigoasensio.com


Please be advised that this email may contain confidential information.
 If you are not the intended recipient, please do not read, copy or
re-transmit this email.  If you have received this email in error,
please notify us by email by replying to the sender and by telephone
(call us collect at +1 202-828-0850) and delete this message and any
attachments.  Thank you in advance for your cooperation and assistance.

In addition, Danaher and its subsidiaries disclaim that the content of
this email constitutes an offer to enter into, or the acceptance of, 
any
contract or agreement or any amendment thereto; provided that the
foregoing disclaimer does not invalidate the binding effect of any
digital or other electronic reproduction of a manual signature that is
included in any attachment to this email.


Please be advised that this email may contain confidential information.
 If you are not the intended recipient, please do not read, copy or
re-transmit this email.  If you have received this email in error,
please notify us by email by replying to the sender and by telephone
(call us collect at +1 202-828-0850) and delete this message and any
attachments.  Thank you in advance for your cooperation and assistance.

In addition, Danaher and its subsidiaries disclaim that the content of
this email constitutes an offer to enter into, or the acceptance of, 
any
contract or agreement or any amendment thereto; provided that the
foregoing disclaimer does not invalidate the binding effect of any
digital or other electronic reproduction of a manual signature that is
included in any attachment to this email.

rpc vs jax-ws

Posted by "Asensio, Rodrigo" <ro...@gilbarco.com>.
My customer uses as client generator Microsoft BizTalk and I'm testing a
generator with netbeans.
I'm using axis2 as server with these message inout at the service.xml

#message.receiver.inout=org.apache.axis2.rpc.receivers.RPCMessageReceive
r
#message.receiver.inonly=org.apache.axis2.rpc.receivers.RPCInOnlyMessage
Receiver

I'm returning POJO objects and arrays.

Everything works perfectly if I do in the client side something like
this

			String url =
"http://localhost/axis/services/myservice";
			ServiceClient client = new ServiceClient();
			Options opts = new Options();
			opts.setTimeOutInMilliSeconds(360000);
			opts.setTo(new EndpointReference(url));
			opts.setAction("dosomething");
			client.setOptions(opts);
			OMElement res = client.sendReceive(payload);

The returning element is what I want, everything worked perfectly.

Now, is this webservice RPC style, right ? not jax-ws ?
Netbeans and biztalk generates the client stub but when executed nothing
is filled (xml back seems OK), all objects are null.

Should I develop jax-ws ???
Now, to develop jax-ws, I have to use annotations, right, like
@WebService and @WebMethod....

I'm kind of lost. Thanks for your help.

Regards

Rodrigo Asensio
http://www.rodrigoasensio.com


Please be advised that this email may contain confidential information.
 If you are not the intended recipient, please do not read, copy or
re-transmit this email.  If you have received this email in error,
please notify us by email by replying to the sender and by telephone
(call us collect at +1 202-828-0850) and delete this message and any
attachments.  Thank you in advance for your cooperation and assistance.

In addition, Danaher and its subsidiaries disclaim that the content of
this email constitutes an offer to enter into, or the acceptance of, 
any
contract or agreement or any amendment thereto; provided that the
foregoing disclaimer does not invalidate the binding effect of any
digital or other electronic reproduction of a manual signature that is
included in any attachment to this email.

which version of axis support http digest ??

Posted by umesh barik <um...@yahoo.com>.
Hi All,
Can anybody let me know which version of Axis supports HTTP digest authentication. My project wants me to support HTTP Digest but unfortunately Axis 1.2 does not support that. Please suggest me.
 
Thanks in advance
Umesh



      

RE: How to Return XML data from a webservice and how is it consumed?

Posted by "Asensio, Rodrigo" <ro...@gilbarco.com>.
The best way to return raw xml data is using AXIOM I think

Here is a snippet.

public OMElement doSomething() {
	OMFactory factory = OMAbstractFactory.getOMFactory();
	OMElement element = Factory.createElement(myNamespace, "topelement");
	element.addAttribute("somekey", "somevalue");
	return element;	
}

Now, I think the services.xml should have as msg receivers these pair.

#message.receiver.inout=org.apache.axis2.receivers.RawXMLINOutMessageReceiver
#message.receiver.inonly=org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver




From: Kamal Chandana Mettananda [mailto:lkamal@gmail.com] 
Sent: Thursday, January 22, 2009 3:52 PM
To: axis-user@ws.apache.org
Subject: Re: How to Return XML data from a webservice and how is it consumed?

Hi, 

Web service will return a SOAP xml file. By generating the client side classes and using Axis you can map the resulting SOAP xml data into the required class objects.


Kamal Mettananda
http://lkamal.blogspot.com

On Thu, Jan 22, 2009 at 6:16 PM, Shravan Mahankali <sh...@catalytic.com> wrote:
Hi,
 
Can anyone advise me, how return XML data from a webservice?
 
Also, how a client consuming this service should interpret the output, I mean what type of data can they expect?
 
Thanks in advance.
 
Thank You,
Shravan Kumar. M 
----------------------------- 
 


Please be advised that this email may contain confidential information.
 If you are not the intended recipient, please do not read, copy or
re-transmit this email.  If you have received this email in error,
please notify us by email by replying to the sender and by telephone
(call us collect at +1 202-828-0850) and delete this message and any
attachments.  Thank you in advance for your cooperation and assistance.

In addition, Danaher and its subsidiaries disclaim that the content of
this email constitutes an offer to enter into, or the acceptance of, 
any
contract or agreement or any amendment thereto; provided that the
foregoing disclaimer does not invalidate the binding effect of any
digital or other electronic reproduction of a manual signature that is
included in any attachment to this email.

Re: How to Return XML data from a webservice and how is it consumed?

Posted by Kamal Chandana Mettananda <lk...@gmail.com>.
Hi,

Web service will return a SOAP xml file. By generating the client side
classes and using Axis you can map the resulting SOAP xml data into the
required class objects.


Kamal Mettananda
http://lkamal.blogspot.com


On Thu, Jan 22, 2009 at 6:16 PM, Shravan Mahankali <
shravan.mahankali@catalytic.com> wrote:

>  Hi,
>
>
>
> Can anyone advise me, how return XML data from a webservice?
>
>
>
> Also, how a client consuming this service should interpret the output, I
> mean what type of data can they expect?
>
>
>
> Thanks in advance.
>
>
>
> Thank You,
>
> Shravan Kumar. M
>
> -----------------------------
>
>
>