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 Sricharan Anand <sr...@yahoo.com> on 2006/03/08 03:03:49 UTC

WS-Addressing headers in generated Stub

   Hi,

I am using Axis2 version 0.94 to communicate with a remote .Net Webservice. The remote service is using WS-Addressing. 

I used the wsdl2java tool, gave the WSDL location and generated the stub to communicate with this service. When i execute the stub, it says "Deploying module addressing"  - but i am not sure that its hitting the remote service since i don't get any response back.

 I don't see the WS-A headers(wsa:To, wsa:Action, wsa:MessageID) added in the stub. Are these getting added anywhere in the stub? If not, do i have to add these headers explicitly? 

I assumed that since WS-A is builtin - these headers should be automatically added.

I am new to using Axis2 and any help would be appreciated.

Thanks,
Sri
			
---------------------------------
 Yahoo! Mail
 Use Photomail to share photos without annoying attachments.

Re: WS-Addressing headers in generated Stub

Posted by Chathura Herath <ch...@gmail.com>.
Hi,

Why are we keeping the _getServiceClient() method to be an
"underscore" method if we anticipate the users to use it. My view was
"underscore" methods means we do not anticipate the stub users to call
them.
Two options
1) Either  we get rid of the "underscore"
2) Add a new method for engage module.

Having clean consistant API's do help in the long run.
Thanks
Chathura

On 3/7/06, Deepal Jayasinghe <de...@opensource.lk> wrote:
> You have do one more thing :) , that is you have to engage addressing in
> order to have addressing functionality , using following code you can do
> that.
>    1. In the latest code
>        stb._getServiceClient().engageModule("addressing");
>   2. In 0.94
>      stb.engageModule("addressing");
>
> Sricharan Anand wrote:
>
> > Hi,
> >
> > I am using Axis2 version 0.94 to communicate with a remote .Net
> > Webservice. The remote service is using WS-Addressing.
> >
> > I used the wsdl2java tool, gave the WSDL location and generated the
> > stub to communicate with this service. When i execute the stub, it
> > says "Deploying module addressing"  - but i am not sure that its
> > hitting the remote service since i don't get any response back.
> >
> >  I don't see the WS-A headers(wsa:To, wsa:Action, wsa:MessageID) added
> > in the stub. Are these getting added anywhere in the stub? If not, do
> > i have to add these headers explicitly?
> >
> > I assumed that since WS-A is builtin - these headers should be
> > automatically added.
> >
> > I am new to using Axis2 and any help would be appreciated.
> >
> > Thanks,
> > Sri
> >
> > ------------------------------------------------------------------------
> > Yahoo! Mail
> > Use Photomail
> > <http://us.rd.yahoo.com/mail_us/taglines/pmall2/*http://photomail.mail.yahoo.com>
> > to share photos without annoying attachments.
>
>
> --
> Thanks,
> Deepal
> ................................................................
> ~Future is Open~
>
>
>


--
Chathura Herath
http://people.apache.org/~chathura/
http://chathurah.blogspot.com/

Re: WS-Addressing headers in generated Stub(Cont.)

Posted by Deepal Jayasinghe <de...@opensource.lk>.
Hi Chinthka ,

I think you are the best person to answer this question :)

Sricharan Anand wrote:

