Win a copy of Spring in Action (5th edition) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

axis 1.4 + wss4j not working.  RSS feed

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I try to follow an example on Java Ranch,
Web Services Security - Part 1: Authentication
by Ulf Dittmer, (http://www.javaranch.com/journal/200603/Journal200603.jsp#a2),

I use JDK 1.5, TOMCAT 5.5.23, wss4j 1.4. it is not working, i will be very much appreciated, if you can give me some advise.

Client Request:
POST /axis/services/fibonacci-sec HTTP/1.0
Content-Type: text/xml; charset=utf-8
Accept: application/soap+xml, application/dime, multipart/related, text/*
User-Agent: Axis/1.4
Host: localhost:9079
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: ""
Content-Length: 1149
Authorization: Basic d3N1c2VyOndzcHdk

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" soapenv:mustUnderstand="1"><wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="UsernameToken-11582167"><wsse:Username>wsuser</wsse:Username><wsse assword Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">wspwd</wsse assword></wsse:UsernameToken></wsse:Security></soapenv:Header><soapenv:Body><ns1:calculateFibonacci xmlns:ns1="urn:fibonacci" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><in0 href="#id0"></in0></ns1:calculateFibonacci><multiRef xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="xsd:int">4</multiRef></soapenv:Body></soapenv:Envelope>

The error on client side:

ug 21, 2008 12:13:01 PM org.apache.axis.utils.JavaUtils isAttachmentSupported
WARNING: Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.
Exception in thread "main" AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.generalException
faultSubcode:
faultString: WSDoAllReceiver: cannot get SOAP header after security processing; nested exception is:
org.xml.sax.SAXParseException: The root element is required in a well-formed document.
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}hostname:MANHEIM-5CEB713

WSDoAllReceiver: cannot get SOAP header after security processing; nested exception is:
org.xml.sax.SAXParseException: The root element is required in a well-formed document.
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 org.apache.xerces.jaxp.SAXParserImpl.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.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
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 localhost.axis.services.urn.xmltoday_delayed_quotes.GetQuoteSoapBindingStub.getQuote(GetQuoteSoapBindingStub.java:112)
at com.manheim.testclient.stock.StockServiceClient.main(StockServiceClient.java:30)

Error on server side:

org.apache.xml.security.c14n.InvalidCanonicalizerException: Unknown canonicalizer. No handler installed for URI htt
p://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments
at org.apache.xml.security.c14n.Canonicalizer.<init>(Unknown Source)
at org.apache.xml.security.c14n.Canonicalizer.getInstance(Unknown Source)
at org.apache.xml.security.utils.XMLUtils.outputDOM(Unknown Source)
at org.apache.ws.axis.security.WSDoAllReceiver.invoke(WSDoAllReceiver.java:204)
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.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.handlers.soap.SOAPService.invoke(SOAPService.java:454)
at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
 
Rancher
Posts: 42974
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

There are a couple of things that look odd to me. E.g., the SOAP shows both HTTP authentication and a WS-Security username. And the exception shows

localhost.axis.services.urn.xmltoday_delayed_quotes.GetQuoteSoapBindingStub.getQuote(GetQuoteSoapBindingStub.java:112)
at com.manheim.testclient.stock.StockServiceClient.main(StockServiceClient.java:30)


which doesn't look like the code from the article at all. Which client and server code are you running, exactly?

Also, WSS4J 1.4 is rather old; I'd use the latest version instead, or -much better- simply use the Rampart 1.4 module.
 
George lu
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for reply,

The wss4j is 1.5.4, i am wrong on this, the client program like this.

fibonacci.ws.Fibonacci fib = service.getfibonacci();
System.out.println(System.getProperty("axis.ClientConfigFile"));
Stub stub = (Stub) fib;
stub._setProperty(Stub.USERNAME_PROPERTY, "wsuser");
stub._setProperty(Stub.PASSWORD_PROPERTY, "wspwd");

stub._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:"+port+"/axis/services/fibonacci"+(wss?"-sec":""));
 
George lu
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
client side:

xception in thread "main" AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.generalException
faultSubcode:
faultString: WSDoAllReceiver: cannot get SOAP header after security processing; nested exception is:
org.xml.sax.SAXParseException: The root element is required in a well-formed document.
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}hostname:MANHEIM-5CEB713

WSDoAllReceiver: cannot get SOAP header after security processing; nested exception is:
org.xml.sax.SAXParseException: The root element is required in a well-formed document.
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.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
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.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
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 fibonacci.ws.FibonacciSoapBindingStub.calculateFibonacci(FibonacciSoapBindingStub.java:160)
at fibonacci.ClientJAXRPC.main(ClientJAXRPC.java:31)
 
George lu
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Problem is resolved. It is caused by xerces.jar in the classpath.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!