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 Christophe Noel <Ch...@spacebel.be> on 2011/07/07 10:22:35 UTC

ServiceClient behind an Axis Service

Dear all,

I'm using the Axis2 ServiceClient in order to send a non-blocking request using "separate listeners".

The ServiceClient is used by a thread behind a Axis Web Service. My code works fine as a single application, but, when behind the Axis Service, I cannot receive the Callback.
The possible problem may come from the fact that the ServiceClient creates a listener precisely on the port used by the WPS, and thus, I suppose that the Axis Service (or web.xml) should "forward" the request to the right listener, but I don't know how.

Any help is very welcome.

Note that Axis2 is embedded into an existing application (http://www.developer.com/services/article.php/3777111/Embedding-Apache-Axis2-into-Existing-Applications.htm).

Thanks,

Christophe.

Code used :
                                                setExecuteClient(new ServiceClient()) ;
Options options = new Options();
                  // set the workflow endpoint
                  options.setTo(new EndpointReference(processesPrefix+algorithmID));
                  options.setUseSeparateListener(true);
                  options.setAction("urn:executeResponseCallback");
                  options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
                  // use WS-Adressing (to perform asynchronous request)
                  getExecuteClient().engageModule("addressing");
                  getExecuteClient().setOptions(options);
                  // get the callback manager
                  CallbackManager callback = new CallbackManager(this);
                  // send the request
                  // Following doesnt work
                  LOGGER.info(((Document)doc.getDomNode()).getDocumentElement());
                  getExecuteClient().sendReceiveNonBlocking(XMLUtils.toOM( ((Document)doc.getDomNode()).getDocumentElement()), callback);
                  waitCallback();


Re: ServiceClient behind an Axis Service

Posted by Deepal jayasinghe <de...@gmail.com>.
I have used this feature few years back, but after that I never tried. 
If the same thing work for the client side (stand alone application) I
do not see a reason why that does not work at the server side. Because,
we use the same code at both sides.

If this does not work, then it should be a  bug in Axis2 code base, so
please create a JIRA and attached code to reproduce the issue.

Thanks,
Deepal
>
> Dear all,
>
>  
>
> I'm using the Axis2 ServiceClient in order to send a non-blocking
> request using "separate listeners".
>
>  
>
> The ServiceClient is used by a thread behind a Axis Web Service. My
> code works fine as a single application, but, when behind the Axis
> Service, I cannot receive the Callback.
>
> The possible problem may come from the fact that the ServiceClient
> creates a listener precisely on the port used by the WPS, and thus, I
> suppose that the Axis Service (or web.xml) should "forward" the
> request to the right listener, but I don't know how.
>
>  
>
> Any help is very welcome.
>
>  
>
> Note that Axis2 is embedded into an existing application
> (http://www.developer.com/services/article.php/3777111/Embedding-Apache-Axis2-into-Existing-Applications.htm).
>
>  
>
> Thanks,
>
>  
>
> Christophe.
>
>  
>
> Code used :
>
>                                                 setExecuteClient(new
> ServiceClient()) ;
>
> Options options = *new*Options();
>
>                   // set the workflow endpoint
>
>                  
> options.setTo(*new*EndpointReference(processesPrefix+algorithmID));
>
>                   options.setUseSeparateListener(*true*);
>
>                   options.setAction("urn:executeResponseCallback");
>
>                  
> options.setTransportInProtocol(Constants./TRANSPORT_HTTP/);
>
>                   // use WS-Adressing (to perform asynchronous request)
>
>                   /getExecuteClient/().engageModule("addressing");
>
>                   /getExecuteClient/().setOptions(options);
>
>                   // get the callback manager
>
>                   CallbackManager callback = *new*CallbackManager(*this*);
>
>                   // send the request
>
>                   // Following doesnt work
>
>                  
> /LOGGER/.info(((Document)doc.getDomNode()).getDocumentElement());
>
>                  
> /getExecuteClient/().sendReceiveNonBlocking(XMLUtils./toOM/(
> ((Document)doc.getDomNode()).getDocumentElement()), callback);
>
>                   waitCallback();
>
>  
>


RE: ServiceClient behind an Axis Service

Posted by Christophe Noel <Ch...@spacebel.be>.
Dear all,

I solved my Axis problem.


The  listening endpoint automatically created by Axis was not correct.



When using a ServiceClient (itself behind an Axis Service), the reply-to endpoint should point to the application (which manage the ServiceClient) and a servlet-mapping should map the endpoint to AxisServlet.



In my case, the endpoint automatically created by ServiceClient didn't point to any existing application (it was http://host/axis2/... But there is no axis2 application).

In order to solve the problem  I simply added the following line to my asynchronous service client :



options.setReplyTo(new EndpointReference("http://"+java.net.InetAddress.getLocalHost().getHostAddress()+"/myapplication/services/myCallback"));



(There is already a servlet-mapping for "myapplication/services/*" to AxisServlet).



I hope it helps.



Christophe Noël

SPACEBEL.


From: Christophe Noel [mailto:Christophe.Noel@spacebel.be]
Sent: jeudi 7 juillet 2011 10:23
To: java-user@axis.apache.org
Subject: ServiceClient behind an Axis Service

Dear all,

I'm using the Axis2 ServiceClient in order to send a non-blocking request using "separate listeners".

The ServiceClient is used by a thread behind a Axis Web Service. My code works fine as a single application, but, when behind the Axis Service, I cannot receive the Callback.
The possible problem may come from the fact that the ServiceClient creates a listener precisely on the port used by the WPS, and thus, I suppose that the Axis Service (or web.xml) should "forward" the request to the right listener, but I don't know how.

Any help is very welcome.

Note that Axis2 is embedded into an existing application (http://www.developer.com/services/article.php/3777111/Embedding-Apache-Axis2-into-Existing-Applications.htm).

Thanks,

Christophe.

Code used :
                                                setExecuteClient(new ServiceClient()) ;
Options options = new Options();
                  // set the workflow endpoint
                  options.setTo(new EndpointReference(processesPrefix+algorithmID));
                  options.setUseSeparateListener(true);
                  options.setAction("urn:executeResponseCallback");
                  options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
                  // use WS-Adressing (to perform asynchronous request)
                  getExecuteClient().engageModule("addressing");
                  getExecuteClient().setOptions(options);
                  // get the callback manager
                  CallbackManager callback = new CallbackManager(this);
                  // send the request
                  // Following doesnt work
                  LOGGER.info(((Document)doc.getDomNode()).getDocumentElement());
                  getExecuteClient().sendReceiveNonBlocking(XMLUtils.toOM( ((Document)doc.getDomNode()).getDocumentElement()), callback);
                  waitCallback();


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

E-MAIL DISCLAIMER

The present message may contain confidential and/or legally privileged information. If you are not the intended addressee and in case of a transmission error, please notify the sender immediately and destroy this E-mail. Disclosure, reproduction or distribution of this document and its possible attachments is strictly forbidden.

SPACEBEL denies all liability for incomplete, improper, inaccurate, intercepted, (partly) destroyed, lost and/or belated transmission of the current information given that unencrypted electronic transmission cannot currently be guaranteed to be secure or error free.
Upon request or in conformity with formal, contractual agreements, an originally signed hard copy will be sent to you to confirm the information contained in this E-mail.

SPACEBEL denies all liability where E-mail is used for private use.

SPACEBEL cannot be held responsible for possible viruses that might corrupt this message and/or your computer system.
e ------------------------------------------------------------------------------