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 Daniel Silva <da...@alert.pt> on 2008/03/07 11:44:03 UTC
Axis2 Sockets
Hi,
I have a web service based on axis2.
I need to send the response over the same socket of the request. It seems this is not happening using newMsgContext.setEnvelope(envelope) method.
However the Service_MessageReceiverInOut class extends AbstractInOutSyncMessageReceiver. Shouldn't this be synchronized over the same socket?
Is there any Option/Property/Configuration to set this?
Thanks in advance.
Best regards,
Daniel Silva
Software Developer
daniel.silva@alert.pt <ma...@alert.pt>
www.alert-online.com <http://www.alert-online.com>
ALERT Life Sciences Computing, S.A.
Edifício Lake Towers
Rua Daciano Baptista Marques, n.º 245, Bloco D
4400-617 Vila Nova de Gaia
Tel.: +351 22 832 89 80/1
Fax: +351 22 832 89 82
info@alert.pt <ma...@alert.pt>
This e-mail is privileged, confidential and contains private information. Any reading, retention, distribution or copying of this communication by any person other than its intended recipient is prohibited.
Re: Axis2 Sockets
Posted by Michele Mazzucco <Mi...@ncl.ac.uk>.
Daniel,
this sounds wrong to me. Can you post your client code please?
Michele
On 10 Mar 2008, at 19:13, Daniel Silva wrote:
> Hi,
>
> Thank you all for the provided help.
> In fact, the incoming message has a ws-addressing "reply-to" EPR
> pointing to another listener. This is the problem.
> When the response MessageContext is created, this values are
> automatically fielded.
> If I set "To" as: "newMsgContext.setTo(new EndpointReference
> ("http://www.w3.org/2005/08/addressing/anonymous"));" it works.
>
> Thank you.
>
> Best regards,
>
> Daniel Silva
> Software Developer
>
> daniel.silva@alert.pt
> www.alert-online.com
>
> ALERT Life Sciences Computing, S.A.
> Edifício Lake Towers
> Rua Daciano Baptista Marques, n.º 245, Bloco D
> 4400-617 Vila Nova de Gaia
>
> Tel.: +351 22 832 89 80/1
> Fax: +351 22 832 89 82
>
>
>
> This e-mail is privileged, confidential and contains private
> information. Any reading, retention, distribution or copying of
> this communication by any person other than its intended recipient
> is prohibited.
>
>
> -----Original Message-----
> From: Thilina Gunarathne [mailto:csethil@gmail.com]
> Sent: domingo, 9 de Março de 2008 20:33
> To: axis-user@ws.apache.org
> Subject: Re: Axis2 Sockets
>
> oh.. Sorry for the confusion.. That's exactly what I meant. .Using the
> same socket is the default..
>
> ~Thilina
>
> On Fri, Mar 7, 2008 at 11:34 AM, Michele Mazzucco
> <Mi...@ncl.ac.uk> wrote:
>> Why? If the MEP is in/out with no complications (i.e. synchronous and
>> with no redirections) you should be able to use the same socket.
>>
>> Michele
>>
>>
>>
>> On 7 Mar 2008, at 16:11, Thilina Gunarathne wrote:
>>
>>> AFAIK it's the default behavior in case of request/response
>>> interaction
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>
>>
>
>
>
> --
> Thilina Gunarathne - http://thilinag.blogspot.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
RE: Axis2 Sockets
Posted by Daniel Silva <da...@alert.pt>.
Hi,
Thank you all for the provided help.
In fact, the incoming message has a ws-addressing "reply-to" EPR pointing to another listener. This is the problem.
When the response MessageContext is created, this values are automatically fielded.
If I set "To" as: "newMsgContext.setTo(new EndpointReference("http://www.w3.org/2005/08/addressing/anonymous"));" it works.
Thank you.
Best regards,
Daniel Silva
Software Developer
daniel.silva@alert.pt
www.alert-online.com
ALERT Life Sciences Computing, S.A.
Edifício Lake Towers
Rua Daciano Baptista Marques, n.º 245, Bloco D
4400-617 Vila Nova de Gaia
Tel.: +351 22 832 89 80/1
Fax: +351 22 832 89 82
This e-mail is privileged, confidential and contains private information. Any reading, retention, distribution or copying of this communication by any person other than its intended recipient is prohibited.
-----Original Message-----
From: Thilina Gunarathne [mailto:csethil@gmail.com]
Sent: domingo, 9 de Março de 2008 20:33
To: axis-user@ws.apache.org
Subject: Re: Axis2 Sockets
oh.. Sorry for the confusion.. That's exactly what I meant. .Using the
same socket is the default..
~Thilina
On Fri, Mar 7, 2008 at 11:34 AM, Michele Mazzucco
<Mi...@ncl.ac.uk> wrote:
> Why? If the MEP is in/out with no complications (i.e. synchronous and
> with no redirections) you should be able to use the same socket.
>
> Michele
>
>
>
> On 7 Mar 2008, at 16:11, Thilina Gunarathne wrote:
>
> > AFAIK it's the default behavior in case of request/response
> > interaction
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
--
Thilina Gunarathne - http://thilinag.blogspot.com
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
Re: Axis2 Sockets
Posted by Thilina Gunarathne <cs...@gmail.com>.
oh.. Sorry for the confusion.. That's exactly what I meant. .Using the
same socket is the default..
~Thilina
On Fri, Mar 7, 2008 at 11:34 AM, Michele Mazzucco
<Mi...@ncl.ac.uk> wrote:
> Why? If the MEP is in/out with no complications (i.e. synchronous and
> with no redirections) you should be able to use the same socket.
>
> Michele
>
>
>
> On 7 Mar 2008, at 16:11, Thilina Gunarathne wrote:
>
> > AFAIK it's the default behavior in case of request/response
> > interaction
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
--
Thilina Gunarathne - http://thilinag.blogspot.com
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
Re: Axis2 Sockets
Posted by Ajith Ranabahu <aj...@gmail.com>.
Just to give my 2 cents on this
You can generate classes with no databinding (-d none option) so you
get access to your raw xml message inside the skeleton
Ajith
2008/3/7 Daniel Silva <da...@alert.pt>:
> Hi,
>
> I will explain what I'm doing.
> I'm developing a web service (server side) based on a predefined standard wsdl.
> I used wsdl2java to generate server side web service skeleton.
> I have the generated classes for types defined on schemas, the Skeleton (and Skeleton interface) and MessageReceiverInOut class.
> As I just need the received data in XML format, I will apply xsl tranformation to compose the response. I don't need to parse the XML to objects.
> So, I don't want that invokeBusinessLogic method calls fromOM method and I don't want an object from skeleton implementation.
> I implemented a myToEnvelope method to compose the XML response based on the received MessageContext. Having the response XML according to the defined return type I put it in a SOAPEnvelope and then set and send it by newMsgContext.setEnvelope(envelope).
>
> So, my MessageReceiverInOut class is something like this:
>
> (...)
> public void invokeBusinessLogic(org.apache.axis2.context.MessageContext msgContext, org.apache.axis2.context.MessageContext newMsgContext)
> throws org.apache.axis2.AxisFault{
>
>
> try {
>
> // get the implementation class for the Web Service
> Object obj = getTheImplementationObject(msgContext);
>
> PIXManager_ServiceSkeletonInterface skel = (PIXManager_ServiceSkeletonInterface)obj;
> //Out Envelop
> org.apache.axiom.soap.SOAPEnvelope envelope = null;
> //Find the axisOperation that has been set by the Dispatch phase.
> org.apache.axis2.description.AxisOperation op = msgContext.getOperationContext().getAxisOperation();
>
> if (op == null) {
> throw new org.apache.axis2.AxisFault("Operation is not located, if this is doclit style the SOAP-ACTION should specified via the SOAP Action to use the RawXMLProvider");
> }
>
> java.lang.String methodName;
> if((op.getName() != null) && ((methodName = org.apache.axis2.util.JavaUtils.xmlNameToJava(op.getName().getLocalPart())) != null)){
>
>
> if("PIXManager_PRPA_IN201301UV".equals(methodName)){
> envelope = myToEnvelope(msgContext);
> (...)
> newMsgContext.setEnvelope(envelope);
> (...)
>
>
> I can run this successfully with a client generated with wsdl2java, but when the request is made by other application the response is not sent (I'm tracing this with wireshark). I can handle both requests but the response is not sent in second case.
> In this moment I'm not sure what the cause for this.
> I attached the request messages: from our application client (that works) our.xml; and otherClient.xml that fails.
>
> Thank you in advance.
>
> Best regards,
> Daniel Silva
>
>
>
>
> -----Original Message-----
> From: Michele Mazzucco [mailto:Michele.Mazzucco@ncl.ac.uk]
> Sent: sexta-feira, 7 de Março de 2008 16:34
> To: axis-user@ws.apache.org
> Subject: Re: Axis2 Sockets
>
> Why? If the MEP is in/out with no complications (i.e. synchronous and
> with no redirections) you should be able to use the same socket.
>
> Michele
>
>
> On 7 Mar 2008, at 16:11, Thilina Gunarathne wrote:
>
> > AFAIK it's the default behavior in case of request/response
> > interaction
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
--
Ajith Ranabahu
Reading, after a certain age, diverts the mind too much from its
creative pursuits. Any man who reads too much and uses his own brain
too little falls into lazy habits of thinking - Albert Einstein
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
RE: Axis2 Sockets
Posted by Daniel Silva <da...@alert.pt>.
Hi,
I will explain what I'm doing.
I'm developing a web service (server side) based on a predefined standard wsdl.
I used wsdl2java to generate server side web service skeleton.
I have the generated classes for types defined on schemas, the Skeleton (and Skeleton interface) and MessageReceiverInOut class.
As I just need the received data in XML format, I will apply xsl tranformation to compose the response. I don't need to parse the XML to objects.
So, I don't want that invokeBusinessLogic method calls fromOM method and I don't want an object from skeleton implementation.
I implemented a myToEnvelope method to compose the XML response based on the received MessageContext. Having the response XML according to the defined return type I put it in a SOAPEnvelope and then set and send it by newMsgContext.setEnvelope(envelope).
So, my MessageReceiverInOut class is something like this:
(...)
public void invokeBusinessLogic(org.apache.axis2.context.MessageContext msgContext, org.apache.axis2.context.MessageContext newMsgContext)
throws org.apache.axis2.AxisFault{
try {
// get the implementation class for the Web Service
Object obj = getTheImplementationObject(msgContext);
PIXManager_ServiceSkeletonInterface skel = (PIXManager_ServiceSkeletonInterface)obj;
//Out Envelop
org.apache.axiom.soap.SOAPEnvelope envelope = null;
//Find the axisOperation that has been set by the Dispatch phase.
org.apache.axis2.description.AxisOperation op = msgContext.getOperationContext().getAxisOperation();
if (op == null) {
throw new org.apache.axis2.AxisFault("Operation is not located, if this is doclit style the SOAP-ACTION should specified via the SOAP Action to use the RawXMLProvider");
}
java.lang.String methodName;
if((op.getName() != null) && ((methodName = org.apache.axis2.util.JavaUtils.xmlNameToJava(op.getName().getLocalPart())) != null)){
if("PIXManager_PRPA_IN201301UV".equals(methodName)){
envelope = myToEnvelope(msgContext);
(...)
newMsgContext.setEnvelope(envelope);
(...)
I can run this successfully with a client generated with wsdl2java, but when the request is made by other application the response is not sent (I'm tracing this with wireshark). I can handle both requests but the response is not sent in second case.
In this moment I'm not sure what the cause for this.
I attached the request messages: from our application client (that works) our.xml; and otherClient.xml that fails.
Thank you in advance.
Best regards,
Daniel Silva
-----Original Message-----
From: Michele Mazzucco [mailto:Michele.Mazzucco@ncl.ac.uk]
Sent: sexta-feira, 7 de Março de 2008 16:34
To: axis-user@ws.apache.org
Subject: Re: Axis2 Sockets
Why? If the MEP is in/out with no complications (i.e. synchronous and
with no redirections) you should be able to use the same socket.
Michele
On 7 Mar 2008, at 16:11, Thilina Gunarathne wrote:
> AFAIK it's the default behavior in case of request/response
> interaction
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
Re: Axis2 Sockets
Posted by Michele Mazzucco <Mi...@ncl.ac.uk>.
Why? If the MEP is in/out with no complications (i.e. synchronous and
with no redirections) you should be able to use the same socket.
Michele
On 7 Mar 2008, at 16:11, Thilina Gunarathne wrote:
> AFAIK it's the default behavior in case of request/response
> interaction
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
Re: Axis2 Sockets
Posted by Thilina Gunarathne <cs...@gmail.com>.
AFAIK it's the default behavior in case of request/response
interaction, unless the incoming message had a ws-addressing reply-to
EPR pointing to another listener..
May be I'm missing something.. Can you explain your issue more..
thanks,
Thilina
On Fri, Mar 7, 2008 at 5:44 AM, Daniel Silva <da...@alert.pt> wrote:
>
>
>
>
> Hi,
>
>
>
> I have a web service based on axis2.
>
>
>
> I need to send the response over the same socket of the request. It seems
> this is not happening using newMsgContext.setEnvelope(envelope) method.
>
> However the Service_MessageReceiverInOut class extends
> AbstractInOutSyncMessageReceiver. Shouldn't this be synchronized over the
> same socket?
>
> Is there any Option/Property/Configuration to set this?
>
>
>
> Thanks in advance.
>
>
>
> Best regards,
>
>
>
> Daniel Silva
>
> Software Developer
>
>
>
> daniel.silva@alert.pt
>
> www.alert-online.com
>
>
>
> ALERT Life Sciences Computing, S.A.
>
> Edifício Lake Towers
>
> Rua Daciano Baptista Marques, n.º 245, Bloco D
>
> 4400-617 Vila Nova de Gaia
>
>
>
> Tel.: +351 22 832 89 80/1
>
> Fax: +351 22 832 89 82
>
> info@alert.pt
>
> This e-mail is privileged, confidential and contains private information.
> Any reading, retention, distribution or copying of this communication by any
> person other than its intended recipient is prohibited.
--
Thilina Gunarathne - http://thilinag.blogspot.com
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org