At least it doesnt return any error, in fact it doesnt returns any, with the
following code:
Thanks for your response.
EngineConfiguration config = new FileProvider("client_deploy.wsdd");
StockQuoteServiceService locator = new
StockQuoteServiceServiceLocator(config);
locator.getStockWss01(new URL("
http://localhost:8080/axis/services/stock-wss-01"));
StockQuoteService service = locator.getStockWss01();
StockWss01SoapBindingStub stub = new StockWss01SoapBindingStub();
stub._setProperty(WSHandlerConstants.ACTION,
WSHandlerConstants.SIGNATURE);
stub._setProperty(WSHandlerConstants.USER, "carlos");
PWCallback pwCallback = new PWCallback();
stub._setProperty(WSHandlerConstants.PW_CALLBACK_REF, pwCallback);
float quote = service.getQuote(args[0]);
2008/3/18, Rajendra Rajguru <[EMAIL PROTECTED]>:
>
> Hi
>
> Try to use the EngineConfiguration as:
>
> EngineConfiguration config = new FileProvider(<path of
> client_deploy.wsdd>);
> XXWSLocator locator = new XXWSLocator(config);
>
> String connectionUrl = <URL>;
> locator.setXXWSPortEndpointAddress(connectionUrl);
>
> Hope this would help!!!
> **
> **
> *Ignacio Elorriaga <[EMAIL PROTECTED]>* wrote:
>
> Hi at all.
>
> Few time ago I've just begin to develop WebServices Security, so I'm a
> newbie in this subject, and I was trying to make the "Hello World in Wss4j",
> with the example given in wss4j.zip, but I have a problem and I dont know
> why.
>
> First at all, I wat to know if I making something wrong with the process
> to develop a Secure WS. By I've readed the process is:
>
> 1.- Modify the server-config [1] to add the accion of security (in my case
> I wat a Signature instead of UsernameToken)
> 2.- Create the class PWCallbackHandler
> 3.- deploy the WS created, with the security maked
> 4.- Create the client_deploy.wsdd [2]
> 4.1.- With Wsdl2Java I generate the client's classes
> 5.- Create a Client's class to probe the WS, with the
> -DaxisClientConfigFile=client_deploy.wsdd[3] parameter
>
> After of all, (It's right, isn't it?), when I execute my Test class, I had
> an error [4] telling that Request does not contain required Security header.
> So I have been searching in google, and I saw they create a funtion,
> "createClientConfig" which returns an "EngineConfiguration" object, but this
> example dont allow to set any EngineConfiguration, neither in the locartor
> object nor Stub object
>
> Any help will be welcome, Im a little bit confusing in the subject .
>
> Many thanks to all
>
> [1]server-config.wsdd:
> <deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="
> http://xml.apache.org/axis/wsdd/providers/java">
> <service name="stock-wss-01" provider="java:RPC" style="document" use=
> "literal">
> <requestFlow>
> <handler type="java:org.apache.ws.axis.security.WSDoAllReceiver">
> <parameter name="passwordCallbackClass" value="
> samples.stock.client.PWCallback"/>
> <parameter name="action" value="UsernameToken"/>
> </handler>
> </requestFlow>
> <parameter name="className" value="
> samples.stock.client.StockQuoteService"/>
> <parameter name="allowedMethods" value="getQuote"/>
> <parameter name="scope" value="application"/>
> </service>
> </deployment>
>
> [2] client_deploy.wsdd:
> <deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="
> http://xml.apache.org/axis/wsdd/providers/java">
> <transport name="http" pivot="java:
> org.apache.axis.transport.http.HTTPSender"/>
> <globalConfiguration >
> <requestFlow >
> <handler type="java:org.apache.ws.axis.security.WSDoAllSender" >
> <parameter name="action" value="UsernameToken"/>
> <parameter name="user" value="carlos"/>
> <parameter name="passwordCallbackClass" value="
> samples.stock.client.PWCallback"/>
> <parameter name="passwordType" value="PasswordDigest"/>
> </handler>
> </requestFlow >
> </globalConfiguration >
> </deployment>
> [3] StockServiceClient
> java -Daxis.clientConfigFile=client_deploy.wsdd -cp %AXISCLASSPATH%
> samples.stock.client.StockServiceClient IBM
> *public* *static* *void* main(String[] args) *throws* ServiceException,
> RemoteException {
> *if* (args.length == 0) {
> System.*out*.println("Usage:\njava StockServiceClient
> [symbol]");
> *return*;
> }
> StockQuoteServiceService locator =
> *new*StockQuoteServiceServiceLocator();
> StockQuoteService service = locator.getStockWss01();
> *float* quote = service.getQuote(args[0]);
> System.*out*.println("stock quote service returned " + args[0] + ":
> " + quote);
> }
> [4] Traza error:
> - error
> AxisFault
> faultCode: {
> http://schemas.xmlsoap.org/soap/envelope/}Server.generalException<http://schemas.xmlsoap.org/soap/envelope/%7DServer.generalException>
> faultSubcode:
> faultString: WSDoAllReceiver: Request does not contain required Security
> header
>
> faultActor:
> faultNode:
> faultDetail:
>
> {http://xml.apache.org/axis/}hostname:zaz-elorriagai<http://xml.apache.org/axis/%7Dhostname:zaz-elorriagai>
>
> WSDoAllReceiver: Request does not contain required Security header
> 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
> (Deserializ
> ationContext.java:1087)
> at
> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endEleme
> nt(Unknown Source)
> at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp
> l.scanEndElement(Unknown Source)
> at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp
> l$FragmentContentDriver.next(Unknown Source)
> at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(U
> nknown Source)
> at
> com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next
> (Unknown Source)
> at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp
> l.scanDocument(Unknown Source)
> at
> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(U
> nknown Source)
> at
> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(U
> nknown Source)
> at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown
> So
> urce)
> at
> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Un
> known Source)
> at
> com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.p
> arse(Unknown Source)
> at javax.xml.parsers.SAXParser.parse(Unknown Source)
> at org.apache.axis.encoding.DeserializationContext.parse
> (Deserialization
> Context.java:227)
> at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
> [...]
>
>
>
>
> Cheers
> Rajendra Rajguru
>
> ------------------------------
> Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it
> now.<http://us.rd.yahoo.com/evt=51733/*http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ>
>
>