wood burning stoves 2.0*
The moose likes Web Services and the fly likes Axis 1.4 username/password auth with stubs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Axis 1.4 username/password auth with stubs" Watch "Axis 1.4 username/password auth with stubs" New topic

Axis 1.4 username/password auth with stubs

Chris Wale

Joined: May 23, 2008
Posts: 3

I am using an Axis 1.4 client with a WebSphere 6.1 web service. I am using the username/password properties in the soap header to pass auth data. When I create a thin client not using Axis I can pass the auth data tot he web service fine and it all works but when I try to do the same thing with the Axis client I get.

faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.securityException
faultString: com.ibm.wsspi.wssecurity.SoapSecurityException: WSEC5048E: One of "SOAP Header" elements required.
{http://xml.apache.org/axis/}stackTrace:com.ibm.wsspi.wssecurity.SoapSecurityException: WSEC5048E: One of "SOAP Header" elements required.
at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:796)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:144)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at ca.ontario.health.crs.RegistrationSoapBindingStub.signOn(RegistrationSoapBindingStub.java:454)
at test.main(test.java:64)

I am using the WSDL2Java stubs in the client and then trying to add in the username/password to the Call class. Here is the code.

When I try and access the SOAP Header this way:


the value is null.

I am sure that it is something simple I am missing but I cannot seem to figure it out.

Thanks for any help.

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 41114
Welcome to JavaRanch.

I'd be hesitant to hand-code security if there are ready-made, tested, libraries that do can this for you. For Axis 1, that would be WSS4J. There's an article I wrote on the subject: Web Services Security - Authentication. It comes with ready-to-run code that demonstrates using WS-Security authentication with Axis 1.

Ping & DNS - my free Android networking tools app
Chris Wale

Joined: May 23, 2008
Posts: 3
Thanks Ulf,

The ws-security was what I was missing. Thanks.

One comment for others is that I did not see any link in the document as to where to get the xmlsec jar could be found but I got it at http://santuario.apache.org (If it is in the doc but I missed it sorry).

Thanks again,

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 41114
The jar file is part of WSS4J (which is linked in the article, but not very prominently).

Let us know how you make out.
It is sorta covered in the JavaRanch Style Guide.
subject: Axis 1.4 username/password auth with stubs
Similar Threads
Install Axis on iPlanet 6.0
Axis 1.4 Problem with DIME attachment
axis -ClassCastException...Pls help
unable to run the Axis client
No Such Operation Exception