You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rampart-dev@ws.apache.org by Anil Misra <am...@ARCCorp.com> on 2008/01/17 22:06:20 UTC

How to insert NameSpace in the Soap envelop from the client

Hi,

 

     I followed the sample 04 of rampart module and implemented the
client. I got the following message from the monitor :

 

POST /iarws/services/TransactionService HTTP/1.1

Content-Type: text/xml; charset=UTF-8

SOAPAction: "myAction"

User-Agent: Axis2

Host: localhost:7002

Transfer-Encoding: chunked

 

5f3

<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:wsa="http://www.w3.org/2005/08/addressing"><soapenv:Header>

<wsse:Security
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wsse
curity-secext-1.0.xsd" soapenv:mustUnderstand="1"><wsu:Timestamp
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssec
urity-utility-1.0.xsd"
wsu:Id="Timestamp-367156"><wsu:Created>2008-01-17T18:35:12.241Z</wsu:Cre
ated><wsu:Expires>2008-01-17T18:40:12.241Z</wsu:Expires></wsu:Timestamp>
.......................

 

 

I want to include a NameSpace in the < soapenv:Envelope  ..  tag  .
like xmlns:myspace=http://.... <http://..../>  

 

How would I be able to do so in the client code. Any help would be
appreciated.

 

Thanks,

-Anil Misra

   


How to stop calling PWCallback logic for authentication using SecureConversation

Posted by Bhushan Gupte <bg...@ARCCorp.com>.
Hi,

 

I had already sent a message to the DEV group and did not receive any
reply, so I am sending the same message again as I am looking for a
solution to this problem urgently.......   

 

I am trying to implement SecureConversation as defined in Rampart's
"\policy\sample04" example in the samples directory of the rampart-1.3

release.

 

The client sends multiple SOAP messages to the server[1].  The messages
are authenticated using the UsernameToken in PWCallback class.

 

Now my question is that every time I send a SOAP message the
authentication logic in PWCallback class[2] is also executed for every
request.

Is there a way to identify that all the subsequent
messages("client.sendReceive") are from the same session so that the
authentication will happen only once by calling the PWCallback handler
class only once?  Is there a way to achieve this? 

 

In real project scenario the PWCallback class will contain calls to LDAP
for authentication and the whole purpose we are trying to implement
WS-SecureConversation in addition to WS-Security is that we can to
Secure Conversation between messages and not have to do LDAP
authentication for every message. Any help is highly appreciated.

 

Thanks in advance.

 

Bhushan Gupte

 

