Hi,
I am using WSIF 2.0 and trying to invoke a WS on HTTPS and it is protected .
I am not able to find a way to add the credential in the request. Can you
please guide/help me in that?
Thank you. I would really appreciate your co-operation.
Please let me know any other information is required.
I have tried adding header like this
WSIFMessage portCtx = defPort.getContext();
System.out.println("portCtx "+portCtx);
portCtx.setObjectPart(org.
apache.wsif.WSIFConstants.CONTEXT_HTTP_USER,"username");
portCtx.setObjectPart(org.apache.wsif.WSIFConstants.CONTEXT_HTTP_PSWD,"password");
defPort.setContext(portCtx);
or
WSIFOperation wsoperation = defPort.createOperation(wsoperationName,
wsinputName, wsoutputName);
WSIFMessage input = wsoperation.createInputMessage();
WSIFMessage context = wsoperation.getContext();
context.setObjectPart(org.apache.wsif.WSIFConstants.CONTEXT_HTTP_USER,"username");
context.setObjectPart(org.apache.wsif.WSIFConstants.CONTEXT_HTTP_PSWD,"password");
wsoperation.setContext(context);
I am getting the following exception.
defPort org.apache.wsif.providers.soap.apacheaxis.wsifport_apachea...@faa550
portCtx org.apache.wsif.base.wsifdefaultmess...@17b6643 name:null parts:null
context org.apache.wsif.base.wsifdefaultmess...@da2cef name:null
Executing operation insert
org.apache.wsif.WSIFException: exception on AXIS invoke: (401)Authorization
Required; nested exception is:
(401)Authorization Required
at
org.apache.wsif.providers.soap.apacheaxis.WSIFOperation_ApacheAxis.invokeAXISDocStyle(Unknown
Source)
at
org.apache.wsif.providers.soap.apacheaxis.WSIFOperation_ApacheAxis.invokeRequestResponseOperation(Unknown
Source)
at
org.apache.wsif.providers.soap.apacheaxis.WSIFOperation_ApacheAxis.executeRequestResponseOperation(Unknown
Source)
at com.ws.client.WsifWSClient.main(WsifWSClient.java:254)
Caused by: (401)Authorization Required
at
org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:630)
at
org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:131)
at
org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:71)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:156)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:126)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:182)
at org.apache.axis.client.Call.invokeEngine(Call.java:2113)
at org.apache.axis.client.Call.invoke(Call.java:2102)
at org.apache.axis.client.Call.invoke(Call.java:1851)
at org.apache.axis.client.Call.invoke(Call.java:1777)
at org.apache.axis.client.Call.invoke(Call.java:1315)
... 4 more
BUILD SUCCESSFUL (total time: 8 seconds)
Thank you
Rajesh Kumar