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 Andrew Fielden <af...@tibco.com> on 2006/08/23 10:47:47 UTC

RE: Simple example required for use of WSS4J with Axis

Does no one have any example which illustrates the use of WSS4J in this
situation? I have a client application which needs to insert a SAML
token into a SOAP message used to invoke a Web Service.

I also tried the WSS4J mailing list, but no response there.


> -----Original Message-----
> From: Andrew Fielden [mailto:afielden@tibco.com]
> Sent: 22 August 2006 14:41
> To: axis-user@ws.apache.org
> Subject: Simple example required
> 
> I've looked at the examples of calling a simple web service on the
> Apache Axis website.
> I've also looked at the examples of using WSS4J in conjunction with
> Axis. I'm confused about how WSS4J can be used in the context of the
> basic TestClient example (below). There is no specific example
> corresponding to this.
> 
> I'd like to be able to add SAML tokens to a SOAP message, but I have a
> couple of basic questions:
> 
> 1. The WSS4J examples make use of a callback class to manipulate the
> SOAP message. How is this callback class registered, in the context of
> the example below.
> 
> 2. The examples get a reference to the SOAP envelope object, but how
do
> I obtain this, in the context of the example below.
> 
> Some lines of code would be ideal, just to clarify the usage of WSS4J
in
> this situation.
> 
> Thanks.
> 
> 
> 1   import org.apache.axis.client.Call;
> 2   import org.apache.axis.client.Service;
> 3   import javax.xml.namespace.QName;
> 4
> 5   public class TestClient {
> 6     public static void main(String [] args) {
> 7       try {
> 8         String endpoint =
> 9             "http://ws.apache.org:5049/axis/services/echo";
> 10
> 11        Service  service = new Service();
> 12        Call     call    = (Call) service.createCall();
> 13
> 14        call.setTargetEndpointAddress( new java.net.URL(endpoint) );
> 15        call.setOperationName(new QName("http://soapinterop.org/",
> echoString"));
> 16
> 17        String ret = (String) call.invoke( new Object[] { "Hello!" }
> );
> 18
> 19        System.out.println("Sent 'Hello!', got '" + ret + "'");
> 20      } catch (Exception e) {
> 21        System.err.println(e.toString());
> 22      }
> 23    }
> 24  }
> 
> 
> 
> ---------------------------------------------------------------------
> 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: Simple example required for use of WSS4J with Axis

Posted by Ruchith Fernando <ru...@gmail.com>.
There are a set of inteorp scenarios here [1] which uses saml.

Thanks,
Ruchith

[1] https://svn.apache.org/repos/asf/webservices/wss4j/trunk/interop

On 8/23/06, Andrew Fielden <af...@tibco.com> wrote:
>
> Does no one have any example which illustrates the use of WSS4J in this
> situation? I have a client application which needs to insert a SAML
> token into a SOAP message used to invoke a Web Service.
>
> I also tried the WSS4J mailing list, but no response there.
>
>
> > -----Original Message-----
> > From: Andrew Fielden [mailto:afielden@tibco.com]
> > Sent: 22 August 2006 14:41
> > To: axis-user@ws.apache.org
> > Subject: Simple example required
> >
> > I've looked at the examples of calling a simple web service on the
> > Apache Axis website.
> > I've also looked at the examples of using WSS4J in conjunction with
> > Axis. I'm confused about how WSS4J can be used in the context of the
> > basic TestClient example (below). There is no specific example
> > corresponding to this.
> >
> > I'd like to be able to add SAML tokens to a SOAP message, but I have a
> > couple of basic questions:
> >
> > 1. The WSS4J examples make use of a callback class to manipulate the
> > SOAP message. How is this callback class registered, in the context of
> > the example below.
> >
> > 2. The examples get a reference to the SOAP envelope object, but how
> do
> > I obtain this, in the context of the example below.
> >
> > Some lines of code would be ideal, just to clarify the usage of WSS4J
> in
> > this situation.
> >
> > Thanks.
> >
> >
> > 1   import org.apache.axis.client.Call;
> > 2   import org.apache.axis.client.Service;
> > 3   import javax.xml.namespace.QName;
> > 4
> > 5   public class TestClient {
> > 6     public static void main(String [] args) {
> > 7       try {
> > 8         String endpoint =
> > 9             "http://ws.apache.org:5049/axis/services/echo";
> > 10
> > 11        Service  service = new Service();
> > 12        Call     call    = (Call) service.createCall();
> > 13
> > 14        call.setTargetEndpointAddress( new java.net.URL(endpoint) );
> > 15        call.setOperationName(new QName("http://soapinterop.org/",
> > echoString"));
> > 16
> > 17        String ret = (String) call.invoke( new Object[] { "Hello!" }
> > );
> > 18
> > 19        System.out.println("Sent 'Hello!', got '" + ret + "'");
> > 20      } catch (Exception e) {
> > 21        System.err.println(e.toString());
> > 22      }
> > 23    }
> > 24  }
> >
> >
> >
> > ---------------------------------------------------------------------
> > 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
>
>


-- 
www.ruchith.org

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org