[1]        OMElement response = client.sendReceive(getPayload("Hello

world1"));

        System.out.println("Response 1 : " + response);

        response = client.sendReceive(getPayload("Hello world2"));

        System.out.println("Response 2 : " + response);

        response = client.sendReceive(getPayload("Hello world3"));

        System.out.println("Response 3 : " + response);

 

 

[2]        for (int i = 0; i < callbacks.length; i++) {

            WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];

            String id = pwcb.getIdentifer();

            if("client".equals(id)) {

                pwcb.setPassword("apache");

            } else if("service".equals(id)) {

                pwcb.setPassword("apache");

            }

        }

 

 


How to not Validate

Posted by Bhushan Gupte <bg...@ARCCorp.com>.
Hi,

I am trying to implement SecureConversation as defined in Rampart's
"\policy\sample04" example in the samples directory of the rampart-1.3
release.

The client sends several SOAP messages to the server[1].  The messages
are currently authenticated using the UsernameToken in PWCallback class.

[1]	OMElement response = client.sendReceive(getPayload("Hello
world1"));
        System.out.println("Response 1 : " + response);
        response = client.sendReceive(getPayload("Hello world2"));
        System.out.println("Response 2 : " + response);
        response = client.sendReceive(getPayload("Hello world3"));
        System.out.println("Response 3 : " + response);

Now my question is that every time I send a SOAP message the
authentication logic in PWCallback class[2] is also executed.
Is there a way to identify that all the consecutive messages are from
the same session so that the authentication will happen only once? In
short the authentication logic[2] should be ideally called only once. 


[2]	for (int i = 0; i < callbacks.length; i++) {
            WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
            String id = pwcb.getIdentifer();
            if("client".equals(id)) {
                pwcb.setPassword("apache");
            } else if("service".equals(id)) {
                pwcb.setPassword("apache");
            }
        }


Thanks in advance.

Bhushan Gupte

RE: How to insert NameSpace in the Soap envelop from the client

Posted by Anil Misra <am...@ARCCorp.com>.
I tried creating the OMElement with a QName , but the problem is that in
the client code where do I add this OMElement . I tried using
client.addHeader(elem);  but that does not work . Is there some other
method I can use to add it to the outgoing message. 


-----Original Message-----
From: Narayan S Dhillon [mailto:narayan.dhillon@googlemail.com] 
Sent: Tuesday, January 22, 2008 5:40 PM
To: rampart-dev@ws.apache.org
Subject: Re: How to insert NameSpace in the Soap envelop from the client

you dont have to declare namespace in soap envelope, it could be defined
in
your payload element.
If you have auto generated the service class from wsdl, then you could
declare namespace for your payload inside wsdl schema section; and then
generated binding classes will generate namespace qualified elements. If
you
are not using binding then you could create OMElement with QName.

Regards, Narayan



On 21/01/2008, Anil Misra <am...@arccorp.com> wrote:
>
> Hi Narayan,
>
>       The purpose to add namespace is to get the payload elements
having
> a namespace tag like: mytag:<element>  , now "mytag" is not defined
and
> is giving ,me error. And to add this to the soap envelop I need to
> method to be able to get the soap envelope from the client. How could
I
> do this ? , I would appreciate your reply.
>
> Thanks,
> -Anil
>
>
> -----Original Message-----
> From: Narayan S Dhillon [mailto:narayan.dhillon@googlemail.com]
> Sent: Friday, January 18, 2008 7:00 PM
> To: rampart-dev@ws.apache.org
> Subject: Re: How to insert NameSpace in the Soap envelop from the
client
>
> Hi Ramesh,
>
> What is the purpose of adding the namespace? Are you trying to get all
> your
> payload elements namespace qualified? for later you could use
> elementFormDefault="qualified"
> in xml schema.
>
> Regards, Narayan
>
> On 17/01/2008, Anil Misra <am...@arccorp.com> wrote:
> >
> > Hi,
> >
> >
> >
> >      I followed the sample 04 of rampart module and implemented the
> > client. I got the following message from the monitor :
> >
> >
> >
> > POST /iarws/services/TransactionService HTTP/1.1
> >
> > Content-Type: text/xml; charset=UTF-8
> >
> > SOAPAction: "myAction"
> >
> > User-Agent: Axis2
> >
> > Host: localhost:7002
> >
> > Transfer-Encoding: chunked
> >
> >
> >
> > 5f3
> >
> > <?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope
> > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> > xmlns:wsa="http://www.w3.org/2005/08/addressing"><soapenv:Header>
> >
> > <wsse:Security
> >
>
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wsse
> > curity-secext-1.0.xsd" soapenv:mustUnderstand="1"><wsu:Timestamp
> >
>
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssec
> > urity-utility-1.0.xsd"
> >
>
wsu:Id="Timestamp-367156"><wsu:Created>2008-01-17T18:35:12.241Z</wsu:Cre
> >
>
ated><wsu:Expires>2008-01-17T18:40:12.241Z</wsu:Expires></wsu:Timestamp>
> > .......................
> >
> >
> >
> >
> >
> > I want to include a NameSpace in the < soapenv:Envelope  ..  tag  .
> > like xmlns:myspace=http://.... <http://..../>
> >
> >
> >
> > How would I be able to do so in the client code. Any help would be
> > appreciated.
> >
> >
> >
> > Thanks,
> >
> > -Anil Misra
> >
> >
> >
> >
>

Re: How to insert NameSpace in the Soap envelop from the client

Posted by Narayan S Dhillon <na...@googlemail.com>.
you dont have to declare namespace in soap envelope, it could be defined in
your payload element.
If you have auto generated the service class from wsdl, then you could
declare namespace for your payload inside wsdl schema section; and then
generated binding classes will generate namespace qualified elements. If you
are not using binding then you could create OMElement with QName.

Regards, Narayan



On 21/01/2008, Anil Misra <am...@arccorp.com> wrote:
>
> Hi Narayan,
>
>       The purpose to add namespace is to get the payload elements having
> a namespace tag like: mytag:<element>  , now "mytag" is not defined and
> is giving ,me error. And to add this to the soap envelop I need to
> method to be able to get the soap envelope from the client. How could I
> do this ? , I would appreciate your reply.
>
> Thanks,
> -Anil
>
>
> -----Original Message-----
> From: Narayan S Dhillon [mailto:narayan.dhillon@googlemail.com]
> Sent: Friday, January 18, 2008 7:00 PM
> To: rampart-dev@ws.apache.org
> Subject: Re: How to insert NameSpace in the Soap envelop from the client
>
> Hi Ramesh,
>
> What is the purpose of adding the namespace? Are you trying to get all
> your
> payload elements namespace qualified? for later you could use
> elementFormDefault="qualified"
> in xml schema.
>
> Regards, Narayan
>
> On 17/01/2008, Anil Misra <am...@arccorp.com> wrote:
> >
> > Hi,
> >
> >
> >
> >      I followed the sample 04 of rampart module and implemented the
> > client. I got the following message from the monitor :
> >
> >
> >
> > POST /iarws/services/TransactionService HTTP/1.1
> >
> > Content-Type: text/xml; charset=UTF-8
> >
> > SOAPAction: "myAction"
> >
> > User-Agent: Axis2
> >
> > Host: localhost:7002
> >
> > Transfer-Encoding: chunked
> >
> >
> >
> > 5f3
> >
> > <?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope
> > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> > xmlns:wsa="http://www.w3.org/2005/08/addressing"><soapenv:Header>
> >
> > <wsse:Security
> >
> xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wsse
> > curity-secext-1.0.xsd" soapenv:mustUnderstand="1"><wsu:Timestamp
> >
> xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssec
> > urity-utility-1.0.xsd"
> >
> wsu:Id="Timestamp-367156"><wsu:Created>2008-01-17T18:35:12.241Z</wsu:Cre
> >
> ated><wsu:Expires>2008-01-17T18:40:12.241Z</wsu:Expires></wsu:Timestamp>
> > .......................
> >
> >
> >
> >
> >
> > I want to include a NameSpace in the < soapenv:Envelope  ..  tag  .
> > like xmlns:myspace=http://.... <http://..../>
> >
> >
> >
> > How would I be able to do so in the client code. Any help would be
> > appreciated.
> >
> >
> >
> > Thanks,
> >
> > -Anil Misra
> >
> >
> >
> >
>

RE: How to insert NameSpace in the Soap envelop from the client

Posted by Anil Misra <am...@ARCCorp.com>.
Hi Narayan,

      The purpose to add namespace is to get the payload elements having
a namespace tag like: mytag:<element>  , now "mytag" is not defined and
is giving ,me error. And to add this to the soap envelop I need to
method to be able to get the soap envelope from the client. How could I
do this ? , I would appreciate your reply. 

Thanks,
-Anil 
   
  
-----Original Message-----
From: Narayan S Dhillon [mailto:narayan.dhillon@googlemail.com] 
Sent: Friday, January 18, 2008 7:00 PM
To: rampart-dev@ws.apache.org
Subject: Re: How to insert NameSpace in the Soap envelop from the client

Hi Ramesh,

What is the purpose of adding the namespace? Are you trying to get all
your
payload elements namespace qualified? for later you could use
elementFormDefault="qualified"
in xml schema.

Regards, Narayan

On 17/01/2008, Anil Misra <am...@arccorp.com> wrote:
>
> Hi,
>
>
>
>      I followed the sample 04 of rampart module and implemented the
> client. I got the following message from the monitor :
>
>
>
> POST /iarws/services/TransactionService HTTP/1.1
>
> Content-Type: text/xml; charset=UTF-8
>
> SOAPAction: "myAction"
>
> User-Agent: Axis2
>
> Host: localhost:7002
>
> Transfer-Encoding: chunked
>
>
>
> 5f3
>
> <?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:wsa="http://www.w3.org/2005/08/addressing"><soapenv:Header>
>
> <wsse:Security
>
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wsse
> curity-secext-1.0.xsd" soapenv:mustUnderstand="1"><wsu:Timestamp
>
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssec
> urity-utility-1.0.xsd"
>
wsu:Id="Timestamp-367156"><wsu:Created>2008-01-17T18:35:12.241Z</wsu:Cre
>
ated><wsu:Expires>2008-01-17T18:40:12.241Z</wsu:Expires></wsu:Timestamp>
> .......................
>
>
>
>
>
> I want to include a NameSpace in the < soapenv:Envelope  ..  tag  .
> like xmlns:myspace=http://.... <http://..../>
>
>
>
> How would I be able to do so in the client code. Any help would be
> appreciated.
>
>
>
> Thanks,
>
> -Anil Misra
>
>
>
>

Re: How to insert NameSpace in the Soap envelop from the client

Posted by Narayan S Dhillon <na...@googlemail.com>.
Hi Ramesh,

What is the purpose of adding the namespace? Are you trying to get all your
payload elements namespace qualified? for later you could use
elementFormDefault="qualified"
in xml schema.

Regards, Narayan

On 17/01/2008, Anil Misra <am...@arccorp.com> wrote:
>
> Hi,
>
>
>
>      I followed the sample 04 of rampart module and implemented the
> client. I got the following message from the monitor :
>
>
>
> POST /iarws/services/TransactionService HTTP/1.1
>
> Content-Type: text/xml; charset=UTF-8
>
> SOAPAction: "myAction"
>
> User-Agent: Axis2
>
> Host: localhost:7002
>
> Transfer-Encoding: chunked
>
>
>
> 5f3
>
> <?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:wsa="http://www.w3.org/2005/08/addressing"><soapenv:Header>
>
> <wsse:Security
> xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wsse
> curity-secext-1.0.xsd" soapenv:mustUnderstand="1"><wsu:Timestamp
> xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssec
> urity-utility-1.0.xsd"
> wsu:Id="Timestamp-367156"><wsu:Created>2008-01-17T18:35:12.241Z</wsu:Cre
> ated><wsu:Expires>2008-01-17T18:40:12.241Z</wsu:Expires></wsu:Timestamp>
> .......................
>
>
>
>
>
> I want to include a NameSpace in the < soapenv:Envelope  ..  tag  .
> like xmlns:myspace=http://.... <http://..../>
>
>
>
> How would I be able to do so in the client code. Any help would be
> appreciated.
>
>
>
> Thanks,
>
> -Anil Misra
>
>
>
>