SOAPHeaderElement element = envelope.getHeaderByName

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

SOAPHeaderElement element = envelope.getHeaderByName

plork123


Please can someone help me

I'm trying to implement the above line of code but stuck as to what to put
in the first parameter

SOAPHeaderElement element =
envelope.getHeaderByName("<a href="http://localhost:8080....what">http://localhost:8080....what goes in here",
"headername");

Can some please help me

Many thanks

_________________________________________________________________
It's fast, it's easy and it's free. Get MSN Messenger 7.0 today!
http://messenger.msn.co.uk

Reply | Threaded
Open this post in threaded view
|

Exception handling

Tom Ziemer
Hi everybody.

I am currently working on a web service that is supposed to authenticate
a user against a ldap server. If the username/password combination does
not match, my LdapAuthManager throws an exception, which is passed to my
web service, which in turn passes it to the client.

To achieve this I looked at the examples provided by axis and started
from there. I copied/pasted the NoSuchEmployeeFault to my application,
refactored the classname and updated my wsdd accordingly. Yet when I
deploy my service, I get a warning about a java.lang.Throwable and "An
xml schema anyType will be used to define this class in the wsdl file".
The service is working though, but an additional error is thrown when my
fault is thrown saying that there is no mapping to deserialize
java.lang.Object.
When I change the my custom exception to extend Exception and not
RemoteException, as specified in the examples, none of the
warnings/error mentioned above occur and everything is working nicely.

Of course I should be happy now and move on, yet I do not like to have
"loose ends", so if anybody could explain this, I'd be grateful.

Thanks,

Tom
Reply | Threaded
Open this post in threaded view
|

Re: SOAPHeaderElement element = envelope.getHeaderByName

Anne Thomas Manes
In reply to this post by plork123
The first parameter is the namespace URI of the header's QName; the
second parameter is the local name. So, for example, if you wanted to
retrieve the WS-Security header:

<wsse:Security xmlns:wsse="http://www.docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd
.../>

The first parameter would be
"http://www.docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"

And the second parameter would be
"Security"

Anne

On 5/6/05, Plorks mail <[hidden email]> wrote:

>
>
> Please can someone help me
>
> I'm trying to implement the above line of code but stuck as to what to put
> in the first parameter
>
> SOAPHeaderElement element =
> envelope.getHeaderByName("<a href="http://localhost:8080....what">http://localhost:8080....what goes in here",
> "headername");
>
> Can some please help me
>
> Many thanks
>
> _________________________________________________________________
> It's fast, it's easy and it's free. Get MSN Messenger 7.0 today!
> http://messenger.msn.co.uk
>
>
Reply | Threaded
Open this post in threaded view
|

Re: SOAPHeaderElement element = envelope.getHeaderByName

Anne Thomas Manes
QName = qualified name. It is the two part name of an element. For
example, the QName of this element: <foo:bar
xmlns:foo="urn:namespace:foo">blah</foo:bar>

is "foo:bar" which when deciphered really means "urn:namespace:foo}bar"

The "foo" in <foo:bar> is called the namespace prefix. It represents
the URI specified in the "foo" namespace declaration
(xmlns:foo="urn:namespace:foo")
The "bar" in <foo:bar> is called the local name.

The namespace for the element is defined by the targetNamespace
attribute in the schema that defines the element. So, for the above
example, the schema would look like this:

<s:schema targetNamespace="urn:namespace:foo"
      xmlns:s=""http://www.w3.org/2001/XMLSchema">
    <s:element name="foo" type="s:string/>
</s:schema>

So, going back to your original question, in order to retrieve a SOAP
header block by name, you must specify the QName of the SOAP header
block. The two parameters to the method include the namespace URI and
the local name.

Anne

On 5/6/05, Plorks mail <[hidden email]> wrote:

>
>
> Thanks for the reply
>
> I'm not understanding QName and where this fits in.
>
> I'm new to web services. I've got my java files and created a wdsl to expose
> it's methods
>
> I'm now trying to call the methods to test
>
> >From: Anne Thomas Manes <[hidden email]>
> >Reply-To: Anne Thomas Manes <[hidden email]>
> >To: [hidden email]
> >Subject: Re: SOAPHeaderElement element = envelope.getHeaderByName
> >Date: Fri, 6 May 2005 07:55:18 -0400
> >
> >The first parameter is the namespace URI of the header's QName; the
> >second parameter is the local name. So, for example, if you wanted to
> >retrieve the WS-Security header:
> >
> ><wsse:Security
> >xmlns:wsse="http://www.docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd
> >.../>
> >
> >The first parameter would be
> >"http://www.docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
> >
> >And the second parameter would be
> >"Security"
> >
> >Anne
> >
> >On 5/6/05, Plorks mail <[hidden email]> wrote:
> > >
> > >
> > > Please can someone help me
> > >
> > > I'm trying to implement the above line of code but stuck as to what to
> >put
> > > in the first parameter
> > >
> > > SOAPHeaderElement element =
> > > envelope.getHeaderByName("<a href="http://localhost:8080....what">http://localhost:8080....what goes in here",
> > > "headername");
> > >
> > > Can some please help me
> > >
> > > Many thanks
> > >
> > > _________________________________________________________________
> > > It's fast, it's easy and it's free. Get MSN Messenger 7.0 today!
> > > http://messenger.msn.co.uk
> > >
> > >
>
> _________________________________________________________________
> Use MSN Messenger to send music and pics to your friends
> http://messenger.msn.co.uk
>
>