I don't know if this is what you are asking but it can't hurt to offer it.  I 
used WSDL2Java to generate the stubs and I also had to have authentication 
information in the SOAP header, this is how I did it but it might not be the 
best way:

  SomethingService service = new SomethingServiceLocator();

  Something svc = service.getSomethingSOAPPort();

  SomethingSoapBindingStub stub = (SomethingSoapBindingStub)svc;
  SOAPHeaderElement she = new SOAPHeaderElement("namespace", "AuthInfo");
  SOAPElement ut = she.addChildElement("UserToken");
  SOAPElement un = ut.addChildElement("UserName");
  un.addTextNode("username");
  SOAPElement pw = ut.addChildElement("Password");
  pw.addTextNode("password");
  stub.setHeader(she);

When I make the call something like this is generated:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"; 
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:m="namespace">
<SOAP-ENV:Header>
        <m:AuthInfo>
                <m:UserToken>
                        <m:UserName>username</m:UserName>
                        <m:Password>password</m:Password>
                </m:UserToken>
        </m:AuthInfo>
</SOAP-ENV:Header>
        ......
</SOAP-ENV:Envelop>

Hope this helps.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Scott McCoy
Sent: Friday, February 10, 2006 2:06 PM
To: [email protected]
Subject: Re: Arbitrary Authenitcation Types (based on SOAP Headers)


I didn't get a response to this, so I thought I'd re-post it.

I just want a handler, before my handler, to get some values from the header 
and have the ability to stop the request.

How does that happen?


On 2/8/06, Scott McCoy <[EMAIL PROTECTED]> wrote:
Hello All,
    I have a specification that demands I use a SOAP Header element for 
credential verification, and from a technical perspective it needs to be highly 
reusable, with a technical requirement that it preceeds and stops processing of 
the SOAP Body.  I've found what seems to be just the ticket, which is simply 
adding a component via the < requestFlow/> element in WSDL or WSDD...But the 
problem I'm having is that I'm having difficulty finding documentation on doing 
this. 

    Essentially, I have the following (mock) request envelope:

<Envelope xmlns="?soap">
    <Header>
        <authenticate username="..." password="..."/> 
    </Header>
    <Body>
        <purchase>
            <order accountid=".." cardid=".." amount=".."/>
            <order accountid=".." cardid=".." amount=".."/> 
        </purchase>
    </Body>
</Envelope>


    Nevermind the details of the SOAP Body, handlers for this are easily 
generatable by WSDL2Java, but how do I deal with the SOAP Header in a 
respectible and logical fasion (Axis 1.3) ?


    Thanks,
    Scott S. McCoy

_________________________________________________

This message is for the designated recipient only and may contain privileged, 
proprietary, or otherwise private information. If you have received it in 
error, please notify the sender immediately and delete the original. Any other 
use of the email by you is prohibited.

Espanol - Deutsch - Nederlands - Francais - Italiano - Norsk - Svenska: 
www.cardinalhealth.com/legal/email

Reply via email to