You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by Martin Pichardo <ma...@hotmail.com> on 2002/09/23 14:29:31 UTC

SOAP Headers

Hello,

I am trying to consume a .Net web service with the Apache soap toolkit. The 
web service is expecting the following header:

<tns:sdpChannelCredentials id="id1">
  <UserName xsi:type="xsd:string">Martin Pichardo</UserName>
  <UserSecurityToken xsi:type="xsd:string">Password</UserSecurityToken>
  <UserServiceChannel xsi:type="xsd:string">any text</UserServiceChannel>
</tns:sdpChannelCredentials>

I haven't been able to create a soap hearder with the toolkit. Can anyone 
provide a code snippet for creating the soap header as illustrated above.

any suggestions are appreciated,

Thanks,

Martin


_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com


Re: SOAP Headers

Posted by Scott Nichol <sn...@scottnichol.com>.
Assuming you are using the RPC API, here's what I would try

    1. Create the DOM fragment you show below, the channel credentials
element with 3 children.
    2. Create an org.apache.soap.Header
    3. Create a Vector with one element containing the Element from #1
    4. Pass the Vector to Header#setHeaderEntries
    5. Pass the Header to Call#setHeader

Scott Nichol

----- Original Message -----
From: "Dan Allen" <da...@nist.gov>
To: <so...@xml.apache.org>
Sent: Monday, September 23, 2002 11:22 AM
Subject: RE: SOAP Headers


>
> I can't help with examples but the general idea is to use the
Envelope.setEnvelopeEntries()
> method to add the headers.  IIRC the argument is a Vector of DOM Elements
to be used as
> header entries.  I also seem to recall that this is an all-or-none
operation.  Whatever you
> pass in replaces anything already there so you should call
getEnvelopeEntries() to obtain any
>       existing header entries, add your headers to the set returned, and
then call the set method.
>
> Hope this helps. It's all from recollection of the source code and the
Docs are not useful
> so I'd suggest you peruse the source yourself for a definitive answer.
>
> Dan
>
> > -----Original Message-----
> > From: Martin Pichardo [mailto:martinpi@hotmail.com]
> > Sent: Monday, September 23, 2002 8:30 AM
> > To: soap-user@xml.apache.org
> > Subject: SOAP Headers
> >
> >
> > Hello,
> >
> > I am trying to consume a .Net web service with the Apache soap toolkit.
The
> > web service is expecting the following header:
> >
> > <tns:sdpChannelCredentials id="id1">
> >   <UserName xsi:type="xsd:string">Martin Pichardo</UserName>
> >   <UserSecurityToken xsi:type="xsd:string">Password</UserSecurityToken>
> >   <UserServiceChannel xsi:type="xsd:string">any
text</UserServiceChannel>
> > </tns:sdpChannelCredentials>
> >
> > I haven't been able to create a soap hearder with the toolkit. Can
anyone
> > provide a code snippet for creating the soap header as illustrated
above.
> >
> > any suggestions are appreciated,
> >
> > Thanks,
> >
> > Martin
> >
> >
> > _________________________________________________________________
> > Send and receive Hotmail on your mobile device: http://mobile.msn.com
> >
> >
> > --
> > To unsubscribe, e-mail:   <ma...@xml.apache.org>
> > For additional commands, e-mail: <ma...@xml.apache.org>
> >
>
> --
> To unsubscribe, e-mail:   <ma...@xml.apache.org>
> For additional commands, e-mail: <ma...@xml.apache.org>
>
>


Re: SOAP Headers

Posted by Scott Nichol <sn...@scottnichol.com>.
Assuming you are using the RPC API, here's what I would try

    1. Create the DOM fragment you show below, the channel credentials
element with 3 children.
    2. Create an org.apache.soap.Header
    3. Create a Vector with one element containing the Element from #1
    4. Pass the Vector to Header#setHeaderEntries
    5. Pass the Header to Call#setHeader

Scott Nichol

----- Original Message -----
From: "Dan Allen" <da...@nist.gov>
To: <so...@xml.apache.org>
Sent: Monday, September 23, 2002 11:22 AM
Subject: RE: SOAP Headers