> Thanks Deepal for your reply. I tried what you said below and still
> couldn't get it to work - maybe i am doing something basically wrong.
>
> Here is the issue in more detail:
>
> Like I said before, I am writing a Axis2 client to communicate with a
> remote .Net service. This service is expecting the following WS-A headers:
>
> <wsa:Action>http://www.myservice.com/TestHarness/MyApplication</wsa:Action>
>      <wsa:MessageID>uuid:84ce994b-7615-42a4-be78-45621febe</wsa:MessageID>
>       <wsa:ReplyTo>
>        
> <wsa:Address>http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous</wsa:Address>
>       </wsa:ReplyTo>
>       <wsa:To>urn:MyApplicationAPI</wsa:To>
> The location of the service i.e actual URL is different(given below):
> soap:address location
> ="*https://myservices.test.com/testharness/myapplicationapi.asmx"
>
>
> This is how i set the WS-A headers in my client(stub) code:
>
> EndpointReference epr = new EndpointReference("urn:MyApplicationAPI");
> _messageContext.setWSAAction("http://www.myservice.com/TestHarness/MyApplication");
>      
>  _messageContext.setTo(epr);
>       
> _messageContext.setMessageID("uuid:84ce996b-7615-42a4-be78-45621febe3fe");
>       
> *When I run the above code I get this exception:
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> Exception in thread "main" org.apache.axis2.AxisFault: no protocol:
> urn; nested exception is:
>     java.net.MalformedURLException: no protocol: urn; nested exception
> is:
>   &n bsp; org.apache.axis2.AxisFault: no protocol: urn; nested
> exception is:
>     java.net.MalformedURLException: no protocol: urn
>     at
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:245)
> */<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>
> If I change the EPR as follows:
>
> EndpointReference epr = new
> EndpointReference("/**https://myservices.test.com/testharness/myapplicationapi.asmx**/");
>
> and run I get the following exception:
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> Exception in thread "main" org.apache.axis2.AxisFault: Destination
> Unreachable --> WSE817: The &lt;To&gt; header must match the Actor
> attribute on this receiver. The &lt;To&gt; header contained
> &quot;https://myservices.test.com/testharness/myapplicationapi.asmx&quot;
> whereas the Actor attribute was &quot;urn:MyApplicationAPI&quot;.
>     at
> org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:295)
> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>
> So I am confused as to how to set the "WSA To" . The rest of the WSA
> headers are getting set properly(i can see this when i print out the
> SOAP Envelope)
>
>
> Any help would be appreciated.
>
> Thanks,
> Sri
>
>
>
>
>
>
>
> Deepal Jayasinghe <de...@opensource.lk>/* wrote: You have do one more
> thing :) , that is you have to engage addressing in
> order to have addressing functionality , using following code you can do
> that.
> 1. In the latest code
> stb._getServiceClient().engageModule("addressing");
> 2. In 0.94
> stb.engageModule("addressing");
>
> Sricharan Anand wrote:
>
> > Hi,
> >
> > I am using Axis2 version 0.94 to communicate with a remote .Net
> > Webservice. The remote service is using WS-Addressing.
> >
> > I used the wsdl2java tool, gave the WSDL location and generated the
> > stub to communicate with this service. When i execute the stub, it
> > says "Deploying module addressing" - but i am not sure that its
> > hitting the remote service since i don't get any response back.
> >
> > I don't see the WS-A headers(wsa:To, wsa:Action, wsa:MessageID) added
> > in the stub. Are these getting added anywhere in the stub? If not, do
> > i have to add these headers explicitly?
> >
> > I assumed that since WS-A is builtin - these headers should be
> > automatically added.
> >
> > I am new to using Axis2 and any help would be appreciated.
> >
> > Thanks,
> > Sri
> >
> > ------------------------------------------------------------------------
> > Yahoo! Mail
> > Use Photomail
> >
> > to share photos without annoying attachments.
>
>
> -- 
> Thanks,
> Deepal
> ................................................................
> ~Future is Open~
>
>
>
> ------------------------------------------------------------------------
> Yahoo! Mail
> Use Photomail
> <http://pa.yahoo.com/*http://us.rd.yahoo.com/evt=38867/*http://photomail.mail.yahoo.com>
> to share photos without annoying attachments. 


-- 
Thanks,
Deepal
................................................................
~Future is Open~ 



Re: [Axis2]Re: WS-Addressing headers in generated Stub(Cont.)

Posted by Eran Chinthaka <ch...@opensource.lk>.
Deepal Jayasinghe wrote:
> Hi Sricharan;
> 
> In this case you have to use separate To for wsa:to and actual To , by
> using applying following procedure you can archive the goal :) , but you
> dont have this feature in Axis2 0.95 and you only have that in current
> SVN code base.

We had this feature in Axis2 even in 0.95. But the problem we had was
that, we always inferred the transport out protocol from wsa:To.

Something like following should still work in the latest release.

Option options = new Options();
options.setProperty(MessageContextConstants.TRANSPORT_URL,"https://myservices.test.com/testharness/myapplicationapi.asmx");
options.setTo(new EndpointReference("http://myURI"));

But if you wanna set urn:MyApplicationAPI as wsa:TO then you need to
work against the current svn head.

-- Chinthaka

> 
>  Option options = new Options();
>  *options.setProperty(MessageContextConstants.TRANSPORT_URL,"**https://myservices.test.com/testharness/myapplicationapi.asmx");*
>  options.setTo(new EndpointReference("urn:MyApplicationAPI"));
> 
> Just add the above property into option :)
> 
> 
> 


[Axis2]Re: WS-Addressing headers in generated Stub(Cont.)

Posted by Deepal Jayasinghe <de...@opensource.lk>.
Hi Sricharan;

In this case you have to use separate To for wsa:to and actual To , by
using applying following procedure you can archive the goal :) , but you
dont have this feature in Axis2 0.95 and you only have that in current
SVN code base.

 Option options = new Options();
 *options.setProperty(MessageContextConstants.TRANSPORT_URL,"**https://myservices.test.com/testharness/myapplicationapi.asmx");*
 options.setTo(new EndpointReference("urn:MyApplicationAPI"));

Just add the above property into option :)


Sricharan Anand wrote:

> Thanks Deepal for your reply. I tried what you said below and still
> couldn't get it to work - maybe i am doing something basically wrong.
>
> Here is the issue in more detail:
>
> Like I said before, I am writing a Axis2 client to communicate with a
> remote .Net service. This service is expecting the following WS-A headers:
>
> <wsa:Action>http://www.myservice.com/TestHarness/MyApplication</wsa:Action>
>      <wsa:MessageID>uuid:84ce994b-7615-42a4-be78-45621febe</wsa:MessageID>
>       <wsa:ReplyTo>
>        
> <wsa:Address>http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous</wsa:Address>
>       </wsa:ReplyTo>
>       <wsa:To>urn:MyApplicationAPI</wsa:To>
> The location of the service i.e actual URL is different(given below):
> soap:address location
> ="*https://myservices.test.com/testharness/myapplicationapi.asmx"
>
>
> This is how i set the WS-A headers in my client(stub) code:
>
> EndpointReference epr = new EndpointReference("urn:MyApplicationAPI");
> _messageContext.setWSAAction("http://www.myservice.com/TestHarness/MyApplication");
>      
>  _messageContext.setTo(epr);
>       
> _messageContext.setMessageID("uuid:84ce996b-7615-42a4-be78-45621febe3fe");
>       
> *When I run the above code I get this exception:
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> Exception in thread "main" org.apache.axis2.AxisFault: no protocol:
> urn; nested exception is:
>     java.net.MalformedURLException: no protocol: urn; nested exception
> is:
>   &n bsp; org.apache.axis2.AxisFault: no protocol: urn; nested
> exception is:
>     java.net.MalformedURLException: no protocol: urn
>     at
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:245)
> */<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>
> If I change the EPR as follows:
>
> EndpointReference epr = new
> EndpointReference("/**https://myservices.test.com/testharness/myapplicationapi.asmx**/");
>
> and run I get the following exception:
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> Exception in thread "main" org.apache.axis2.AxisFault: Destination
> Unreachable --> WSE817: The &lt;To&gt; header must match the Actor
> attribute on this receiver. The &lt;To&gt; header contained
> &quot;https://myservices.test.com/testharness/myapplicationapi.asmx&quot;
> whereas the Actor attribute was &quot;urn:MyApplicationAPI&quot;.
>     at
> org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:295)
> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>
> So I am confused as to how to set the "WSA To" . The rest of the WSA
> headers are getting set properly(i can see this when i print out the
> SOAP Envelope)
>
>
> Any help would be appreciated.
>
> Thanks,
> Sri
>
>
>
>
>
>
>
> Deepal Jayasinghe <de...@opensource.lk>/* wrote: You have do one more
> thing :) , that is you have to engage addressing in
> order to have addressing functionality , using following code you can do
> that.
> 1. In the latest code
> stb._getServiceClient().engageModule("addressing");
> 2. In 0.94
> stb.engageModule("addressing");
>
> Sricharan Anand wrote:
>
> > Hi,
> >
> > I am using Axis2 version 0.94 to communicate with a remote .Net
> > Webservice. The remote service is using WS-Addressing.
> >
> > I used the wsdl2java tool, gave the WSDL location and generated the
> > stub to communicate with this service. When i execute the stub, it
> > says "Deploying module addressing" - but i am not sure that its
> > hitting the remote service since i don't get any response back.
> >
> > I don't see the WS-A headers(wsa:To, wsa:Action, wsa:MessageID) added
> > in the stub. Are these getting added anywhere in the stub? If not, do
> > i have to add these headers explicitly?
> >
> > I assumed that since WS-A is builtin - these headers should be
> > automatically added.
> >
> > I am new to using Axis2 and any help would be appreciated.
> >
> > Thanks,
> > Sri
> >
> > ------------------------------------------------------------------------
> > Yahoo! Mail
> > Use Photomail
> >
> > to share photos without annoying attachments.
>
>
> -- 
> Thanks,
> Deepal
> ................................................................
> ~Future is Open~
>
>
>
> ------------------------------------------------------------------------
> Yahoo! Mail
> Use Photomail
> <http://pa.yahoo.com/*http://us.rd.yahoo.com/evt=38867/*http://photomail.mail.yahoo.com>
> to share photos without annoying attachments. 


-- 
Thanks,
Deepal
................................................................
~Future is Open~ 



WS-Addressing headers in generated Stub(Cont.)

Posted by Sricharan Anand <sr...@yahoo.com>.
Thanks Deepal for your reply. I tried what you said below and still couldn't get it to work - maybe i am doing something basically wrong.

Here is the issue in more detail:

Like I said before, I am writing a Axis2 client to communicate with a remote .Net service. This service is expecting the following WS-A headers:

<wsa:Action>http://www.myservice.com/TestHarness/MyApplication</wsa:Action>
      <wsa:MessageID>uuid:84ce994b-7615-42a4-be78-45621febe</wsa:MessageID>
        <wsa:ReplyTo>
          <wsa:Address>http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous</wsa:Address>
        </wsa:ReplyTo>
        <wsa:To>urn:MyApplicationAPI</wsa:To>
The location of the service i.e actual URL is different(given below):
soap:address location="https://myservices.test.com/testharness/myapplicationapi.asmx"


This is how i set the WS-A headers in my client(stub) code:

EndpointReference epr = new EndpointReference("urn:MyApplicationAPI");
_messageContext.setWSAAction("http://www.myservice.com/TestHarness/MyApplication");
      
 _messageContext.setTo(epr);
       _messageContext.setMessageID("uuid:84ce996b-7615-42a4-be78-45621febe3fe");
       
When I run the above code I get this exception:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Exception in thread "main" org.apache.axis2.AxisFault: no protocol: urn; nested exception is: 
    java.net.MalformedURLException: no protocol: urn; nested exception is: 
    org.apache.axis2.AxisFault: no protocol: urn; nested exception is: 
    java.net.MalformedURLException: no protocol: urn
    at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:245)
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

If I change the EPR as follows:

EndpointReference epr = new EndpointReference("https://myservices.test.com/testharness/myapplicationapi.asmx");

and run I get the following exception:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Exception in thread "main" org.apache.axis2.AxisFault: Destination Unreachable --> WSE817: The &lt;To&gt; header must match the Actor attribute on this receiver. The &lt;To&gt; header contained &quot;https://myservices.test.com/testharness/myapplicationapi.asmx&quot; whereas the Actor attribute was &quot;urn:MyApplicationAPI&quot;.
    at org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:295)
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

So I am confused as to how to set the "WSA To" . The rest of the WSA headers are getting set properly(i can see this when i print out the SOAP Envelope)


Any help would be appreciated.

Thanks,
Sri







Deepal Jayasinghe <de...@opensource.lk> wrote: You have do one more thing :) , that is you have to engage addressing in
order to have addressing functionality , using following code you can do
that.
   1. In the latest code
       stb._getServiceClient().engageModule("addressing");
  2. In 0.94
     stb.engageModule("addressing");

Sricharan Anand wrote:

> Hi,
>
> I am using Axis2 version 0.94 to communicate with a remote .Net
> Webservice. The remote service is using WS-Addressing.
>
> I used the wsdl2java tool, gave the WSDL location and generated the
> stub to communicate with this service. When i execute the stub, it
> says "Deploying module addressing"  - but i am not sure that its
> hitting the remote service since i don't get any response back.
>
>  I don't see the WS-A headers(wsa:To, wsa:Action, wsa:MessageID) added
> in the stub. Are these getting added anywhere in the stub? If not, do
> i have to add these headers explicitly?
>
> I assumed that since WS-A is builtin - these headers should be
> automatically added.
>
> I am new to using Axis2 and any help would be appreciated.
>
> Thanks,
> Sri
>
> ------------------------------------------------------------------------
> Yahoo! Mail
> Use Photomail
> 
> to share photos without annoying attachments. 


-- 
Thanks,
Deepal
................................................................
~Future is Open~ 




		
---------------------------------
 Yahoo! Mail
 Use Photomail to share photos without annoying attachments.

Re: WS-Addressing headers in generated Stub

Posted by Deepal Jayasinghe <de...@opensource.lk>.
You have do one more thing :) , that is you have to engage addressing in
order to have addressing functionality , using following code you can do
that.
   1. In the latest code
       stb._getServiceClient().engageModule("addressing");
  2. In 0.94
     stb.engageModule("addressing");

Sricharan Anand wrote:

> Hi,
>
> I am using Axis2 version 0.94 to communicate with a remote .Net
> Webservice. The remote service is using WS-Addressing.
>
> I used the wsdl2java tool, gave the WSDL location and generated the
> stub to communicate with this service. When i execute the stub, it
> says "Deploying module addressing"  - but i am not sure that its
> hitting the remote service since i don't get any response back.
>
>  I don't see the WS-A headers(wsa:To, wsa:Action, wsa:MessageID) added
> in the stub. Are these getting added anywhere in the stub? If not, do
> i have to add these headers explicitly?
>
> I assumed that since WS-A is builtin - these headers should be
> automatically added.
>
> I am new to using Axis2 and any help would be appreciated.
>
> Thanks,
> Sri
>
> ------------------------------------------------------------------------
> Yahoo! Mail
> Use Photomail
> <http://us.rd.yahoo.com/mail_us/taglines/pmall2/*http://photomail.mail.yahoo.com>
> to share photos without annoying attachments. 


-- 
Thanks,
Deepal
................................................................
~Future is Open~