Wsif Security for WSIF 2.0 API
Rajesh Kumar <[email protected]> Sat, 14 Nov 2009 17:58:54 +0530
| Newsgroups | gmane.comp.apache.webservices.wsif.user |
|---|---|
| Message-ID | <[email protected]> |
--001636b14b3b6e5548047853eb63
Content-Type: text/plain; charset=ISO-8859-1
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_ApacheAxis@faa550
portCtx org.apache.wsif.base.WSIFDefaultMessage@17b6643 name:null parts:null
context org.apache.wsif.base.WSIFDefaultMessage@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
--001636b14b3b6e5548047853eb63
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Hi,<br><br>I am using WSIF 2.0 and trying to invoke a WS on HTTPS and it is=
protected .<br><br>I am not able to find a way to add the credential in th=
e request. Can you please guide/help me in that?<br><br>Thank you. I would =
really appreciate your co-operation.<br>
<br>Please let me know any other information is required.<br><br>I have tri=
ed adding header like this<br><br>WSIFMessage portCtx =3D defPort.getContex=
t();<br>=A0=A0=A0=A0=A0=A0=A0=A0 System.out.println("portCtx "+po=
rtCtx);<br>=A0 portCtx.setObjectPart(org.<div id=3D":22p" class=3D"ii gt">
apache.wsif.WSIFConstants.CONTEXT_HTTP_USER,"username");<br>
=A0 portCtx.setObjectPart(org.apache.wsif.WSIFConstants.CONTEXT_HTTP_PSWD,&=
quot;password");<br>=A0 defPort.setContext(portCtx);<br><br>or <br><br=
>=A0WSIFOperation wsoperation =3D defPort.createOperation(wsoperationName, =
wsinputName, wsoutputName);<br>
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 WSIFMessage input =3D wsoperation.c=
reateInputMessage();<br><br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 WSIFMes=
sage context =3D wsoperation.getContext();<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0 <br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 context.setObjectP=
art(org.apache.wsif.WSIFConstants.CONTEXT_HTTP_USER,"username");<=
br>
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 context.setObjectPart(org.apache.ws=
if.WSIFConstants.CONTEXT_HTTP_PSWD,"password");<br>=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0 wsoperation.setContext(context);<br><br>I am ge=
tting the following exception.<br><br>defPort org.apache.wsif.providers.soa=
p.apacheaxis.WSIFPort_ApacheAxis@faa550<br>
portCtx org.apache.wsif.base.WSIFDefaultMessage@17b6643 name:null parts:nul=
l<br>context org.apache.wsif.base.WSIFDefaultMessage@da2cef name:null<br>Ex=
ecuting operation insert<br>org.apache.wsif.WSIFException: exception on AXI=
S invoke: (401)Authorization Required; nested exception is: <br>
=A0=A0=A0=A0=A0=A0=A0 (401)Authorization Required<br>=A0=A0=A0=A0=A0=A0=A0 =
at org.apache.wsif.providers.soap.apacheaxis.WSIFOperation_ApacheAxis.invok=
eAXISDocStyle(Unknown Source)<br>=A0=A0=A0=A0=A0=A0=A0 at org.apache.wsif.p=
roviders.soap.apacheaxis.WSIFOperation_ApacheAxis.invokeRequestResponseOper=
ation(Unknown Source)<br>
=A0=A0=A0=A0=A0=A0=A0 at org.apache.wsif.providers.soap.apacheaxis.WSIFOper=
ation_ApacheAxis.executeRequestResponseOperation(Unknown Source)<br>=A0=A0=
=A0=A0=A0=A0=A0 at com.ws.client.WsifWSClient.main(WsifWSClient.java:254)<b=
r>Caused by: (401)Authorization Required<br>
=A0=A0=A0=A0=A0=A0=A0 at org.apache.axis.transport.http.HTTPSender.readFrom=
Socket(HTTPSender.java:630)<br>=A0=A0=A0=A0=A0=A0=A0 at org.apache.axis.tra=
nsport.http.HTTPSender.invoke(HTTPSender.java:131)<br>=A0=A0=A0=A0=A0=A0=A0=
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.=
java:71)<br>
=A0=A0=A0=A0=A0=A0=A0 at org.apache.axis.SimpleChain.doVisiting(SimpleChain=
.java:156)<br>=A0=A0=A0=A0=A0=A0=A0 at org.apache.axis.SimpleChain.invoke(S=
impleChain.java:126)<br>=A0=A0=A0=A0=A0=A0=A0 at org.apache.axis.client.Axi=
sClient.invoke(AxisClient.java:182)<br>
=A0=A0=A0=A0=A0=A0=A0 at org.apache.axis.client.Call.invokeEngine(Call.java=
:2113)<br>=A0=A0=A0=A0=A0=A0=A0 at org.apache.axis.client.Call.invoke(Call.=
java:2102)<br>=A0=A0=A0=A0=A0=A0=A0 at org.apache.axis.client.Call.invoke(C=
all.java:1851)<br>=A0=A0=A0=A0=A0=A0=A0 at org.apache.axis.client.Call.invo=
ke(Call.java:1777)<br>
=A0=A0=A0=A0=A0=A0=A0 at org.apache.axis.client.Call.invoke(Call.java:1315)=
<br>=A0=A0=A0=A0=A0=A0=A0 ... 4 more<br>BUILD SUCCESSFUL (total time: 8 sec=
onds)<br><br>Thank you<br><font color=3D"#888888"><br>Rajesh Kumar</font></=
div>
--001636b14b3b6e5548047853eb63--