Okay,
I think I've resolved this thanks to this post:
http://markmail.org/message/wkypgewpla4cs55r
I created my own Security header and populated the field with all of
the data the webservice I'm connecting to requires.
I disabled the outflowsecurity section in my axis2.xml file, and call
the code below when building my serviceclient
private void addCustomSecurityHeader()
{
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNsWsse =
fac.createOMNamespace("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd",
"wsse");
// create the security block
SOAP11Factory soap11Factory = new SOAP11Factory();
SOAPHeaderBlock soapHeaderBlock = new
SOAP11HeaderBlockImpl("Security",omNsWsse,soap11Factory);
soapHeaderBlock.setMustUnderstand(true);
// create the username Token element
OMElement usernameTokenElement =
fac.createOMElement("UsernameToken", omNsWsse);
// create the username element
OMElement usernameElement = fac.createOMElement("Username",
omNsWsse);
OMText omTextUsername = fac.createOMText(usernameElement,
"myuser");
usernameElement.addChild(omTextUsername);
// create the password element
OMElement passwordElement = fac.createOMElement("Password",
omNsWsse);
OMText omTextPassword = fac.createOMText(passwordElement,
"blah");
passwordElement.addChild(omTextPassword);
usernameTokenElement.addChild(usernameElement);
usernameTokenElement.addChild(passwordElement);
soapHeaderBlock.addChild(usernameTokenElement);
//create adminparameters element
OMElement adminParamsElement = fac.createOMElement(
"AdminParameters", "http://jasonclark.com/service", "");
OMElement orgIdElement = fac.createOMElement( "OrganizationId",
"", "");
OMText omOrgId = fac.createOMText( orgIdElement, "283757");
orgIdElement.addChild( omOrgId );
adminParamsElement.addChild( orgIdElement );
usernameTokenElement.addChild(adminParamsElement);
_serviceClient.addHeader(soapHeaderBlock);
}
2008/10/6 Jason Clark <[EMAIL PROTECTED]>:
> Hello all,
>
> I'm trying to add an addtional element to the UsernameToken field
> using Rampart 1.3
>
> Below is how I need the username token to look in order to
> successfully process the request:
>
> <wsse:UsernameToken
>
> xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
>
> wsu:Id="SecurityToken-8b6939-8b7e-4726-9bde-69eb0907161">
> <wsse:Username>jasonclark</wsse:Username>
> <wsse:Password
>
> Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">
> blah
> </wsse:Password>
> <wsse:Nonce>vS93bKlUrsRZMDZjC7Q==</wsse:Nonce>
> <wsu:Created>2008-10-06T14:41:30Z</wsu:Created>
> <AdminParameters
> xmlns="http://jasonclark.com/service">
> <OrganizationId
> xmlns="">2124</OrganizationId>
> </AdminParameters>
> </wsse:UsernameToken>
>
>
> The part i'm having trouble with is 'AdminParameters' node. I don't
> see anything in the outflow configuration that would allow me to
> specify a custom field for this.
>
> I'm guessing this isn't supported, but I was wondering if anyone could
> point me in the direction of a workaround that would allow me to add
> this to my request?
>
> Cheers,
> Jason.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]