>
> I can't help with examples but the general idea is to use the
Envelope.setEnvelopeEntries()
> method to add the headers.  IIRC the argument is a Vector of DOM Elements
to be used as
> header entries.  I also seem to recall that this is an all-or-none
operation.  Whatever you
> pass in replaces anything already there so you should call
getEnvelopeEntries() to obtain any
>       existing header entries, add your headers to the set returned, and
then call the set method.
>
> Hope this helps. It's all from recollection of the source code and the
Docs are not useful
> so I'd suggest you peruse the source yourself for a definitive answer.
>
> Dan
>
> > -----Original Message-----
> > From: Martin Pichardo [mailto:martinpi@hotmail.com]
> > Sent: Monday, September 23, 2002 8:30 AM
> > To: soap-user@xml.apache.org
> > Subject: SOAP Headers
> >
> >
> > Hello,
> >
> > I am trying to consume a .Net web service with the Apache soap toolkit.
The
> > web service is expecting the following header:
> >
> > <tns:sdpChannelCredentials id="id1">
> >   <UserName xsi:type="xsd:string">Martin Pichardo</UserName>
> >   <UserSecurityToken xsi:type="xsd:string">Password</UserSecurityToken>
> >   <UserServiceChannel xsi:type="xsd:string">any
text</UserServiceChannel>
> > </tns:sdpChannelCredentials>
> >
> > I haven't been able to create a soap hearder with the toolkit. Can
anyone
> > provide a code snippet for creating the soap header as illustrated
above.
> >
> > any suggestions are appreciated,
> >
> > Thanks,
> >
> > Martin
> >
> >
> > _________________________________________________________________
> > Send and receive Hotmail on your mobile device: http://mobile.msn.com
> >
> >
> > --
> > To unsubscribe, e-mail:   <ma...@xml.apache.org>
> > For additional commands, e-mail: <ma...@xml.apache.org>
> >
>
> --
> To unsubscribe, e-mail:   <ma...@xml.apache.org>
> For additional commands, e-mail: <ma...@xml.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@xml.apache.org>
For additional commands, e-mail: <ma...@xml.apache.org>


RE: SOAP Headers

Posted by Dan Allen <da...@nist.gov>.
	I can't help with examples but the general idea is to use the Envelope.setEnvelopeEntries()
	method to add the headers.  IIRC the argument is a Vector of DOM Elements to be used as
	header entries.  I also seem to recall that this is an all-or-none operation.  Whatever you
	pass in replaces anything already there so you should call getEnvelopeEntries() to obtain any
      existing header entries, add your headers to the set returned, and then call the set method.

	Hope this helps. It's all from recollection of the source code and the Docs are not useful
	so I'd suggest you peruse the source yourself for a definitive answer.

	Dan

> -----Original Message-----
> From: Martin Pichardo [mailto:martinpi@hotmail.com]
> Sent: Monday, September 23, 2002 8:30 AM
> To: soap-user@xml.apache.org
> Subject: SOAP Headers
> 
> 
> Hello,
> 
> I am trying to consume a .Net web service with the Apache soap toolkit. The 
> web service is expecting the following header:
> 
> <tns:sdpChannelCredentials id="id1">
>   <UserName xsi:type="xsd:string">Martin Pichardo</UserName>
>   <UserSecurityToken xsi:type="xsd:string">Password</UserSecurityToken>
>   <UserServiceChannel xsi:type="xsd:string">any text</UserServiceChannel>
> </tns:sdpChannelCredentials>
> 
> I haven't been able to create a soap hearder with the toolkit. Can anyone 
> provide a code snippet for creating the soap header as illustrated above.
> 
> any suggestions are appreciated,
> 
> Thanks,
> 
> Martin
> 
> 
> _________________________________________________________________
> Send and receive Hotmail on your mobile device: http://mobile.msn.com
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@xml.apache.org>
> For additional commands, e-mail: <ma...@xml.apache.org>
> 

--
To unsubscribe, e-mail:   <ma...@xml.apache.org>
For additional commands, e-mail: <ma...@xml.apache.org>


RE: SOAP Headers

Posted by Dan Allen <da...@nist.gov>.
	I can't help with examples but the general idea is to use the Envelope.setEnvelopeEntries()
	method to add the headers.  IIRC the argument is a Vector of DOM Elements to be used as
	header entries.  I also seem to recall that this is an all-or-none operation.  Whatever you
	pass in replaces anything already there so you should call getEnvelopeEntries() to obtain any
      existing header entries, add your headers to the set returned, and then call the set method.

	Hope this helps. It's all from recollection of the source code and the Docs are not useful
	so I'd suggest you peruse the source yourself for a definitive answer.

	Dan

> -----Original Message-----
> From: Martin Pichardo [mailto:martinpi@hotmail.com]
> Sent: Monday, September 23, 2002 8:30 AM
> To: soap-user@xml.apache.org
> Subject: SOAP Headers
> 
> 
> Hello,
> 
> I am trying to consume a .Net web service with the Apache soap toolkit. The 
> web service is expecting the following header:
> 
> <tns:sdpChannelCredentials id="id1">
>   <UserName xsi:type="xsd:string">Martin Pichardo</UserName>
>   <UserSecurityToken xsi:type="xsd:string">Password</UserSecurityToken>
>   <UserServiceChannel xsi:type="xsd:string">any text</UserServiceChannel>
> </tns:sdpChannelCredentials>
> 
> I haven't been able to create a soap hearder with the toolkit. Can anyone 
> provide a code snippet for creating the soap header as illustrated above.
> 
> any suggestions are appreciated,
> 
> Thanks,
> 
> Martin
> 
> 
> _________________________________________________________________
> Send and receive Hotmail on your mobile device: http://mobile.msn.com
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@xml.apache.org>
> For additional commands, e-mail: <ma...@xml.apache.org>
>